Widget scaling

This commit is contained in:
Tanasart 2024-03-29 11:20:49 +07:00
parent 713ec674ab
commit bdc44bf71f
29 changed files with 652 additions and 554 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -47,6 +47,9 @@
kb_hold = false; kb_hold = false;
kb_hkey = 0; kb_hkey = 0;
fpss = array_create(10);
fpsr = 0;
_cursor_lock = false; _cursor_lock = false;
watcher_surface = surface_create(1, 1); watcher_surface = surface_create(1, 1);

View file

@ -22,6 +22,19 @@ _HOVERING_ELEMENT = noone;
} }
#endregion #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 #region window & mouse
//if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG; //if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG;

View file

@ -42,6 +42,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
static drawParam = function(params) { static drawParam = function(params) {
setParam(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); return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
} }

View file

@ -71,18 +71,21 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover); for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover);
var _bs = min(_h, ui(32));
if((_w - _bs) / 2 > ui(64)) {
b_link.setFocusHover(active, hover); b_link.setFocusHover(active, hover);
b_link.icon_index = linked; b_link.icon_index = linked;
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
var _bs = min(_h, ui(32));
var _bx = _x; var _bx = _x;
var _by = _y + _h / 2 - _bs / 2; var _by = _y + _h / 2 - _bs / 2;
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide); b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
_w -= _bs + ui(4); _w -= _bs + ui(4);
_x += _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, 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); draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);

View file

@ -78,7 +78,7 @@ function fontScrollBox(_onModify) : widget() constructor {
draw_text(_x + ui(8), _y + _h / 2 - ui(2), _text); draw_text(_x + ui(8), _y + _h / 2 - ui(2), _text);
draw_set_alpha(1); 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) 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); draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);

View file

@ -17,10 +17,12 @@
#region ======================================================================= MAIN ======================================================================= #region ======================================================================= MAIN =======================================================================
globalvar OS, DEBUG, THEME, COLOR_KEYS; globalvar OS, DEBUG, THEME, COLOR_KEYS;
globalvar CMD, CMDIN; globalvar CMD, CMDIN;
globalvar FPS_REAL;
OS = os_type; OS = os_type;
CMD = []; CMD = [];
CMDIN = []; CMDIN = [];
FPS_REAL = 0;
DEBUG = false; DEBUG = false;
THEME = new Theme(); THEME = new Theme();

View file

@ -95,18 +95,20 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
w = _w; w = _w;
h = _h * size; h = _h * size;
var _bs = min(_h, ui(32));
if((_w - _bs) / size > ui(64)) {
if(extras && instanceof(extras) == "buttonClass") { if(extras && instanceof(extras) == "buttonClass") {
extras.setFocusHover(active, hover); extras.setFocusHover(active, hover);
extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); extras.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= ui(40); _w -= _bs + ui(8);
} }
if(unit != noone && unit.reference != noone) { if(unit != noone && unit.reference != noone) {
_w += ui(4); _w += ui(4);
unit.triggerButton.setFocusHover(iactive, ihover); unit.triggerButton.setFocusHover(iactive, ihover);
unit.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m); unit.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m);
_w -= ui(40); _w -= _bs + ui(8);
} }
b_link.setFocusHover(active, hover); b_link.setFocusHover(active, hover);
@ -115,13 +117,14 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
var th = _h * size - ui(8); var th = _h * size - ui(8);
var bx = _x; var bx = _x;
var by = _y + th / 2 - ui(24 / 2); var by = _y + th / 2 - _bs / 2;
b_link.draw(bx, by, ui(24), ui(24), _m, THEME.button_hide); b_link.draw(bx, by, _bs, _bs, _m, THEME.button_hide);
_x += ui(28); _x += _bs + ui(4);
_w -= ui(28); _w -= _bs + ui(4);
}
var ww = _w / size; var ww = _w / size;

View file

