Widget scaling
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -47,6 +47,9 @@
|
|||
kb_hold = false;
|
||||
kb_hkey = 0;
|
||||
|
||||
fpss = array_create(10);
|
||||
fpsr = 0;
|
||||
|
||||
_cursor_lock = false;
|
||||
|
||||
watcher_surface = surface_create(1, 1);
|
||||
|
|
|
@ -22,6 +22,19 @@ _HOVERING_ELEMENT = noone;
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region fpss
|
||||
if(fpsr++ % 5 == 0) {
|
||||
var ff = 0;
|
||||
for( var i = 1; i < 10; i++ ) {
|
||||
fpss[i] = fpss[i - 1]
|
||||
ff += fpss[i];
|
||||
}
|
||||
fpss[0] = fps_real;
|
||||
ff += fps_real;
|
||||
FPS_REAL = round(ff / 10);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region window & mouse
|
||||
//if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
|
|||
|
||||
static drawParam = function(params) {
|
||||
setParam(params);
|
||||
sb_small.setParam(params);
|
||||
|
||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
||||
}
|
||||
|
|
|
@ -71,18 +71,21 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
|
|||
|
||||
for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover);
|
||||
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var _bs = min(_h, ui(32));
|
||||
var _bx = _x;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
|
||||
|
||||
_w -= _bs + ui(4);
|
||||
_x += _bs + ui(4);
|
||||
if((_w - _bs) / 2 > ui(64)) {
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var _bx = _x;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
|
||||
|
||||
_w -= _bs + ui(4);
|
||||
_x += _bs + ui(4);
|
||||
}
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
||||
|
|
|
@ -78,7 +78,7 @@ function fontScrollBox(_onModify) : widget() constructor {
|
|||
draw_text(_x + ui(8), _y + _h / 2 - ui(2), _text);
|
||||
draw_set_alpha(1);
|
||||
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + w - 20, _y + _h / 2, 1, COLORS._main_icon, 0.5 + 0.5 * interactable);
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - min(_h / 2, ui(20)), _y + _h / 2, min(1, _h / 64), COLORS._main_icon, 0.5 + 0.5 * interactable);
|
||||
|
||||
if(WIDGET_CURRENT == self)
|
||||
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
|
||||
|
|
|
@ -17,10 +17,12 @@
|
|||
#region ======================================================================= MAIN =======================================================================
|
||||
globalvar OS, DEBUG, THEME, COLOR_KEYS;
|
||||
globalvar CMD, CMDIN;
|
||||
globalvar FPS_REAL;
|
||||
|
||||
OS = os_type;
|
||||
CMD = [];
|
||||
CMDIN = [];
|
||||
FPS_REAL = 0;
|
||||
|
||||
DEBUG = false;
|
||||
THEME = new Theme();
|
||||
|
|
|
@ -95,34 +95,37 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
|
|||
w = _w;
|
||||
h = _h * size;
|
||||
|
||||
if(extras && instanceof(extras) == "buttonClass") {
|
||||
extras.setFocusHover(active, hover);
|
||||
extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide);
|
||||
_w -= ui(40);
|
||||
var _bs = min(_h, ui(32));
|
||||
if((_w - _bs) / size > ui(64)) {
|
||||
if(extras && instanceof(extras) == "buttonClass") {
|
||||
extras.setFocusHover(active, hover);
|
||||
extras.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
_w += ui(4);
|
||||
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m);
|
||||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var th = _h * size - ui(8);
|
||||
var bx = _x;
|
||||
var by = _y + th / 2 - _bs / 2;
|
||||
b_link.draw(bx, by, _bs, _bs, _m, THEME.button_hide);
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
|
||||
}
|
||||
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
_w += ui(4);
|
||||
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m);
|
||||
_w -= ui(40);
|
||||
}
|
||||
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var th = _h * size - ui(8);
|
||||
|
||||
var bx = _x;
|
||||
var by = _y + th / 2 - ui(24 / 2);
|
||||
b_link.draw(bx, by, ui(24), ui(24), _m, THEME.button_hide);
|
||||
|
||||
_x += ui(28);
|
||||
_w -= ui(28);
|
||||
|
||||
var ww = _w / size;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, ww * size, _h * size, c_white, 1);
|
||||
|
|
|
@ -93,6 +93,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
draw_name = true;
|
||||
draggable = true;
|
||||
|
||||
draw_boundary = [ 0, 0, 0, 0 ];
|
||||
draw_graph_culled = false;
|
||||
|
||||
badgePreview = 0;
|
||||
|
@ -155,8 +156,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
input_hash_raw = "";
|
||||
|
||||
inputs_amount = 0;
|
||||
in_cache_len = 0;
|
||||
inputs_index = [];
|
||||
in_cache_len = 0;
|
||||
|
||||
outputs_amount = 0;
|
||||
outputs_index = [];
|
||||
out_cache_len = 0;
|
||||
|
@ -308,12 +310,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
run_in(1, method(self, resetDefault));
|
||||
|
||||
static getInputJunctionIndex = function(index) { #region
|
||||
INLINE
|
||||
|
||||
if(input_display_list == -1 || !use_display_list)
|
||||
return index;
|
||||
|
||||
var jun_list_arr = input_display_list[index];
|
||||
if(is_array(jun_list_arr)) return noone;
|
||||
if(is_array(jun_list_arr)) return noone;
|
||||
if(is_struct(jun_list_arr)) return noone;
|
||||
|
||||
return jun_list_arr;
|
||||
} #endregion
|
||||
|
||||
|
@ -324,6 +329,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
} #endregion
|
||||
|
||||
static updateIO = function() { #region
|
||||
for( var i = 0, n = ds_list_size(inputs); i < n; i++ )
|
||||
inputs[| i].visible_in_list = false;
|
||||
|
||||
inputs_amount = (input_display_list == -1 || !use_display_list)? ds_list_size(inputs) : array_length(input_display_list);
|
||||
inputs_index = array_create(inputs_amount);
|
||||
var _i = 0;
|
||||
|
@ -332,6 +340,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
if(_input == noone) continue;
|
||||
|
||||
inputs_index[_i++] = _input;
|
||||
inputs[| _input].visible_in_list = true;
|
||||
}
|
||||
inputs_amount = _i;
|
||||
array_resize(inputs_index, inputs_amount);
|
||||
|
@ -885,14 +894,37 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var x1 = (x + w) * _s + _x;
|
||||
var y1 = (y + h) * _s + _y;
|
||||
|
||||
draw_boundary[0] = minx;
|
||||
draw_boundary[1] = miny;
|
||||
draw_boundary[2] = maxx;
|
||||
draw_boundary[3] = maxy;
|
||||
|
||||
draw_graph_culled = !rectangle_in_rectangle(minx, miny, maxx, maxy, x0, y0, x1, y1);
|
||||
} #endregion
|
||||
|
||||
static getJunctionList = function() { #region
|
||||
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
|
||||
inputDisplayList = [];
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var ind = getInputJunctionIndex(i);
|
||||
if(ind == noone) continue;
|
||||
|
||||
var jun = ds_list_get(inputs, ind, noone);
|
||||
if(jun == noone || is_undefined(jun)) continue;
|
||||
if(!jun.isVisible()) continue;
|
||||
|
||||
array_push(inputDisplayList, jun);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static preDraw = function(_x, _y, _s) { #region
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
var jun;
|
||||
|
||||
getJunctionList();
|
||||
|
||||
var inspCount = hasInspector1Update() + hasInspector2Update();
|
||||
var ind = 1;
|
||||
if(hasInspector1Update()) {
|
||||
|
@ -913,10 +945,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
updatedOutTrigger.x = xx + w * _s;
|
||||
updatedOutTrigger.y = yy + 10;
|
||||
|
||||
if(in_cache_len != ds_list_size(inputs) || out_cache_len != ds_list_size(outputs)) {
|
||||
if(in_cache_len != array_length(inputDisplayList) || out_cache_len != ds_list_size(outputs)) {
|
||||
updateIO();
|
||||
|
||||
in_cache_len = ds_list_size(inputs);
|
||||
in_cache_len = array_length(inputDisplayList);
|
||||
out_cache_len = ds_list_size(outputs);
|
||||
}
|
||||
|
||||
|
@ -1038,7 +1070,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
static drawJunctionWidget = function(_x, _y, _mx, _my, _s, _hover, _focus) { #region
|
||||
if(!active) return;
|
||||
var hover = noone;
|
||||
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
|
||||
|
||||
var wh = 28 * _s;
|
||||
var ww = w * _s * 0.5;
|
||||
|
@ -1053,60 +1084,69 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var y1 = _y + h * _s;
|
||||
var ay = 0;
|
||||
|
||||
if(wh > line_get_height(f_p2))
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var ind = getInputJunctionIndex(i);
|
||||
if(ind == noone) continue;
|
||||
var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2];
|
||||
var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3];
|
||||
|
||||
var jun = ds_list_get(inputs, ind, noone);
|
||||
if(jun == noone || is_undefined(jun)) continue;
|
||||
if(!jun.isVisible()) continue;
|
||||
if(wh > line_get_height(f_p2)) {
|
||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||
var jun = inputDisplayList[i];
|
||||
|
||||
if(jy == 0) jy = jun.y - wh / 2;
|
||||
if(jy == 0) jy = jun.y - wh / 2;
|
||||
|
||||
var _param = new widgetParam(wx, jy, ww, wh, jun.showValue(),, _m, rx, ry);
|
||||
_param.s = wh;
|
||||
_param.font = f_p2;
|
||||
var _param = jun.graphWidgetP;
|
||||
|
||||
jun.y = jy + wh / 2;
|
||||
_param.x = wx;
|
||||
_param.y = jy;
|
||||
_param.w = ww;
|
||||
_param.h = wh;
|
||||
_param.data = jun.showValue();
|
||||
_param.m = _m;
|
||||
_param.rx = rx;
|
||||
_param.ry = ry;
|
||||
_param.s = wh;
|
||||
_param.font = f_p2;
|
||||
|
||||
if(is_instanceof(jun, checkBox))
|
||||
_param.halign = fa_center;
|
||||
jun.y = jy + wh / 2;
|
||||
|
||||
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
||||
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
||||
if(is_instanceof(jun, checkBox))
|
||||
_param.halign = fa_center;
|
||||
|
||||
var wd = jun.graphWidget;
|
||||
if(wd == noone) {
|
||||
jy += wh + 4 * _s;
|
||||
continue;
|
||||
//boundV = jy + max(wh, jun.graphWidgetH) > draw_boundary[1] && jy < draw_boundary[3];
|
||||
|
||||
if((boundH && boundV) || jun.graphWidgetH == 0) {
|
||||
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
||||
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
||||
|
||||
var wd = jun.graphWidget;
|
||||
|
||||
if(wd == noone) {
|
||||
jy += wh + 4 * _s;
|
||||
continue;
|
||||
}
|
||||
|
||||
wd.setFocusHover(_focus, _hover);
|
||||
var _h = wd.drawParam(_param);
|
||||
|
||||
jun.graphWidgetH = _h / _s;
|
||||
|
||||
if(wd.isHovering()) draggable = false;
|
||||
}
|
||||
|
||||
jy += (jun.graphWidgetH + 4) * _s;
|
||||
}
|
||||
|
||||
wd.setFocusHover(_focus, _hover);
|
||||
var _h = wd.drawParam(_param);
|
||||
|
||||
jun.graphWidgetH = _h / _s;
|
||||
jy += _h + 4 * _s;
|
||||
|
||||
if(wd.isHovering()) draggable = false;
|
||||
ay = jy + 2 * _s;
|
||||
h += (ay - y1) / _s;
|
||||
}
|
||||
|
||||
ay = jy + 2 * _s;
|
||||
h += max(0, (ay - y1) / _s);
|
||||
} #endregion
|
||||
|
||||
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
|
||||
if(!active) return;
|
||||
var hover = noone;
|
||||
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
|
||||
gpu_set_texfilter(true);
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var ind = getInputJunctionIndex(i);
|
||||
if(ind == noone) continue;
|
||||
|
||||
var jun = ds_list_get(inputs, ind, noone);
|
||||
if(jun == noone || is_undefined(jun)) continue;
|
||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||
var jun = inputDisplayList[i];
|
||||
|
||||
if(jun.drawJunction(_s, _mx, _my))
|
||||
hover = jun;
|
||||
|
@ -1157,20 +1197,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
show_output_name = _hov && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s);
|
||||
|
||||
if(show_input_name) {
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var ind = getInputJunctionIndex(i);
|
||||
if(ind == noone) continue;
|
||||
if(!inputs[| ind]) continue;
|
||||
|
||||
inputs[| ind].drawNameBG(_s);
|
||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||
var jun = inputDisplayList[i];
|
||||
jun.drawNameBG(_s);
|
||||
}
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var ind = getInputJunctionIndex(i);
|
||||
if(ind == noone) continue;
|
||||
if(!inputs[| ind]) continue;
|
||||
|
||||
inputs[| ind].drawName(_s, _mx, _my);
|
||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||
var jun = inputDisplayList[i];
|
||||
jun.drawName(_s, _mx, _my);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -557,6 +557,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidgetRaw = noone;
|
||||
graphWidget = noone;
|
||||
graphWidgetH = 0;
|
||||
graphWidgetP = new widgetParam(0, 0, 0, 0, 0);
|
||||
mapWidget = noone;
|
||||
active_tooltip = "";
|
||||
|
||||
|
@ -671,6 +672,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
#region ---- inspector ----
|
||||
visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path || _type == VALUE_TYPE.PCXnode;
|
||||
show_in_inspector = true;
|
||||
visible_in_list = true;
|
||||
|
||||
display_type = VALUE_DISPLAY._default;
|
||||
if(_type == VALUE_TYPE.curve) display_type = VALUE_DISPLAY.curve;
|
||||
|
@ -2260,8 +2262,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static drawJunction = function(_s, _mx, _my, sca = 1) { #region
|
||||
if(!isVisible()) return false;
|
||||
|
||||
var ss = max(0.25, _s / 2);
|
||||
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
||||
var is_hover = hov && point_in_circle(_mx, _my, x, y, 10 * _s * sca);
|
||||
|
@ -2293,8 +2293,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static drawNameBG = function(_s) { #region
|
||||
if(!isVisible()) return false;
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center);
|
||||
|
||||
var tw = string_width(name) + 32;
|
||||
|
@ -2313,8 +2311,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static drawName = function(_s, _mx, _my) { #region
|
||||
if(!isVisible()) return false;
|
||||
|
||||
var _hover = PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, x, y, 10 * _s);
|
||||
var _draw_cc = _hover? COLORS._main_text : COLORS._main_text_sub;
|
||||
draw_set_text(f_p1, fa_left, fa_center, _draw_cc);
|
||||
|
@ -2413,9 +2409,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(index == -1) return true;
|
||||
|
||||
if(is_array(node.input_display_list))
|
||||
return array_exists(node.input_display_list, index);
|
||||
return true;
|
||||
return visible_in_list;
|
||||
} #endregion
|
||||
|
||||
static extractNode = function(_type = extract_node) { #region
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { #region
|
||||
name = "Vector Split";
|
||||
color = COLORS.node_blend_number;
|
||||
setDimension(96, 32);
|
||||
setDimension(96);
|
||||
|
||||
draw_padding = 4;
|
||||
|
||||
|
|
|
@ -82,22 +82,25 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
|
|||
|
||||
for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover);
|
||||
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var _bs = min(_h, ui(32));
|
||||
var _bx = _x;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
|
||||
|
||||
_w -= _bs + ui(4);
|
||||
_x += _bs + ui(4);
|
||||
if((_w - _bs) / 2 > ui(64)) {
|
||||
b_link.setFocusHover(active, hover);
|
||||
b_link.icon_index = linked;
|
||||
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_bx, _by + ui(4) + _h, _bs, _bs, _m);
|
||||
var _bx = _x;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
|
||||
|
||||
_w -= _bs + ui(4);
|
||||
_x += _bs + ui(4);
|
||||
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_bx, _by + ui(4) + _h, _bs, _bs, _m);
|
||||
}
|
||||
}
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
||||
|
|
|
@ -1041,7 +1041,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
draw_set_text(f_p0, fa_right, fa_top, fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative);
|
||||
draw_text(w - ui(8), right_menu_y, $"{__txt("fps")} {fps}");
|
||||
draw_text(w - ui(8), right_menu_y, $"{__txt("fps")} {fps} / {FPS_REAL}");
|
||||
right_menu_y += string_height("l");
|
||||
|
||||
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub);
|
||||
|
|
|
@ -74,17 +74,20 @@ function quarternionBox(_onModify) : widget() constructor {
|
|||
|
||||
current_value = _data;
|
||||
|
||||
var bs = min(_h, ui(32));
|
||||
var bx = _x + _w - bs;
|
||||
var by = _y + _h / 2 - bs / 2;
|
||||
var _bs = min(_h, ui(32));
|
||||
var _disp = struct_try_get(_display_data, "angle_display");
|
||||
tooltip.index = _disp;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
|
||||
clickable = false;
|
||||
_display_data.angle_display = (_disp + 1) % 2;
|
||||
if((_w - _bs) / 2 > ui(64)) {
|
||||
var bx = _x + _w - _bs;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
tooltip.index = _disp;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
|
||||
clickable = false;
|
||||
_display_data.angle_display = (_disp + 1) % 2;
|
||||
}
|
||||
_w -= _bs + ui(8);
|
||||
}
|
||||
_w -= ui(40);
|
||||
|
||||
size = _disp? 3 : 4;
|
||||
var ww = _w / size;
|
||||
|
|
|
@ -76,28 +76,30 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
|||
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
var _bs = min(_h, ui(32));
|
||||
|
||||
if(_w - _bs > ui(100) && side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
if((_w - _bs) / 2 > ui(64)) {
|
||||
if(side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
if(linked) {
|
||||
onModify(0, _data[0]);
|
||||
onModify(1, _data[0]);
|
||||
}
|
||||
}
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
if(linked) {
|
||||
onModify(0, _data[0]);
|
||||
onModify(1, _data[0]);
|
||||
}
|
||||
}
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
|
||||
var ww = linked? _w : _w / 2;
|
||||
disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5);
|
||||
|
||||
|
|
|
@ -43,17 +43,18 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
|||
|
||||
if(!is_real(_data)) return;
|
||||
|
||||
var _bs = min(_h, ui(32));
|
||||
var _r = _h;
|
||||
var _bs = min(_h, ui(32));
|
||||
var _drawRot = _w - _r > ui(64);
|
||||
|
||||
if(_w - _bs > ui(100) && side_button) {
|
||||
if(_drawRot && side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var _r = _h;
|
||||
var _tx = _x + _r + ui(4);
|
||||
var _tw = _w - _r - ui(4);
|
||||
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
||||
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
||||
|
@ -61,61 +62,64 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
|||
tb_value.setFocusHover(active, hover);
|
||||
tb_value.draw(_tx, _y, _tw, _h, _data, _m);
|
||||
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
if(_drawRot) {
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
|
||||
if(dragging) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
if(dragging) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
var real_val = round(dragging.delta_acc + drag_sv);
|
||||
var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
|
||||
var real_val = round(dragging.delta_acc + drag_sv);
|
||||
var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
|
||||
|
||||
if(valStep != -1) val = round(real_val / valStep) * valStep;
|
||||
if(valStep != -1) val = round(real_val / valStep) * valStep;
|
||||
|
||||
if(onModify(val))
|
||||
UNDO_HOLDING = true;
|
||||
if(onModify(val))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
MOUSE_BLOCK = true;
|
||||
MOUSE_BLOCK = true;
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
onModify(drag_sv);
|
||||
instance_destroy(dragging);
|
||||
dragging = noone;
|
||||
UNDO_HOLDING = false;
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
onModify(drag_sv);
|
||||
instance_destroy(dragging);
|
||||
dragging = noone;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(dragging);
|
||||
dragging = noone;
|
||||
UNDO_HOLDING = false;
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(dragging);
|
||||
dragging = noone;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
drag_sv = _data;
|
||||
}
|
||||
|
||||
if(key_mod_press(SHIFT)) {
|
||||
var amo = 1;
|
||||
if(key_mod_press(CTRL)) amo *= 10;
|
||||
if(key_mod_press(ALT)) amo /= 10;
|
||||
|
||||
if(mouse_wheel_down()) onModify(_data + amo * SCROLL_SPEED);
|
||||
if(mouse_wheel_up()) onModify(_data - amo * SCROLL_SPEED);
|
||||
}
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_f("angle", degtorad(_data));
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
drag_sv = _data;
|
||||
}
|
||||
|
||||
if(key_mod_press(SHIFT)) {
|
||||
var amo = 1;
|
||||
if(key_mod_press(CTRL)) amo *= 10;
|
||||
if(key_mod_press(ALT)) amo /= 10;
|
||||
|
||||
if(mouse_wheel_down()) onModify(_data + amo * SCROLL_SPEED);
|
||||
if(mouse_wheel_up()) onModify(_data - amo * SCROLL_SPEED);
|
||||
}
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
|
||||
resetFocus();
|
||||
|
||||
return h;
|
||||
|
|
|
@ -61,9 +61,11 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
|
||||
var _kHover = dragging_index;
|
||||
var _r = _h;
|
||||
var _drawRot = _w - _r > ui(64);
|
||||
var _bs = min(_h, ui(32));
|
||||
var _tx = _x + _r + ui(4);
|
||||
var _tw = _w - _r - ui(8) - _bs;
|
||||
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
||||
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
||||
var _ty = _y;
|
||||
|
||||
switch(mode) {
|
||||
case 2 :
|
||||
|
@ -80,40 +82,42 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, c_white, 0.5 + 0.5 * interactable);
|
||||
}
|
||||
|
||||
tooltip.index = mode;
|
||||
if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region
|
||||
mode = (mode + 1) % 4;
|
||||
onModify(0, mode);
|
||||
if(_drawRot) {
|
||||
if((_w - _r) / 2 > ui(48)) {
|
||||
tooltip.index = mode;
|
||||
if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region
|
||||
mode = (mode + 1) % 4;
|
||||
onModify(0, mode);
|
||||
|
||||
if(mode == 0) {
|
||||
onModify(1, 0);
|
||||
onModify(2, 180);
|
||||
} else if(mode == 1) {
|
||||
onModify(1, (_data[1] + _data[2]) / 2);
|
||||
onModify(2, abs(_data[1] - _data[2]) / 2);
|
||||
} else if(mode == 2) {
|
||||
onModify(1, 0);
|
||||
onModify(2, 90);
|
||||
onModify(3, 180);
|
||||
onModify(4, 270);
|
||||
} else if(mode == 3) {
|
||||
onModify(1, 45);
|
||||
onModify(2, 225);
|
||||
onModify(3, 45);
|
||||
if(mode == 0) {
|
||||
onModify(1, 0);
|
||||
onModify(2, 180);
|
||||
} else if(mode == 1) {
|
||||
onModify(1, (_data[1] + _data[2]) / 2);
|
||||
onModify(2, abs(_data[1] - _data[2]) / 2);
|
||||
} else if(mode == 2) {
|
||||
onModify(1, 0);
|
||||
onModify(2, 90);
|
||||
onModify(3, 180);
|
||||
onModify(4, 270);
|
||||
} else if(mode == 3) {
|
||||
onModify(1, 45);
|
||||
onModify(2, 225);
|
||||
onModify(3, 45);
|
||||
}
|
||||
|
||||
} #endregion
|
||||
|
||||
_tw -= _bs + ui(4);
|
||||
}
|
||||
|
||||
} #endregion
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
}
|
||||
|
||||
_w -= _bs + ui(4);
|
||||
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
|
||||
var _tw = (_w - _r - ui(4)) / 2;
|
||||
var _tx = _x + _r + ui(4);
|
||||
var _ty = _y;
|
||||
_tw /= 2;
|
||||
|
||||
switch(mode) {
|
||||
case 0 : #region
|
||||
|
@ -123,64 +127,67 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
tb_min_0.draw(_tx, _ty, _tw, _h, array_safe_get(_data, 1), _m);
|
||||
tb_max_0.draw(_tx + _tw, _ty, _tw, _h, array_safe_get(_data, 2), _m);
|
||||
|
||||
if(dragging_index > -1) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
if(_drawRot) {
|
||||
if(dragging_index > -1) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
var val;
|
||||
var curr_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var modi = false;
|
||||
var val;
|
||||
var curr_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var modi = false;
|
||||
|
||||
curr_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
curr_val[2] = round(dragging.delta_acc + drag_sv[2]);
|
||||
curr_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
curr_val[2] = round(dragging.delta_acc + drag_sv[2]);
|
||||
|
||||
val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1];
|
||||
modi |= onModify(1, val);
|
||||
val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1];
|
||||
modi |= onModify(1, val);
|
||||
|
||||
val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2];
|
||||
modi |= onModify(2, val);
|
||||
val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2];
|
||||
modi |= onModify(2, val);
|
||||
|
||||
if(modi) UNDO_HOLDING = true;
|
||||
if(modi) UNDO_HOLDING = true;
|
||||
|
||||
MOUSE_BLOCK = true;
|
||||
MOUSE_BLOCK = true;
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _data[1], _data[2], 32);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _data[1], _data[2], 32);
|
||||
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
|
||||
break;
|
||||
#endregion
|
||||
|
||||
|
@ -191,61 +198,64 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
tb_min_0.draw(_tx, _ty, _tw, _h, array_safe_get(_data, 1), _m);
|
||||
tb_max_0.draw(_tx + _tw, _ty, _tw, _h, array_safe_get(_data, 2), _m);
|
||||
|
||||
var _a0 = _data[1] - _data[2];
|
||||
var _a1 = _data[1] + _data[2];
|
||||
if(_drawRot) {
|
||||
var _a0 = _data[1] - _data[2];
|
||||
var _a1 = _data[1] + _data[2];
|
||||
|
||||
if(dragging_index > -1) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
if(dragging_index > -1) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
|
||||
var val;
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var val;
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
|
||||
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
|
||||
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
|
||||
|
||||
if(onModify(1, val)) UNDO_HOLDING = true;
|
||||
if(onModify(1, val)) UNDO_HOLDING = true;
|
||||
|
||||
MOUSE_BLOCK = true;
|
||||
MOUSE_BLOCK = true;
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _a0, _a1, 32);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[1]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _a0, _a1, 32);
|
||||
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[1]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
|
||||
break;
|
||||
#endregion
|
||||
|
||||
|
@ -266,82 +276,85 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
tb_min_1.draw(_tx, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 3), _m);
|
||||
tb_max_1.draw(_tx + _tw, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 4), _m);
|
||||
|
||||
if(dragging_index > -1) {
|
||||
if(dragging_index == 1) _kc0 = COLORS._main_icon_light;
|
||||
else _kc1 = COLORS._main_icon_light;
|
||||
if(_drawRot) {
|
||||
if(dragging_index > -1) {
|
||||
if(dragging_index == 1) _kc0 = COLORS._main_icon_light;
|
||||
else _kc1 = COLORS._main_icon_light;
|
||||
|
||||
var val = point_direction(_kx, dragging_index == 1? _ky0 : _ky1, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
var val = point_direction(_kx, dragging_index == 1? _ky0 : _ky1, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
|
||||
var val;
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var modi = false;
|
||||
var val;
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var modi = false;
|
||||
|
||||
for( var i = 1; i <= 2; i++ ) {
|
||||
var ind = (dragging_index - 1) * 2 + i;
|
||||
for( var i = 1; i <= 2; i++ ) {
|
||||
var ind = (dragging_index - 1) * 2 + i;
|
||||
|
||||
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
|
||||
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
|
||||
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
|
||||
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
|
||||
|
||||
if(onModify(ind, val)) modi = true;
|
||||
if(onModify(ind, val)) modi = true;
|
||||
}
|
||||
|
||||
if(modi) {
|
||||
UNDO_HOLDING = true;
|
||||
MOUSE_BLOCK = true;
|
||||
}
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc0 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky0);
|
||||
}
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y + _h + ui(4), _x + _r, _y + _h + ui(4) + _r)) {
|
||||
_kc1 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky1);
|
||||
}
|
||||
}
|
||||
|
||||
if(modi) {
|
||||
UNDO_HOLDING = true;
|
||||
MOUSE_BLOCK = true;
|
||||
}
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky0, _kr, _data[1], _data[2], 32);
|
||||
draw_circle_angle(_kx, _ky1, _kr, _data[3], _data[4], 32);
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_color("color", _kc0);
|
||||
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
shader_set_color("color", _kc1);
|
||||
shader_set_f("angle", degtorad(_data[3]), degtorad(_data[4]));
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc0 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky0);
|
||||
}
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y + _h + ui(4), _x + _r, _y + _h + ui(4) + _r)) {
|
||||
_kc1 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky1);
|
||||
}
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky0, _kr, _data[1], _data[2], 32);
|
||||
draw_circle_angle(_kx, _ky1, _kr, _data[3], _data[4], 32);
|
||||
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_color("color", _kc0);
|
||||
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
|
||||
shader_set_color("color", _kc1);
|
||||
shader_set_f("angle", degtorad(_data[3]), degtorad(_data[4]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
|
||||
shader_reset();
|
||||
|
||||
break;
|
||||
#endregion
|
||||
|
||||
|
@ -360,77 +373,80 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
tb_max_0.draw(_tx, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 2), _m);
|
||||
tb_min_1.draw(_tx + _tw, _ty, _tw, h, array_safe_get(_data, 3), _m);
|
||||
|
||||
var _a0 = _data[1] - _data[3];
|
||||
var _a1 = _data[1] + _data[3];
|
||||
var _a2 = _data[2] - _data[3];
|
||||
var _a3 = _data[2] + _data[3];
|
||||
if(_drawRot) {
|
||||
var _a0 = _data[1] - _data[3];
|
||||
var _a1 = _data[1] + _data[3];
|
||||
var _a2 = _data[2] - _data[3];
|
||||
var _a3 = _data[2] + _data[3];
|
||||
|
||||
if(dragging_index > -1) {
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
if(dragging_index > -1) {
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var val;
|
||||
var ind = dragging_index;
|
||||
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
|
||||
var val;
|
||||
var ind = dragging_index;
|
||||
|
||||
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
|
||||
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
|
||||
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
|
||||
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
|
||||
|
||||
if(onModify(ind, val)) UNDO_HOLDING = true;
|
||||
if(onModify(ind, val)) UNDO_HOLDING = true;
|
||||
|
||||
MOUSE_BLOCK = true;
|
||||
MOUSE_BLOCK = true;
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]);
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc0 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky0);
|
||||
}
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y + _h + ui(4), _x + _r, _y + _h + ui(4) + _r)) {
|
||||
_kc1 = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky1);
|
||||
}
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc0 = COLORS._main_icon_light;
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky0, _kr, _a0, _a1, 32);
|
||||
draw_circle_angle(_kx, _ky1, _kr, _a2, _a3, 32);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky0);
|
||||
}
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y + _h + ui(4), _x + _r, _y + _h + ui(4) + _r)) {
|
||||
_kc1 = COLORS._main_icon_light;
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_color("color", _kc0);
|
||||
shader_set_f("angle", degtorad(_data[1]));
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 2;
|
||||
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
drag_dat = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky1);
|
||||
}
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
|
||||
shader_set_color("color", _kc1);
|
||||
shader_set_f("angle", degtorad(_data[2]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky0, _kr, _a0, _a1, 32);
|
||||
draw_circle_angle(_kx, _ky1, _kr, _a2, _a3, 32);
|
||||
|
||||
shader_set(sh_widget_rotator);
|
||||
shader_set_color("color", _kc0);
|
||||
shader_set_f("angle", degtorad(_data[1]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
|
||||
shader_set_color("color", _kc1);
|
||||
shader_set_f("angle", degtorad(_data[2]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
|
||||
shader_reset();
|
||||
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -42,82 +42,86 @@ function rotatorRange(_onModify) : widget() constructor {
|
|||
if(!is_real(_data[1])) return;
|
||||
|
||||
var _r = _h;
|
||||
var _tx = _x + _r + ui(4);
|
||||
var _tw = _w - _r - ui(4);
|
||||
var _drawRot = _w - _r > ui(64);
|
||||
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
||||
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
||||
|
||||
var _tw = (_w - _r - ui(4)) / 2;
|
||||
_tw /= 2;
|
||||
|
||||
tb_min.setFocusHover(active, hover);
|
||||
tb_min.draw(_x + _r + ui(4), _y, _tw, _h, _data[0], _m);
|
||||
tb_min.draw(_tx, _y, _tw, _h, _data[0], _m);
|
||||
|
||||
tb_max.setFocusHover(active, hover);
|
||||
tb_max.draw(_x + _r + ui(4) + _tw, _y, _tw, _h, _data[1], _m);
|
||||
tb_max.draw(_tx + _tw, _y, _tw, _h, _data[1], _m);
|
||||
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
if(_drawRot) {
|
||||
var _kx = _x + _r / 2;
|
||||
var _ky = _y + _r / 2;
|
||||
var _kr = (_r - ui(12)) / 2;
|
||||
var _kc = COLORS._main_icon;
|
||||
|
||||
if(dragging_index) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
if(dragging_index) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
var val = point_direction(_kx, _ky, _m[0], _m[1]);
|
||||
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
|
||||
|
||||
var val, real_val;
|
||||
var modi = false;
|
||||
var val, real_val;
|
||||
var modi = false;
|
||||
|
||||
real_val[0] = round(dragging.delta_acc + drag_sv[0]);
|
||||
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
real_val[0] = round(dragging.delta_acc + drag_sv[0]);
|
||||
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
|
||||
|
||||
val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0];
|
||||
modi |= onModify(0, val);
|
||||
val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0];
|
||||
modi |= onModify(0, val);
|
||||
|
||||
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
|
||||
modi |= onModify(1, val);
|
||||
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
|
||||
modi |= onModify(1, val);
|
||||
|
||||
if(modi) UNDO_HOLDING = true;
|
||||
MOUSE_BLOCK = true;
|
||||
if(modi) UNDO_HOLDING = true;
|
||||
MOUSE_BLOCK = true;
|
||||
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 2; i++ ) onModify(i, drag_dat[i]);
|
||||
if(mouse_check_button_pressed(mb_right)) {
|
||||
for( var i = 0; i < 2; i++ ) onModify(i, drag_dat[i]);
|
||||
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
} else if(mouse_release(mb_left)) {
|
||||
instance_destroy(rotator_Rotator);
|
||||
dragging = noone;
|
||||
dragging_index = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1] ];
|
||||
drag_dat = [ _data[0], _data[1] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
}
|
||||
|
||||
} else if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _r, _y + _r)) {
|
||||
_kc = COLORS._main_icon_light;
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _data[0], _data[1], 32);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
dragging_index = 1;
|
||||
drag_sv = [ _data[0], _data[1] ];
|
||||
drag_dat = [ _data[0], _data[1] ];
|
||||
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _kx, _ky);
|
||||
}
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_f("side", _r);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[0]), degtorad(_data[1]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
draw_set_color(CDEF.main_dkgrey);
|
||||
draw_circle_angle(_kx, _ky, _kr, _data[0], _data[1], 32);
|
||||
|
||||
shader_set(sh_widget_rotator_range);
|
||||
shader_set_color("color", _kc);
|
||||
shader_set_f("angle", degtorad(_data[0]), degtorad(_data[1]));
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
|
||||
shader_reset();
|
||||
|
||||
resetFocus();
|
||||
|
||||
return h;
|
||||
|
|
|
@ -100,7 +100,8 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
|
|||
if(mouse_press(mb_left)) deactivate();
|
||||
}
|
||||
|
||||
var _arw = sprite_get_width(arrow_spr) + ui(8);
|
||||
var _ars = min(1, _h / 64);
|
||||
var _arw = sprite_get_width(arrow_spr) * _ars + ui(8);
|
||||
var _spr = is_instanceof(_selVal, scrollItem) && _selVal.spr;
|
||||
|
||||
var _x0 = _x;
|
||||
|
@ -117,7 +118,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
|
|||
|
||||
if(_spr) draw_sprite_ext(_selVal.spr, _selVal.spr_ind, _x + ui(16), _yc, 1, 1, 0, _selVal.spr_blend, 1);
|
||||
|
||||
draw_sprite_ui_uniform(arrow_spr, arrow_ind, _x1 + _arw / 2, _yc, 1, COLORS._main_icon, 0.5 + 0.5 * interactable);
|
||||
draw_sprite_ui_uniform(arrow_spr, arrow_ind, _x1 + _arw / 2, _yc, _ars, COLORS._main_icon, 0.5 + 0.5 * interactable);
|
||||
|
||||
if(WIDGET_CURRENT == self)
|
||||
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
|
||||
|
|
|
@ -119,7 +119,7 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
draw_rectangle(sx0, sy0, sx1 - 1, sy1 - 1, true);
|
||||
|
||||
if(_type == VALUE_TYPE.surface)
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - ui(20), _y + _h / 2, 1, COLORS._main_icon);
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - min(_h / 2, ui(20)), _y + _h / 2, min(1, _h / 64), COLORS._main_icon, 0.5 + 0.5 * interactable);
|
||||
}
|
||||
|
||||
if(WIDGET_CURRENT == self)
|
||||
|
|
|
@ -429,8 +429,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
|
||||
var tx = _x;
|
||||
switch(align) {
|
||||
case fa_left : tx = _x + ui(8); break;
|
||||
case fa_center : tx = _x + _w / 2; break;
|
||||
case fa_left : tx = _x + ui(8); break;
|
||||
case fa_center : tx = _x + _w / 2; break;
|
||||
case fa_right : tx = _x + _w - ui(8); break;
|
||||
}
|
||||
|
||||
|
@ -440,9 +440,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||
|
||||
if(slide_range != noone) {
|
||||
var _minn = slide_range[0];
|
||||
var _maxx = slide_range[1];
|
||||
var _rang = abs(_maxx - _minn);
|
||||
var _minn = slide_range[0];
|
||||
var _maxx = slide_range[1];
|
||||
var _rang = abs(_maxx - _minn);
|
||||
var _currVal = toNumber(_current_text);
|
||||
|
||||
if(sliding != 2) {
|
||||
|
@ -455,20 +455,22 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
if(sliding == 2) {
|
||||
var _ax0 = _x + ui(10);
|
||||
var _ax1 = _x + _w - ui(10);
|
||||
var _ay = _y + _h / 2;
|
||||
if(_w > ui(48)) {
|
||||
if(sliding == 2) {
|
||||
var _ax0 = _x + ui(10);
|
||||
var _ax1 = _x + _w - ui(10);
|
||||
var _ay = _y + _h / 2;
|
||||
|
||||
draw_sprite_ui_uniform(THEME.arrow, 2, _ax0, _ay, 1, COLORS._main_accent, 1);
|
||||
draw_sprite_ui_uniform(THEME.arrow, 0, _ax1, _ay, 1, COLORS._main_accent, 1);
|
||||
draw_sprite_ui_uniform(THEME.arrow, 2, _ax0, _ay, 1, COLORS._main_accent, 1);
|
||||
draw_sprite_ui_uniform(THEME.arrow, 0, _ax1, _ay, 1, COLORS._main_accent, 1);
|
||||
|
||||
} else if(label != "") {
|
||||
draw_set_valign(fa_center)
|
||||
draw_set_color(COLORS._main_text_sub);
|
||||
draw_set_alpha(0.5);
|
||||
draw_text_add(_x + ui(8), _y + _h / 2, label);
|
||||
draw_set_alpha(1);
|
||||
} else if(label != "") {
|
||||
draw_set_valign(fa_center)
|
||||
draw_set_color(COLORS._main_text_sub);
|
||||
draw_set_alpha(0.5);
|
||||
draw_text_add(_x + ui(8), _y + _h / 2, label);
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
}
|
||||
|
||||
disp_x = lerp_float(disp_x, disp_x_to, 5);
|
||||
|
|
|
@ -43,7 +43,7 @@ function transformBox(_onModify) : widget() constructor {
|
|||
|
||||
static isHovering = function() {
|
||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||
return false;
|
||||
return hovering;
|
||||
}
|
||||
|
||||
static drawParam = function(params) {
|
||||
|
@ -64,19 +64,23 @@ function transformBox(_onModify) : widget() constructor {
|
|||
if(array_empty(_data)) return 0;
|
||||
if(is_array(_data[0])) return 0;
|
||||
|
||||
hovering = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
|
||||
|
||||
rot.setFocusHover(active, hover);
|
||||
for(var i = 0; i < array_length(_data); i++) {
|
||||
tb[i].setFocusHover(active, hover);
|
||||
tb[i].hide = true;
|
||||
}
|
||||
|
||||
var _lab = _w > ui(160);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
|
||||
var lbw = string_width(__txt("Position")) + ui(8);
|
||||
var lbw = _lab? string_width(__txt("Position")) + ui(8) : 0;
|
||||
var tbw = (_w - lbw) / 2;
|
||||
var tbh = _h;
|
||||
|
||||
draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable);
|
||||
|
@ -91,7 +95,7 @@ function transformBox(_onModify) : widget() constructor {
|
|||
_y += tbh + ui(4);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable);
|
||||
|
|
|
@ -111,40 +111,42 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
|
||||
current_value = _data;
|
||||
|
||||
var sz = min(size, array_length(_data));
|
||||
var _bs = min(_h, ui(32));
|
||||
|
||||
if(_w - _bs > ui(100) && side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
if(linkable) {
|
||||
var _icon_blend = linked? COLORS._main_accent : (link_inactive_color == noone? COLORS._main_icon : link_inactive_color);
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
if(linked) {
|
||||
onModify(0, _data[0]);
|
||||
onModify(1, _data[0]);
|
||||
}
|
||||
if((_w - _bs) / sz > ui(48)) {
|
||||
if(side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
if(unit != noone && unit.reference != noone) {
|
||||
unit.triggerButton.setFocusHover(iactive, ihover);
|
||||
unit.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
if(linkable) {
|
||||
var _icon_blend = linked? COLORS._main_accent : (link_inactive_color == noone? COLORS._main_icon : link_inactive_color);
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
if(linked) {
|
||||
onModify(0, _data[0]);
|
||||
onModify(1, _data[0]);
|
||||
}
|
||||
}
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
}
|
||||
|
||||
var sz = min(size, array_length(_data));
|
||||
var ww = per_line? _w : _w / sz;
|
||||
|
||||
if(!per_line) {
|
||||
|
|
|
@ -80,23 +80,25 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
|||
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
|
||||
|
||||
var _bs = min(_h, ui(32));
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
if((_w - _bs) / 2 > ui(64)) {
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
if(linked) {
|
||||
for(var i = 0; i < size; i += 2) {
|
||||
onModify(i + 0, _data[i]);
|
||||
onModify(i + 1, _data[i]);
|
||||
if(linked) {
|
||||
for(var i = 0; i < size; i += 2) {
|
||||
onModify(i + 0, _data[i]);
|
||||
onModify(i + 1, _data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
_x += _bs + ui(4);
|
||||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var ww = _w / 2;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float side;
|
||||
uniform vec4 color;
|
||||
uniform float angle;
|
||||
|
||||
|
@ -23,8 +24,8 @@ void main() {
|
|||
bool inside = dist < 0.;
|
||||
|
||||
dist = abs(dist);
|
||||
alp = max(alp, smoothstep(0.1, 0., dist));
|
||||
alp = max(alp, smoothstep(0.1, 0., line_segment(angle)));
|
||||
alp = max(alp, smoothstep(2. / side, 0.8 / side, dist));
|
||||
alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle)));
|
||||
|
||||
gl_FragColor = vec4(color.rgb, alp);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float side;
|
||||
uniform vec4 color;
|
||||
uniform vec2 angle;
|
||||
|
||||
|
@ -23,9 +24,9 @@ void main() {
|
|||
bool inside = dist < 0.;
|
||||
|
||||
dist = abs(dist);
|
||||
alp = max(alp, smoothstep(0.1, 0., dist));
|
||||
alp = max(alp, smoothstep(0.1, 0., line_segment(angle[0])));
|
||||
alp = max(alp, smoothstep(0.1, 0., line_segment(angle[1])));
|
||||
alp = max(alp, smoothstep(2. / side, 0.8 / side, dist));
|
||||
alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle[0])));
|
||||
alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle[1])));
|
||||
|
||||
gl_FragColor = vec4(color.rgb, alp);
|
||||
}
|
||||
|
|