- [Inspector Panel] Fix collapse/expand all not working when selecting multiple nodes.

This commit is contained in:
Tanasart 2024-03-24 14:01:24 +07:00
parent 6fe3d23dfe
commit 6891a8743a
19 changed files with 148 additions and 109 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

@ -69,13 +69,14 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
current_color = _color; current_color = _color;
var _cw = _w; var _cw = _w;
var _bs = min(_h, ui(32));
if(interactable) { if(interactable) {
var bx = _x + _cw - ui(32); var bx = _x + _cw - ui(32);
_cw -= ui(32); _cw -= ui(32);
b_picker.setFocusHover(active && !instance_exists(o_dialog_color_quick_pick), hover); b_picker.setFocusHover(active && !instance_exists(o_dialog_color_quick_pick), hover);
b_picker.draw(bx, _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide); b_picker.draw(bx, _y + _h / 2 - _bs / 2, ui(32), _bs, _m, THEME.button_hide);
b_picker.icon_blend = c_white; b_picker.icon_blend = c_white;
b_picker.icon_index = 0; b_picker.icon_index = 0;
if(instance_exists(o_dialog_color_selector) && o_dialog_color_selector.selector.dropper_active && o_dialog_color_selector.drop_target != noone) { if(instance_exists(o_dialog_color_selector) && o_dialog_color_selector.selector.dropper_active && o_dialog_color_selector.drop_target != noone) {
@ -91,7 +92,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
_cw -= ui(32 + 4); _cw -= ui(32 + 4);
b_quick_pick.setFocusHover(active, hover); b_quick_pick.setFocusHover(active, hover);
b_quick_pick.draw(bx, _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide); b_quick_pick.draw(bx, _y + _h / 2 - _bs / 2, ui(32), _bs, _m, THEME.button_hide);
} }
_cw -= ui(8); _cw -= ui(8);

View file

@ -18,19 +18,16 @@ function controlPointBox(_onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
onSurfaceSize = -1; onSurfaceSize = -1;
tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); }); tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); }); tbCx.hide = true; tbCx.slidable = true;
tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); }); tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); }); tbCy.hide = true; tbCy.slidable = true;
tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); }); tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); }); tbFx.hide = true; tbFx.slidable = true;
tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFy.hide = true; tbFy.slidable = true;
tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); tbW.hide = true; tbW.slidable = true;
tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); tbH.hide = true; tbH.slidable = true;
rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); });
tbFx.slidable = true;
tbFy.slidable = true;
tbW.slidable = true;
tbH.slidable = true;
sW = new slider(0, 32, 0.1, function(val) { onModify(PUPPET_CONTROL.width, toNumber(val)); }); sW = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(PUPPET_CONTROL.width, toNumber(val)); })
.setSlidable(0.01, false, [ 1, 32 ]);
sMode = [ sMode = [
__txtx("widget_control_point_move", "Move"), __txtx("widget_control_point_move", "Move"),
@ -42,7 +39,7 @@ function controlPointBox(_onModify) : widget() constructor {
function(val) { onModify(PUPPET_CONTROL.mode, toNumber(val)); } function(val) { onModify(PUPPET_CONTROL.mode, toNumber(val)); }
); );
widgets = [ scMode, tbCx, tbCy, tbFx, tbFy, tbW, tbH, rot ]; widgets = [ scMode, tbCx, tbCy, tbFx, tbFy, tbW, tbH, rot, sW ];
static setInteract = function(interactable = noone) { static setInteract = function(interactable = noone) {
self.interactable = interactable; self.interactable = interactable;
@ -82,43 +79,65 @@ function controlPointBox(_onModify) : widget() constructor {
scMode.draw(_x, yy, _w, TEXTBOX_HEIGHT, sMode[_mode], _m, _rx, _ry); scMode.draw(_x, yy, _w, TEXTBOX_HEIGHT, sMode[_mode], _m, _rx, _ry);
yy += TEXTBOX_HEIGHT + ui(8); yy += TEXTBOX_HEIGHT + ui(8);
var lw = ui(80); var _ww = _w / 2;
var w = _w / 2 - lw; var _wh = TEXTBOX_HEIGHT;
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
draw_text(_x, yy + ui(17), "cx"); draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
draw_text(_x + _w / 2 + ui(10), yy + ui(17), "cy");
tbCx.draw(_x + lw, yy, w, TEXTBOX_HEIGHT, _cx, _m); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
tbCy.draw(_x + _w / 2 + lw, yy, w, TEXTBOX_HEIGHT, _cy, _m); draw_set_alpha(0.5);
yy += TEXTBOX_HEIGHT + ui(8); draw_text(_x + ui(8), yy + _wh / 2, "cx");
draw_text(_x + _ww + ui(8), yy + _wh / 2, "cy");
draw_set_alpha(1);
tbCx.draw(_x, yy, _ww, _wh, _cx, _m);
tbCy.draw(_x + _ww, yy, _ww, _wh, _cy, _m);
yy += _wh + ui(8);
switch(_mode) { switch(_mode) {
case PUPPET_FORCE_MODE.move: case PUPPET_FORCE_MODE.move:
case PUPPET_FORCE_MODE.puppet: case PUPPET_FORCE_MODE.puppet:
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text(_x, yy + ui(17), "fx"); draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
draw_text(_x + _w / 2 + ui(10), yy + ui(17), "fy"); draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
tbFx.draw(_x + lw, yy, w, TEXTBOX_HEIGHT, _fx, _m);
tbFy.draw(_x + _w / 2 + lw, yy, w, TEXTBOX_HEIGHT, _fy, _m); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
yy += TEXTBOX_HEIGHT + ui(8); draw_set_alpha(0.5);
draw_text(_x + ui(8), yy + _wh / 2, "fx");
draw_text(_x + _ww + ui(8), yy + _wh / 2, "fy");
draw_set_alpha(1);
tbFx.draw(_x, yy, _ww, _wh, _fx, _m);
tbFy.draw(_x + _ww, yy, _ww, _wh, _fy, _m);
yy += _wh + ui(8);
if(_mode == PUPPET_FORCE_MODE.move) { if(_mode == PUPPET_FORCE_MODE.move) {
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); sW.draw(_x, yy, _w, _wh, _wid, _m);
draw_text(_x, yy + ui(17), __txt("radius"));
sW.draw(_x + lw, yy, _w - lw, TEXTBOX_HEIGHT, _wid, _m);
yy += TEXTBOX_HEIGHT + ui(8);
}
break;
case PUPPET_FORCE_MODE.wind:
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text(_x, yy + ui(17), __txt("strength"));
tbFx.draw(_x + lw, yy, _w - lw, TEXTBOX_HEIGHT, _fx, _m);
yy += TEXTBOX_HEIGHT + ui(8);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text(_x, yy + ui(17), __txt("width")); draw_set_alpha(0.5);
tbW.draw(_x + lw, yy, _w - lw, TEXTBOX_HEIGHT, _wid, _m); draw_text(_x + ui(8), yy + _wh / 2, __txt("radius"));
yy += TEXTBOX_HEIGHT + ui(8); draw_set_alpha(1);
yy += _wh + ui(8);
}
break;
case PUPPET_FORCE_MODE.wind:
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
draw_set_alpha(0.5);
draw_text(_x + ui(8), yy + _wh / 2, __txt("strength"));
draw_text(_x + _ww + ui(8), yy + _wh / 2, __txt("width"));
draw_set_alpha(1);
tbFx.draw(_x, yy, _ww, _wh, _fx, _m);
tbW.draw( _x + _ww, yy, _ww, _wh, _wid, _m);
yy += _wh + ui(8);
var _rh = rot.draw(_x, yy, _w, _fy, _m); var _rh = rot.draw(_x, yy, _w, _fy, _m);
yy += _rh + ui(8); yy += _rh + ui(8);

View file

@ -34,12 +34,13 @@ function fontScrollBox(_onModify) : widget() constructor {
open_rx = _rx; open_rx = _rx;
open_ry = _ry; open_ry = _ry;
h = _h; h = _h;
w = _w; w = _w;
var _bs = min(_h, ui(32));
if(extra_button != noone) { if(extra_button != noone) {
extra_button.setFocusHover(active, hover); extra_button.setFocusHover(active, hover);
extra_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); extra_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
w -= ui(40); w -= _bs + ui(4);
} }
if(open) { if(open) {

View file

@ -86,7 +86,7 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
w = _w; w = _w;
var hh = TEXTBOX_HEIGHT; var hh = TEXTBOX_HEIGHT;
h = hh * size - ui(8); h = hh * size;
if(extras && instanceof(extras) == "buttonClass") { if(extras && instanceof(extras) == "buttonClass") {
extras.setFocusHover(active, hover); extras.setFocusHover(active, hover);

View file

@ -35,6 +35,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
case "rotator" : case "rotator" :
case "rotatorRandom" : case "rotatorRandom" :
case "rotatorRange" : case "rotatorRange" :
case "transformBox" :
breakLine = true; breakLine = true;
} #endregion } #endregion

View file

@ -29,7 +29,7 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 8] = nodeValue("Additive", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); inputs[| 8] = nodeValue("Additive", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 9] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) inputs[| 9] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.range); .setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 10] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); inputs[| 10] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);

View file

@ -20,7 +20,7 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
inputs[| 6] = nodeValue("Color 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); inputs[| 6] = nodeValue("Color 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white );
inputs[| 7] = nodeValue("Center 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF ) inputs[| 7] = nodeValue("Center 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF )
.setDisplay(VALUE_DISPLAY.vector) .setDisplay(VALUE_DISPLAY.vector, { useGlobal : false })
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) { return getDimension(index); });
inputs[| 8] = nodeValue("Color 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); inputs[| 8] = nodeValue("Color 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white );