@ -93,6 +93,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
draw_name = true; draw_name = true;
draggable = true; draggable = true;
draw_boundary = [ 0, 0, 0, 0 ];
draw_graph_culled = false; draw_graph_culled = false;
badgePreview = 0; badgePreview = 0;
@ -155,8 +156,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
input_hash_raw = ""; input_hash_raw = "";
inputs_amount = 0; inputs_amount = 0;
in_cache_len = 0;
inputs_index = []; inputs_index = [];
in_cache_len = 0;
outputs_amount = 0; outputs_amount = 0;
outputs_index = []; outputs_index = [];
out_cache_len = 0; 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)); run_in(1, method(self, resetDefault));
static getInputJunctionIndex = function(index) { #region static getInputJunctionIndex = function(index) { #region
INLINE
if(input_display_list == -1 || !use_display_list) if(input_display_list == -1 || !use_display_list)
return index; return index;
var jun_list_arr = input_display_list[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; if(is_struct(jun_list_arr)) return noone;
return jun_list_arr; return jun_list_arr;
} #endregion } #endregion
@ -324,6 +329,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} #endregion } #endregion
static updateIO = function() { #region 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_amount = (input_display_list == -1 || !use_display_list)? ds_list_size(inputs) : array_length(input_display_list);
inputs_index = array_create(inputs_amount); inputs_index = array_create(inputs_amount);
var _i = 0; var _i = 0;
@ -332,6 +340,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(_input == noone) continue; if(_input == noone) continue;
inputs_index[_i++] = _input; inputs_index[_i++] = _input;
inputs[| _input].visible_in_list = true;
} }
inputs_amount = _i; inputs_amount = _i;
array_resize(inputs_index, inputs_amount); 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 x1 = (x + w) * _s + _x;
var y1 = (y + h) * _s + _y; 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); draw_graph_culled = !rectangle_in_rectangle(minx, miny, maxx, maxy, x0, y0, x1, y1);
} #endregion } #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 static preDraw = function(_x, _y, _s) { #region
var xx = x * _s + _x; var xx = x * _s + _x;
var yy = y * _s + _y; var yy = y * _s + _y;
var jun; var jun;
getJunctionList();
var inspCount = hasInspector1Update() + hasInspector2Update(); var inspCount = hasInspector1Update() + hasInspector2Update();
var ind = 1; var ind = 1;
if(hasInspector1Update()) { if(hasInspector1Update()) {
@ -913,10 +945,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
updatedOutTrigger.x = xx + w * _s; updatedOutTrigger.x = xx + w * _s;
updatedOutTrigger.y = yy + 10; 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(); updateIO();
in_cache_len = ds_list_size(inputs); in_cache_len = array_length(inputDisplayList);
out_cache_len = ds_list_size(outputs); 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 static drawJunctionWidget = function(_x, _y, _mx, _my, _s, _hover, _focus) { #region
if(!active) return; if(!active) return;
var hover = noone; var hover = noone;
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
var wh = 28 * _s; var wh = 28 * _s;
var ww = w * _s * 0.5; var ww = w * _s * 0.5;
@ -1053,18 +1084,25 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var y1 = _y + h * _s; var y1 = _y + h * _s;
var ay = 0; var ay = 0;
if(wh > line_get_height(f_p2)) var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2];
for(var i = 0; i < amo; i++) { var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3];
var ind = getInputJunctionIndex(i);
if(ind == noone) continue;
var jun = ds_list_get(inputs, ind, noone); if(wh > line_get_height(f_p2)) {
if(jun == noone || is_undefined(jun)) continue; for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
if(!jun.isVisible()) continue; 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); 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.s = wh;
_param.font = f_p2; _param.font = f_p2;
@ -1073,10 +1111,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(is_instanceof(jun, checkBox)) if(is_instanceof(jun, checkBox))
_param.halign = fa_center; _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_set_text(f_sdf, fa_left, fa_center, jun.color_display);
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25); draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
var wd = jun.graphWidget; var wd = jun.graphWidget;
if(wd == noone) { if(wd == noone) {
jy += wh + 4 * _s; jy += wh + 4 * _s;
continue; continue;
@ -1086,27 +1128,25 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _h = wd.drawParam(_param); var _h = wd.drawParam(_param);
jun.graphWidgetH = _h / _s; jun.graphWidgetH = _h / _s;
jy += _h + 4 * _s;
if(wd.isHovering()) draggable = false; if(wd.isHovering()) draggable = false;
} }
jy += (jun.graphWidgetH + 4) * _s;
}
ay = jy + 2 * _s; ay = jy + 2 * _s;
h += max(0, (ay - y1) / _s); h += (ay - y1) / _s;
}
} #endregion } #endregion
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
if(!active) return; if(!active) return;
var hover = noone; var hover = noone;
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
gpu_set_texfilter(true); gpu_set_texfilter(true);
for(var i = 0; i < amo; i++) { for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
var ind = getInputJunctionIndex(i); var jun = inputDisplayList[i];
if(ind == noone) continue;
var jun = ds_list_get(inputs, ind, noone);
if(jun == noone || is_undefined(jun)) continue;
if(jun.drawJunction(_s, _mx, _my)) if(jun.drawJunction(_s, _mx, _my))
hover = jun; 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); 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) { if(show_input_name) {
for(var i = 0; i < amo; i++) { for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
var ind = getInputJunctionIndex(i); var jun = inputDisplayList[i];
if(ind == noone) continue; jun.drawNameBG(_s);
if(!inputs[| ind]) continue;
inputs[| ind].drawNameBG(_s);
} }
for(var i = 0; i < amo; i++) { for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
var ind = getInputJunctionIndex(i); var jun = inputDisplayList[i];
if(ind == noone) continue; jun.drawName(_s, _mx, _my);
if(!inputs[| ind]) continue;
inputs[| ind].drawName(_s, _mx, _my);
} }
} }

