diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 5044b0ab1..f7b9d5518 100644 Binary files a/fonts/_f_sdf/_f_sdf.old.png and b/fonts/_f_sdf/_f_sdf.old.png differ diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index d2beecec9..10af973b9 100644 Binary files a/fonts/_f_sdf/_f_sdf.png and b/fonts/_f_sdf/_f_sdf.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.old.png b/fonts/_f_sdf_medium/_f_sdf_medium.old.png index 86a78eda9..383399136 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.old.png and b/fonts/_f_sdf_medium/_f_sdf_medium.old.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index 216fdd2c9..ba25afc6c 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.png and b/fonts/_f_sdf_medium/_f_sdf_medium.png differ diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index dae061e0e..c64208f43 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -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); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index d6a722cbc..cd0879223 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -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; diff --git a/scripts/buttonGroup/buttonGroup.gml b/scripts/buttonGroup/buttonGroup.gml index 80f29ab3f..8d52014e7 100644 --- a/scripts/buttonGroup/buttonGroup.gml +++ b/scripts/buttonGroup/buttonGroup.gml @@ -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); } diff --git a/scripts/cornerBox/cornerBox.gml b/scripts/cornerBox/cornerBox.gml index bfc80a908..efa276d13 100644 --- a/scripts/cornerBox/cornerBox.gml +++ b/scripts/cornerBox/cornerBox.gml @@ -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); diff --git a/scripts/fontScrollBox/fontScrollBox.gml b/scripts/fontScrollBox/fontScrollBox.gml index a4d58c254..f682e0f7b 100644 --- a/scripts/fontScrollBox/fontScrollBox.gml +++ b/scripts/fontScrollBox/fontScrollBox.gml @@ -77,8 +77,8 @@ function fontScrollBox(_onModify) : widget() constructor { else if(align == fa_left) 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); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 82137021a..3666c32b2 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -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(); diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index d6fedd472..50f5184e2 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -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); + 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); + 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); + } - 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); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 9fefee6be..aac8072aa 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -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 jun = ds_list_get(inputs, ind, noone); - if(jun == noone || is_undefined(jun)) continue; - if(!jun.isVisible()) continue; - - 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; - - jun.y = jy + wh / 2; - - if(is_instanceof(jun, checkBox)) - _param.halign = fa_center; - - 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; - jy += _h + 4 * _s; - - if(wd.isHovering()) draggable = false; - } + 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]; - ay = jy + 2 * _s; - h += max(0, (ay - y1) / _s); + 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; + + var _param = jun.graphWidgetP; + + _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; + + jun.y = jy + wh / 2; + + if(is_instanceof(jun, checkBox)) + _param.halign = fa_center; + + //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; + } + + ay = jy + 2 * _s; + h += (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); } } diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index e0e1e8863..084a61105 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -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 diff --git a/scripts/node_vector_split/node_vector_split.gml b/scripts/node_vector_split/node_vector_split.gml index 1b3c9fb97..5834da61c 100644 --- a/scripts/node_vector_split/node_vector_split.gml +++ b/scripts/node_vector_split/node_vector_split.gml @@ -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; diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index b119af9b4..0ad69330d 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -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); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index d1d79fe91..3a9d26c84 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -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); diff --git a/scripts/quarternionBox/quarternionBox.gml b/scripts/quarternionBox/quarternionBox.gml index 91cdf88ab..cce0ceb92 100644 --- a/scripts/quarternionBox/quarternionBox.gml +++ b/scripts/quarternionBox/quarternionBox.gml @@ -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; diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index af1284689..7203452e1 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -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); diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index cfabf9fe6..d2c55ccd2 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -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,60 +62,63 @@ 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; - - 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); - } - } - shader_set(sh_widget_rotator); - shader_set_color("color", _kc); - shader_set_f("angle", degtorad(_data)); + shader_set(sh_widget_rotator); + shader_set_color("color", _kc); + shader_set_f("side", _r); + shader_set_f("angle", degtorad(_data)); - draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); - shader_reset(); + draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); + shader_reset(); + } resetFocus(); diff --git a/scripts/rotatorRandom/rotatorRandom.gml b/scripts/rotatorRandom/rotatorRandom.gml index a7d82d8ce..8ee35ab31 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -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(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; + } 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; + 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); - } + 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); + } + } + + 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_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; + } 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); + 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); + } } + + draw_set_color(CDEF.main_dkgrey); + draw_circle_angle(_kx, _ky, _kr, _a0, _a1, 32); + + 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(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]); + 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; + } 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 = 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(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_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_f("side", _r); + 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(); } - 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; + } 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 = 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(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_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_f("side", _r); + 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(); } - 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 } diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index 9fa516fc2..01ab33963 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -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); + + 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])); - 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); - } + 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; diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index 308599c74..4866d1ec1 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -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); diff --git a/scripts/surfaceBox/surfaceBox.gml b/scripts/surfaceBox/surfaceBox.gml index fc4e7332f..096a1d54f 100644 --- a/scripts/surfaceBox/surfaceBox.gml +++ b/scripts/surfaceBox/surfaceBox.gml @@ -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) diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 0511624d4..e9ecb47aa 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -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); diff --git a/scripts/transformBox/transformBox.gml b/scripts/transformBox/transformBox.gml index e72820093..6a419fcf6 100644 --- a/scripts/transformBox/transformBox.gml +++ b/scripts/transformBox/transformBox.gml @@ -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); diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index b83e7c7a7..c95ce0b83 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -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) { diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index de8134a77..6507df199 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -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; diff --git a/shaders/sh_widget_rotator/sh_widget_rotator.fsh b/shaders/sh_widget_rotator/sh_widget_rotator.fsh index 44d3fb722..a141bdcde 100644 --- a/shaders/sh_widget_rotator/sh_widget_rotator.fsh +++ b/shaders/sh_widget_rotator/sh_widget_rotator.fsh @@ -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); } diff --git a/shaders/sh_widget_rotator_range/sh_widget_rotator_range.fsh b/shaders/sh_widget_rotator_range/sh_widget_rotator_range.fsh index 1a1085f8a..1a5bd6efb 100644 --- a/shaders/sh_widget_rotator_range/sh_widget_rotator_range.fsh +++ b/shaders/sh_widget_rotator_range/sh_widget_rotator_range.fsh @@ -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); }