View file

@ -922,9 +922,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
if(len == 2) { if(len == 2) {
var _dim = struct_try_get(display_data, "useGlobal", true);
extract_node = [ "Node_Vector2", "Node_Path" ]; extract_node = [ "Node_Vector2", "Node_Path" ];
if(def_val == DEF_SURF) { if(_dim && def_val == DEF_SURF) {
value_tag = "dimension"; value_tag = "dimension";
node.attributes.use_project_dimension = true; node.attributes.use_project_dimension = true;
editWidget.side_button = button(function() { editWidget.side_button = button(function() {

View file

@ -126,26 +126,36 @@ function Panel_Inspector() : PanelContent() constructor {
#endregion #endregion
#region ++++ menus ++++ #region ++++ menus ++++
group_menu = [ static nodeExpandAll = function(node) {
menuItem(__txt("Expand all"), function() { if(node.input_display_list == -1) return;
if(inspecting == noone) return;
if(inspecting.input_display_list == -1) return;
var dlist = inspecting.input_display_list; var dlist = node.input_display_list;
for( var i = 0, n = array_length(dlist); i < n; i++ ) { for( var i = 0, n = array_length(dlist); i < n; i++ ) {
if(!is_array(dlist[i])) continue; if(!is_array(dlist[i])) continue;
dlist[i][@ 1] = false; dlist[i][@ 1] = false;
} }
}), }
menuItem(__txt("Collapse all"), function() {
if(inspecting == noone) return;
if(inspecting.input_display_list == -1) return;
var dlist = inspecting.input_display_list; static nodeCollapseAll = function(node) {
if(node.input_display_list == -1) return;
var dlist = node.input_display_list;
for( var i = 0, n = array_length(dlist); i < n; i++ ) { for( var i = 0, n = array_length(dlist); i < n; i++ ) {
if(!is_array(dlist[i])) continue; if(!is_array(dlist[i])) continue;
dlist[i][@ 1] = true; dlist[i][@ 1] = true;
} }
}
group_menu = [
menuItem(__txt("Expand all"), function() {
if(inspecting != noone) nodeExpandAll(inspecting);
for( var i = 0, n = array_length(inspectings); i < n; i++ )
nodeExpandAll(inspectings[i]);
}),
menuItem(__txt("Collapse all"), function() {
if(inspecting != noone) nodeCollapseAll(inspecting);
for( var i = 0, n = array_length(inspectings); i < n; i++ )
nodeCollapseAll(inspectings[i]);
}), }),
] ]

View file

@ -27,9 +27,10 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
w = _w; w = _w;
h = _h; h = _h;
var _bs = min(_h, ui(32));
openPath.setFocusHover(active, hover); openPath.setFocusHover(active, hover);
openPath.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); openPath.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= ui(40); _w -= _bs + ui(4);
var click = false; var click = false;
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h); draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);

View file

@ -65,7 +65,7 @@ function quarternionBox(_onModify) : widget() constructor {
current_value = _data; current_value = _data;
var bs = ui(32); var bs = min(_h, ui(32));
var bx = _x + _w - bs; var bx = _x + _w - bs;
var by = _y + _h / 2 - bs / 2; 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");
@ -97,7 +97,7 @@ function quarternionBox(_onModify) : widget() constructor {
tb[i].hide = true; tb[i].hide = true;
tb[i].setFocusHover(clickable && active, hover); tb[i].setFocusHover(clickable && active, hover);
tb[i].draw(bx + ui(24), _y, disp_w - ui(24), _h, _a, _m); tb[i].draw(bx, _y, disp_w, _h, _a, _m);
bx += disp_w; bx += disp_w;
} }

View file

@ -2,6 +2,8 @@ function rangeBox(_type, _onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
linked = false; linked = false;
disp_w = 0;
tooltip = new tooltipSelector("Value Type", [ tooltip = new tooltipSelector("Value Type", [
__txtx("widget_range_random", "Random Range"), __txtx("widget_range_random", "Random Range"),
__txtx("widget_range_constant", "Constant"), __txtx("widget_range_constant", "Constant"),
@ -28,6 +30,7 @@ function rangeBox(_type, _onModify) : widget() constructor {
for(var i = 0; i < 2; i++) { for(var i = 0; i < 2; i++) {
tb[i] = new textBox(_type, onModifySingle[i]); tb[i] = new textBox(_type, onModifySingle[i]);
tb[i].slidable = true; tb[i].slidable = true;
tb[i].hide = true;
} }
static setSlideSpeed = function(speed) { static setSlideSpeed = function(speed) {
@ -62,9 +65,11 @@ function rangeBox(_type, _onModify) : widget() constructor {
tooltip.index = linked; tooltip.index = linked;
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 bx = _x; var bx = _x;
var by = _y + _h / 2 - ui(24 / 2); var by = _y + _h / 2 - _bs / 2;
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
linked = !linked; linked = !linked;
_display_data.linked = linked; _display_data.linked = linked;
@ -74,26 +79,25 @@ function rangeBox(_type, _onModify) : widget() constructor {
} }
} }
_x += ui(28); _x += _bs + ui(4);
_w -= ui(28); _w -= _bs + ui(4);
tb[0].hide = !linked; var ww = linked? _w : _w / 2;
tb[1].hide = !linked; disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5);
if(linked) {
tb[0].setFocusHover(active, hover);
tb[0].draw(_x + ui(8), _y, _w - ui(8), _h, _data[0], _m);
} else if(is_array(_data) && array_length(_data) >= 2) {
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);
var ww = _w / 2; if(linked) {
tb[0].setFocusHover(active, hover);
tb[0].draw(_x, _y, disp_w, _h, _data[0], _m);
} else if(is_array(_data) && array_length(_data) >= 2) {
for(var i = 0; i < 2; i++) { for(var i = 0; i < 2; i++) {
tb[i].setFocusHover(active, hover); tb[i].setFocusHover(active, hover);
var bx = _x + ww * i; var bx = _x + disp_w * i;
tb[i].draw(bx, _y, ww, _h, _data[i], _m); tb[i].draw(bx, _y, disp_w, _h, _data[i], _m);
} }
} }

View file

@ -380,7 +380,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
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(8); _w -= bs + ui(4);
} }
draw_set_font(font == noone? f_p0 : font); draw_set_font(font == noone? f_p0 : font);
@ -434,10 +434,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
#region multiplier #region multiplier
if(_w > ui(80) && input == TEXTBOX_INPUT.number) { if(_w > ui(80) && input == TEXTBOX_INPUT.number) {
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_set_alpha(0.5); draw_set_alpha(0.5);
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + ui(32), _y + _h)) { if(hover && point_in_rectangle(_m[0], _m[1], _x + _w - ui(32), _y, _x + _w, _y + _h)) {
draw_set_alpha(1); draw_set_alpha(1);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
@ -447,10 +446,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} }
} }
if(key_mod_press(ALT)) draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text_sub);
draw_text_add(_x + ui(8), _y + _h / 2, "/2"); if(key_mod_press(ALT)) draw_text_add(_x + _w - ui(16), _y + _h / 2, "/2");
else else draw_text_add(_x + _w - ui(16), _y + _h / 2, "x2");
draw_text_add(_x + ui(8), _y + _h / 2, "x2");
draw_set_alpha(1); draw_set_alpha(1);
} }
#endregion #endregion
@ -544,10 +542,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} }
if(hover && hoverRect) { if(hover && hoverRect) {
if(hide) draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor, 0.5 + (0.5 * interactable));
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor, 0.5);
else
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
if(mouse_press(mb_left, active)) if(mouse_press(mb_left, active))
activate(); activate();

View file

@ -109,26 +109,26 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
current_value = _data; current_value = _data;
var _bs = min(_h, ui(32));
if(side_button) { if(side_button) {
side_button.setFocusHover(active, hover); side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= ui(40); _w -= _bs + ui(4);
} }
if(unit != noone && unit.reference != noone) { if(unit != noone && unit.reference != noone) {
_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(4);
} }
if(linkable) { if(linkable) {
var _icon_blend = linked? COLORS._main_accent : (link_inactive_color == noone? COLORS._main_icon : link_inactive_color); var _icon_blend = linked? COLORS._main_accent : (link_inactive_color == noone? COLORS._main_icon : link_inactive_color);
var bx = _x; var bx = _x;
var by = _y + _h / 2 - ui(24 / 2); var by = _y + _h / 2 - _bs / 2;
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) { if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
linked = !linked; linked = !linked;
_display_data.linked = linked; _display_data.linked = linked;
@ -138,8 +138,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
} }
} }
_x += ui(28); _x += _bs + ui(4);
_w -= ui(28); _w -= _bs + ui(4);
} }
var sz = min(size, array_length(_data)); var sz = min(size, array_length(_data));