View file

@ -557,6 +557,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidgetRaw = noone; editWidgetRaw = noone;
graphWidget = noone; graphWidget = noone;
graphWidgetH = 0; graphWidgetH = 0;
graphWidgetP = new widgetParam(0, 0, 0, 0, 0);
mapWidget = noone; mapWidget = noone;
active_tooltip = ""; active_tooltip = "";
@ -671,6 +672,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#region ---- inspector ---- #region ---- inspector ----
visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path || _type == VALUE_TYPE.PCXnode; visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path || _type == VALUE_TYPE.PCXnode;
show_in_inspector = true; show_in_inspector = true;
visible_in_list = true;
display_type = VALUE_DISPLAY._default; display_type = VALUE_DISPLAY._default;
if(_type == VALUE_TYPE.curve) display_type = VALUE_DISPLAY.curve; if(_type == VALUE_TYPE.curve) display_type = VALUE_DISPLAY.curve;
@ -2260,8 +2262,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion } #endregion
static drawJunction = function(_s, _mx, _my, sca = 1) { #region static drawJunction = function(_s, _mx, _my, sca = 1) { #region
if(!isVisible()) return false;
var ss = max(0.25, _s / 2); var ss = max(0.25, _s / 2);
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node); 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); 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 } #endregion
static drawNameBG = function(_s) { #region static drawNameBG = function(_s) { #region
if(!isVisible()) return false;
draw_set_text(f_p1, fa_left, fa_center); draw_set_text(f_p1, fa_left, fa_center);
var tw = string_width(name) + 32; var tw = string_width(name) + 32;
@ -2313,8 +2311,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion } #endregion
static drawName = function(_s, _mx, _my) { #region 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 _hover = PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, x, y, 10 * _s);
var _draw_cc = _hover? COLORS._main_text : COLORS._main_text_sub; var _draw_cc = _hover? COLORS._main_text : COLORS._main_text_sub;
draw_set_text(f_p1, fa_left, fa_center, _draw_cc); 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(index == -1) return true;
if(is_array(node.input_display_list)) return visible_in_list;
return array_exists(node.input_display_list, index);
return true;
} #endregion } #endregion
static extractNode = function(_type = extract_node) { #region static extractNode = function(_type = extract_node) { #region

View file

@ -1,7 +1,7 @@
function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { #region function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { #region
name = "Vector Split"; name = "Vector Split";
color = COLORS.node_blend_number; color = COLORS.node_blend_number;
setDimension(96, 32); setDimension(96);
draw_padding = 4; draw_padding = 4;

View file

@ -82,12 +82,14 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover); for(var i = 0; i < 4; i++) tb[i].setFocusHover(active, hover);
var _bs = min(_h, ui(32));
if((_w - _bs) / 2 > ui(64)) {
b_link.setFocusHover(active, hover); b_link.setFocusHover(active, hover);
b_link.icon_index = linked; b_link.icon_index = linked;
b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
var _bs = min(_h, ui(32));
var _bx = _x; var _bx = _x;
var _by = _y + _h / 2 - _bs / 2; var _by = _y + _h / 2 - _bs / 2;
b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide); b_link.draw(_bx, _by, _bs, _bs, _m, THEME.button_hide);
@ -99,6 +101,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
unit.triggerButton.setFocusHover(iactive, ihover); unit.triggerButton.setFocusHover(iactive, ihover);
unit.draw(_bx, _by + ui(4) + _h, _bs, _bs, _m); unit.draw(_bx, _by + ui(4) + _h, _bs, _bs, _m);
} }
}
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1); 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); draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);