View file

@ -4,6 +4,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
unit = _unit; unit = _unit;
linked = false; linked = false;
disp_h = 0;
tooltip = new tooltipSelector("Value Type", [ tooltip = new tooltipSelector("Value Type", [
__txtx("widget_range_random", "Random Range"), __txtx("widget_range_random", "Random Range"),
__txtx("widget_range_constant", "Constant"), __txtx("widget_range_constant", "Constant"),
@ -63,14 +65,17 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
w = _w; w = _w;
if(struct_has(_display_data, "linked")) linked = _display_data.linked; if(struct_has(_display_data, "linked")) linked = _display_data.linked;
h = linked? _h : _h * 2 + ui(4); var _hh = linked? _h : _h * 2 + ui(4);
h = h == 0? _hh : lerp_float(h, _hh, 5);
tooltip.index = linked; tooltip.index = linked;
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 bx = _x; var bx = _x;
var by = _y + _h / 2 - ui(24 / 2); var by = _y + _h / 2 - _bs / 2;
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
linked = !linked; linked = !linked;
_display_data.linked = linked; _display_data.linked = linked;
@ -82,8 +87,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
} }
} }
_x += ui(28); _x += _bs + ui(4);
_w -= ui(28); _w -= _bs + ui(4);
var ww = _w / 2; var ww = _w / 2;