View file

@ -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_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"); right_menu_y += string_height("l");
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub); draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub);

View file

@ -74,17 +74,20 @@ function quarternionBox(_onModify) : widget() constructor {
current_value = _data; current_value = _data;
var bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
var bx = _x + _w - bs;
var by = _y + _h / 2 - bs / 2;
var _disp = struct_try_get(_display_data, "angle_display"); var _disp = struct_try_get(_display_data, "angle_display");
if((_w - _bs) / 2 > ui(64)) {
var bx = _x + _w - _bs;
var by = _y + _h / 2 - _bs / 2;
tooltip.index = _disp; tooltip.index = _disp;
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) { if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
clickable = false; clickable = false;
_display_data.angle_display = (_disp + 1) % 2; _display_data.angle_display = (_disp + 1) % 2;
} }
_w -= ui(40); _w -= _bs + ui(8);
}
size = _disp? 3 : 4; size = _disp? 3 : 4;
var ww = _w / size; var ww = _w / size;

View file

@ -76,7 +76,8 @@ function rangeBox(_type, _onModify) : widget() constructor {
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon; var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
var _bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
if(_w - _bs > ui(100) && side_button) { if((_w - _bs) / 2 > ui(64)) {
if(side_button) {
side_button.setFocusHover(active, hover); side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= _bs + ui(4); _w -= _bs + ui(4);
@ -97,6 +98,7 @@ function rangeBox(_type, _onModify) : widget() constructor {
_x += _bs + ui(4); _x += _bs + ui(4);
_w -= _bs + ui(4); _w -= _bs + ui(4);
}
var ww = linked? _w : _w / 2; var ww = linked? _w : _w / 2;
disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5); disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5);

View file

@ -43,17 +43,18 @@ function rotator(_onModify, _step = -1) : widget() constructor {
if(!is_real(_data)) return; if(!is_real(_data)) return;
var _r = _h;
var _bs = min(_h, ui(32)); 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.setFocusHover(active, hover);
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= _bs + ui(4); _w -= _bs + ui(4);
} }
var _r = _h; var _tx = _drawRot? _x + _r + ui(4) : _x;
var _tx = _x + _r + ui(4); var _tw = _drawRot? _w - _r - ui(4) : _w;
var _tw = _w - _r - ui(4);
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1); 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); draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
@ -61,6 +62,7 @@ function rotator(_onModify, _step = -1) : widget() constructor {
tb_value.setFocusHover(active, hover); tb_value.setFocusHover(active, hover);
tb_value.draw(_tx, _y, _tw, _h, _data, _m); tb_value.draw(_tx, _y, _tw, _h, _data, _m);
if(_drawRot) {
var _kx = _x + _r / 2; var _kx = _x + _r / 2;
var _ky = _y + _r / 2; var _ky = _y + _r / 2;
var _kr = (_r - ui(12)) / 2; var _kr = (_r - ui(12)) / 2;
@ -111,10 +113,12 @@ function rotator(_onModify, _step = -1) : widget() constructor {
shader_set(sh_widget_rotator); shader_set(sh_widget_rotator);
shader_set_color("color", _kc); shader_set_color("color", _kc);
shader_set_f("side", _r);
shader_set_f("angle", degtorad(_data)); shader_set_f("angle", degtorad(_data));
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
shader_reset(); shader_reset();
}
resetFocus(); resetFocus();

View file

@ -61,9 +61,11 @@ function rotatorRandom(_onModify) : widget() constructor {
var _kHover = dragging_index; var _kHover = dragging_index;
var _r = _h; var _r = _h;
var _drawRot = _w - _r > ui(64);
var _bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
var _tx = _x + _r + ui(4); var _tx = _drawRot? _x + _r + ui(4) : _x;
var _tw = _w - _r - ui(8) - _bs; var _tw = _drawRot? _w - _r - ui(4) : _w;
var _ty = _y;
switch(mode) { switch(mode) {
case 2 : case 2 :
@ -80,6 +82,8 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, c_white, 0.5 + 0.5 * interactable); draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, c_white, 0.5 + 0.5 * interactable);
} }
if(_drawRot) {
if((_w - _r) / 2 > ui(48)) {
tooltip.index = mode; 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 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; mode = (mode + 1) % 4;
@ -104,16 +108,16 @@ function rotatorRandom(_onModify) : widget() constructor {
} #endregion } #endregion
_w -= _bs + ui(4); _tw -= _bs + ui(4);
}
var _kx = _x + _r / 2; var _kx = _x + _r / 2;
var _ky = _y + _r / 2; var _ky = _y + _r / 2;
var _kr = (_r - ui(12)) / 2; var _kr = (_r - ui(12)) / 2;
var _kc = COLORS._main_icon; var _kc = COLORS._main_icon;
}
var _tw = (_w - _r - ui(4)) / 2; _tw /= 2;
var _tx = _x + _r + ui(4);
var _ty = _y;
switch(mode) { switch(mode) {
case 0 : #region case 0 : #region
@ -123,6 +127,7 @@ function rotatorRandom(_onModify) : widget() constructor {
tb_min_0.draw(_tx, _ty, _tw, _h, array_safe_get(_data, 1), _m); 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); tb_max_0.draw(_tx + _tw, _ty, _tw, _h, array_safe_get(_data, 2), _m);
if(_drawRot) {
if(dragging_index > -1) { if(dragging_index > -1) {
_kc = COLORS._main_icon_light; _kc = COLORS._main_icon_light;
@ -175,11 +180,13 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_circle_angle(_kx, _ky, _kr, _data[1], _data[2], 32); draw_circle_angle(_kx, _ky, _kr, _data[1], _data[2], 32);
shader_set(sh_widget_rotator_range); shader_set(sh_widget_rotator_range);
shader_set_f("side", _r);
shader_set_color("color", _kc); shader_set_color("color", _kc);
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2])); shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
shader_reset(); shader_reset();
}
break; break;
#endregion #endregion
@ -191,6 +198,7 @@ function rotatorRandom(_onModify) : widget() constructor {
tb_min_0.draw(_tx, _ty, _tw, _h, array_safe_get(_data, 1), _m); 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); tb_max_0.draw(_tx + _tw, _ty, _tw, _h, array_safe_get(_data, 2), _m);
if(_drawRot) {
var _a0 = _data[1] - _data[2]; var _a0 = _data[1] - _data[2];
var _a1 = _data[1] + _data[2]; var _a1 = _data[1] + _data[2];
@ -240,11 +248,13 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_circle_angle(_kx, _ky, _kr, _a0, _a1, 32); draw_circle_angle(_kx, _ky, _kr, _a0, _a1, 32);
shader_set(sh_widget_rotator); shader_set(sh_widget_rotator);
shader_set_f("side", _r);
shader_set_color("color", _kc); shader_set_color("color", _kc);
shader_set_f("angle", degtorad(_data[1])); shader_set_f("angle", degtorad(_data[1]));
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
shader_reset(); shader_reset();
}
break; break;
#endregion #endregion
@ -266,6 +276,7 @@ function rotatorRandom(_onModify) : widget() constructor {
tb_min_1.draw(_tx, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 3), _m); 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); tb_max_1.draw(_tx + _tw, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 4), _m);
if(_drawRot) {
if(dragging_index > -1) { if(dragging_index > -1) {
if(dragging_index == 1) _kc0 = COLORS._main_icon_light; if(dragging_index == 1) _kc0 = COLORS._main_icon_light;
else _kc1 = COLORS._main_icon_light; else _kc1 = COLORS._main_icon_light;
@ -331,6 +342,7 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_circle_angle(_kx, _ky1, _kr, _data[3], _data[4], 32); draw_circle_angle(_kx, _ky1, _kr, _data[3], _data[4], 32);
shader_set(sh_widget_rotator_range); shader_set(sh_widget_rotator_range);
shader_set_f("side", _r);
shader_set_color("color", _kc0); shader_set_color("color", _kc0);
shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2])); shader_set_f("angle", degtorad(_data[1]), degtorad(_data[2]));
@ -341,6 +353,7 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
shader_reset(); shader_reset();
}
break; break;
#endregion #endregion
@ -360,6 +373,7 @@ function rotatorRandom(_onModify) : widget() constructor {
tb_max_0.draw(_tx, _ty + _h + ui(4), _tw, _h, array_safe_get(_data, 2), _m); 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); tb_min_1.draw(_tx + _tw, _ty, _tw, h, array_safe_get(_data, 3), _m);
if(_drawRot) {
var _a0 = _data[1] - _data[3]; var _a0 = _data[1] - _data[3];
var _a1 = _data[1] + _data[3]; var _a1 = _data[1] + _data[3];
var _a2 = _data[2] - _data[3]; var _a2 = _data[2] - _data[3];
@ -420,6 +434,7 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_circle_angle(_kx, _ky1, _kr, _a2, _a3, 32); draw_circle_angle(_kx, _ky1, _kr, _a2, _a3, 32);
shader_set(sh_widget_rotator); shader_set(sh_widget_rotator);
shader_set_f("side", _r);
shader_set_color("color", _kc0); shader_set_color("color", _kc0);
shader_set_f("angle", degtorad(_data[1])); shader_set_f("angle", degtorad(_data[1]));
@ -430,6 +445,7 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y + _h + ui(4), _r, _r);
shader_reset(); shader_reset();
}
break; break;
#endregion #endregion

View file

@ -42,20 +42,22 @@ function rotatorRange(_onModify) : widget() constructor {
if(!is_real(_data[1])) return; if(!is_real(_data[1])) return;
var _r = _h; var _r = _h;
var _tx = _x + _r + ui(4); var _drawRot = _w - _r > ui(64);
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, 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); 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.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.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);
if(_drawRot) {
var _kx = _x + _r / 2; var _kx = _x + _r / 2;
var _ky = _y + _r / 2; var _ky = _y + _r / 2;
var _kr = (_r - ui(12)) / 2; var _kr = (_r - ui(12)) / 2;
@ -112,11 +114,13 @@ function rotatorRange(_onModify) : widget() constructor {
draw_circle_angle(_kx, _ky, _kr, _data[0], _data[1], 32); draw_circle_angle(_kx, _ky, _kr, _data[0], _data[1], 32);
shader_set(sh_widget_rotator_range); shader_set(sh_widget_rotator_range);
shader_set_f("side", _r);
shader_set_color("color", _kc); shader_set_color("color", _kc);
shader_set_f("angle", degtorad(_data[0]), degtorad(_data[1])); shader_set_f("angle", degtorad(_data[0]), degtorad(_data[1]));
draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r); draw_sprite_stretched(s_fx_pixel, 0, _x, _y, _r, _r);
shader_reset(); shader_reset();
}
resetFocus(); resetFocus();

View file

@ -100,7 +100,8 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
if(mouse_press(mb_left)) deactivate(); 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 _spr = is_instanceof(_selVal, scrollItem) && _selVal.spr;
var _x0 = _x; 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); 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) 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); draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);

View file

@ -119,7 +119,7 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
draw_rectangle(sx0, sy0, sx1 - 1, sy1 - 1, true); draw_rectangle(sx0, sy0, sx1 - 1, sy1 - 1, true);
if(_type == VALUE_TYPE.surface) 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) if(WIDGET_CURRENT == self)

View file

@ -455,6 +455,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} }
} }
if(_w > ui(48)) {
if(sliding == 2) { if(sliding == 2) {
var _ax0 = _x + ui(10); var _ax0 = _x + ui(10);
var _ax1 = _x + _w - ui(10); var _ax1 = _x + _w - ui(10);
@ -470,6 +471,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
draw_text_add(_x + ui(8), _y + _h / 2, label); draw_text_add(_x + ui(8), _y + _h / 2, label);
draw_set_alpha(1); draw_set_alpha(1);
} }
}
disp_x = lerp_float(disp_x, disp_x_to, 5); disp_x = lerp_float(disp_x, disp_x_to, 5);

View file

@ -43,7 +43,7 @@ function transformBox(_onModify) : widget() constructor {
static isHovering = function() { static isHovering = function() {
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; 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) { static drawParam = function(params) {
@ -64,19 +64,23 @@ function transformBox(_onModify) : widget() constructor {
if(array_empty(_data)) return 0; if(array_empty(_data)) return 0;
if(is_array(_data[0])) 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); rot.setFocusHover(active, hover);
for(var i = 0; i < array_length(_data); i++) { for(var i = 0; i < array_length(_data); i++) {
tb[i].setFocusHover(active, hover); tb[i].setFocusHover(active, hover);
tb[i].hide = true; tb[i].hide = true;
} }
var _lab = _w > ui(160);
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey); 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 tbw = (_w - lbw) / 2;
var tbh = _h; 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, 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); 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); _y += tbh + ui(4);
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey); 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, 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); draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable);

View file

@ -111,9 +111,11 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
current_value = _data; current_value = _data;
var sz = min(size, array_length(_data));
var _bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
if(_w - _bs > ui(100) && side_button) { if((_w - _bs) / sz > ui(48)) {
if(side_button) {
side_button.setFocusHover(active, hover); side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= _bs + ui(4); _w -= _bs + ui(4);
@ -143,8 +145,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
_x += _bs + ui(4); _x += _bs + ui(4);
_w -= _bs + ui(4); _w -= _bs + ui(4);
} }
}
var sz = min(size, array_length(_data));
var ww = per_line? _w : _w / sz; var ww = per_line? _w : _w / sz;
if(!per_line) { if(!per_line) {

View file

@ -80,6 +80,7 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon; var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
var _bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
if((_w - _bs) / 2 > ui(64)) {
var bx = _x; var bx = _x;
var by = _y + _h / 2 - _bs / 2; var by = _y + _h / 2 - _bs / 2;
@ -97,6 +98,7 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
_x += _bs + ui(4); _x += _bs + ui(4);
_w -= _bs + ui(4); _w -= _bs + ui(4);
}
var ww = _w / 2; var ww = _w / 2;

View file

@ -3,6 +3,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform float side;
uniform vec4 color; uniform vec4 color;
uniform float angle; uniform float angle;
@ -23,8 +24,8 @@ void main() {
bool inside = dist < 0.; bool inside = dist < 0.;
dist = abs(dist); dist = abs(dist);
alp = max(alp, smoothstep(0.1, 0., dist)); alp = max(alp, smoothstep(2. / side, 0.8 / side, dist));
alp = max(alp, smoothstep(0.1, 0., line_segment(angle))); alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle)));
gl_FragColor = vec4(color.rgb, alp); gl_FragColor = vec4(color.rgb, alp);
} }

View file

@ -3,6 +3,7 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform float side;
uniform vec4 color; uniform vec4 color;
uniform vec2 angle; uniform vec2 angle;
@ -23,9 +24,9 @@ void main() {
bool inside = dist < 0.; bool inside = dist < 0.;
dist = abs(dist); dist = abs(dist);
alp = max(alp, smoothstep(0.1, 0., dist)); alp = max(alp, smoothstep(2. / side, 0.8 / side, dist));
alp = max(alp, smoothstep(0.1, 0., line_segment(angle[0]))); alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle[0])));
alp = max(alp, smoothstep(0.1, 0., line_segment(angle[1]))); alp = max(alp, smoothstep(2. / side, 0.8 / side, line_segment(angle[1])));
gl_FragColor = vec4(color.rgb, alp); gl_FragColor = vec4(color.rgb, alp);
} }