mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-26 12:58:49 +01:00
Add Shift+mouse wheel to scroll through options in several interface buttons.
This commit is contained in:
parent
0bad6fbc13
commit
8afa1f3899
15 changed files with 227 additions and 133 deletions
|
@ -752,7 +752,7 @@ event_inherited();
|
|||
hh += curr_height;
|
||||
yy += curr_height;
|
||||
|
||||
if(sHOVER && key_mod_press(CTRL)) {
|
||||
if(_hover && key_mod_press(CTRL)) {
|
||||
if(mouse_wheel_down()) display_grid_size_to = clamp(display_grid_size_to - ui(8), ui(32), ui(128));
|
||||
if(mouse_wheel_up()) display_grid_size_to = clamp(display_grid_size_to + ui(8), ui(32), ui(128));
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ event_inherited();
|
|||
else if(_cAll == -1) { for( var i = 0; i < len; i++ ) struct_set(collapsed, group_labels[i].key, 1); }
|
||||
}
|
||||
|
||||
if(sHOVER && key_mod_press(CTRL)) {
|
||||
if(_hover && key_mod_press(CTRL)) {
|
||||
if(mouse_wheel_down()) display_list_size_to = clamp(display_list_size_to - ui(4), ui(16), ui(64));
|
||||
if(mouse_wheel_up()) display_list_size_to = clamp(display_list_size_to + ui(4), ui(16), ui(64));
|
||||
display_list_size = lerp_float(display_list_size, display_list_size_to, 3);
|
||||
|
|
|
@ -61,18 +61,27 @@ if !ready exit;
|
|||
var bx = dialog_x + dialog_w - ui(44);
|
||||
var by = dialog_y + ui(16);
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, view_tooltip, THEME.view_mode, PREFERENCES.dialog_add_node_view, COLORS._main_icon);
|
||||
if(b == 2) PREFERENCES.dialog_add_node_view = (PREFERENCES.dialog_add_node_view + 1) % 2;
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 PREFERENCES.dialog_add_node_view mod_dec_mf1 PREFERENCES.dialog_add_node_view mod_dec_mf2 2 mod_dec_mf3 2 mod_dec_mf4;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 PREFERENCES.dialog_add_node_view mod_inc_mf1 PREFERENCES.dialog_add_node_view mod_inc_mf2 2 mod_inc_mf3;
|
||||
}
|
||||
if(b == 2) mod_inc_mf0 PREFERENCES.dialog_add_node_view mod_inc_mf1 PREFERENCES.dialog_add_node_view mod_inc_mf2 2 mod_inc_mf3;
|
||||
|
||||
bx -= ui(32);
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, group_tooltip, THEME.view_group, PREFERENCES.dialog_add_node_grouping, COLORS._main_icon);
|
||||
if(b == 2) PREFERENCES.dialog_add_node_grouping = (PREFERENCES.dialog_add_node_grouping + 1) % 3;
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 PREFERENCES.dialog_add_node_grouping mod_dec_mf1 PREFERENCES.dialog_add_node_grouping mod_dec_mf2 3 mod_dec_mf3 3 mod_dec_mf4;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 PREFERENCES.dialog_add_node_grouping mod_inc_mf1 PREFERENCES.dialog_add_node_grouping mod_inc_mf2 3 mod_inc_mf3;
|
||||
}
|
||||
if(b == 2) mod_inc_mf0 PREFERENCES.dialog_add_node_grouping mod_inc_mf1 PREFERENCES.dialog_add_node_grouping mod_inc_mf2 3 mod_inc_mf3;
|
||||
|
||||
if(node_called != noone || junction_hovering != noone) {
|
||||
var txt = node_show_connectable? __txtx("add_node_show_connect", "Showing connectable") : __txtx("add_node_show_all", "Showing all");
|
||||
var cc = node_show_connectable? COLORS._main_accent : COLORS._main_icon;
|
||||
bx -= ui(32);
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.filter_type, node_show_connectable, cc) == 2)
|
||||
node_show_connectable = !node_show_connectable;
|
||||
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.filter_type, node_show_connectable, cc);
|
||||
if(b == 2) node_show_connectable = !node_show_connectable;
|
||||
}
|
||||
|
||||
if(search_string != "") {
|
||||
|
|
|
@ -112,6 +112,71 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
|||
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
|
||||
}
|
||||
|
||||
static setMode = function(_data, _mode) {
|
||||
var x0 = 0, y0 = 0;
|
||||
var x1 = 0, y1 = 0;
|
||||
var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize();
|
||||
|
||||
switch(mode) {
|
||||
case AREA_MODE.area :
|
||||
var cx = array_safe_get_fast(_data, 0);
|
||||
var cy = array_safe_get_fast(_data, 1);
|
||||
var sw = array_safe_get_fast(_data, 2);
|
||||
var sh = array_safe_get_fast(_data, 3);
|
||||
|
||||
x0 = cx - sw;
|
||||
y0 = cy - sh;
|
||||
x1 = cx + sw;
|
||||
y1 = cy + sh;
|
||||
break;
|
||||
|
||||
case AREA_MODE.padding :
|
||||
var r = array_safe_get_fast(_data, 0);
|
||||
var t = array_safe_get_fast(_data, 1);
|
||||
var l = array_safe_get_fast(_data, 2);
|
||||
var b = array_safe_get_fast(_data, 3);
|
||||
|
||||
x0 = l;
|
||||
y0 = t;
|
||||
x1 = ss[0] - r;
|
||||
y1 = ss[1] - b;
|
||||
break;
|
||||
|
||||
case AREA_MODE.two_point :
|
||||
x0 = array_safe_get_fast(_data, 0);
|
||||
y0 = array_safe_get_fast(_data, 1);
|
||||
x1 = array_safe_get_fast(_data, 2);
|
||||
y1 = array_safe_get_fast(_data, 3);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(_mode) {
|
||||
case AREA_MODE.area :
|
||||
onModify((x0 + x1) / 2, 0);
|
||||
onModify((y0 + y1) / 2, 1);
|
||||
onModify((x1 - x0) / 2, 2);
|
||||
onModify((y1 - y0) / 2, 3);
|
||||
break;
|
||||
|
||||
case AREA_MODE.padding :
|
||||
onModify(x0, 0);
|
||||
onModify(y0, 1);
|
||||
onModify(ss[0] - x1, 2);
|
||||
onModify(ss[1] - y1, 3);
|
||||
break;
|
||||
|
||||
case AREA_MODE.two_point :
|
||||
onModify(x0, 0);
|
||||
onModify(y0, 1);
|
||||
onModify(x1, 2);
|
||||
onModify(y1, 3);
|
||||
break;
|
||||
}
|
||||
|
||||
onModify(_mode, 5);
|
||||
return _mode;
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
|
@ -142,52 +207,15 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
|||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var _bx = _x + _w - _bs;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
var _bx = _x + _w - _bs;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, hover, active, tooltip, THEME.inspector_area_type, mode) == 2) {
|
||||
switch(mode) {
|
||||
case AREA_MODE.area : //area to padding
|
||||
var cx = array_safe_get_fast(_data, 0);
|
||||
var cy = array_safe_get_fast(_data, 1);
|
||||
var sw = array_safe_get_fast(_data, 2);
|
||||
var sh = array_safe_get_fast(_data, 3);
|
||||
var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize();
|
||||
|
||||
onModify(ss[0] - (cx + sw), 0);
|
||||
onModify(cy - sh, 1);
|
||||
onModify(cx - sw, 2);
|
||||
onModify(ss[1] - (cy + sh), 3);
|
||||
break;
|
||||
|
||||
case AREA_MODE.padding : //padding to two points
|
||||
var r = array_safe_get_fast(_data, 0);
|
||||
var t = array_safe_get_fast(_data, 1);
|
||||
var l = array_safe_get_fast(_data, 2);
|
||||
var b = array_safe_get_fast(_data, 3);
|
||||
var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize();
|
||||
|
||||
onModify(l, 0);
|
||||
onModify(t, 1);
|
||||
onModify(ss[0] - r, 2);
|
||||
onModify(ss[1] - b, 3);
|
||||
break;
|
||||
|
||||
case AREA_MODE.two_point : //twp points to area
|
||||
var x0 = array_safe_get_fast(_data, 0);
|
||||
var y0 = array_safe_get_fast(_data, 1);
|
||||
var x1 = array_safe_get_fast(_data, 2);
|
||||
var y1 = array_safe_get_fast(_data, 3);
|
||||
|
||||
onModify( (x0 + x1) / 2, 0);
|
||||
onModify( (y0 + y1) / 2, 1);
|
||||
onModify(abs(x0 - x1) / 2, 2);
|
||||
onModify(abs(y0 - y1) / 2, 3);
|
||||
break;
|
||||
}
|
||||
|
||||
onModify((mode + 1) % 3, 5);
|
||||
}
|
||||
var b = buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, hover, active, tooltip, THEME.inspector_area_type, mode);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mode = setMode(_data, (mode - 1 + 3) % 3);
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mode = setMode(_data, (mode + 1) % 3);
|
||||
}
|
||||
if(b == 2) mode = setMode(_data, (mode + 1) % 3);
|
||||
|
||||
var _bx = _x + _w - _bs;
|
||||
var _by = _y + _h + ui(4) + _h / 2 - _bs / 2;
|
||||
|
|
|
@ -22,12 +22,30 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
|
||||
base_spr = THEME.button_def;
|
||||
|
||||
onWUp = undefined;
|
||||
onWDown = undefined;
|
||||
|
||||
static setContext = function(struct) { onClick = method(struct, onClick); return self; }
|
||||
static setWheel = function(wup, wdown = wup) { onWUp = wup; onWDown = wdown; return self; }
|
||||
|
||||
static setBaseSprite = function(_bspr) { base_spr = _bspr; return self; }
|
||||
static setText = function(_text) { text = _text; return self; }
|
||||
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
||||
|
||||
static setIcon = function(_icon, _index = 0, _blend = c_white, _size = 1) {
|
||||
icon = _icon;
|
||||
icon_index = _index;
|
||||
icon_blend = _blend;
|
||||
icon_size = _size;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static setLua = function(_lua_thread, _lua_key, _lua_func) {
|
||||
lua_thread = _lua_thread;
|
||||
lua_thread_key = _lua_key;
|
||||
onClick = method(self, _lua_func);
|
||||
return self;
|
||||
}
|
||||
|
||||
static trigger = function() {
|
||||
|
@ -46,23 +64,6 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
return t;
|
||||
}
|
||||
|
||||
static setIcon = function(_icon, _index = 0, _blend = c_white, _size = 1) {
|
||||
icon = _icon;
|
||||
icon_index = _index;
|
||||
icon_blend = _blend;
|
||||
icon_size = _size;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static setBaseSprite = function(_baseSpr) {
|
||||
base_spr = _baseSpr;
|
||||
return self;
|
||||
}
|
||||
|
||||
static setText = function(_text) { text = _text; return self; }
|
||||
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
||||
|
||||
static drawParam = function(params) {
|
||||
setParam(params);
|
||||
|
||||
|
@ -96,6 +97,10 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
draw_sprite_stretched_ext(spr, 3, _x, _y, _w, _h, COLORS._main_accent, 1);
|
||||
}
|
||||
if(tooltip != "") TOOLTIP = tooltip;
|
||||
|
||||
if(onWUp != undefined && key_mod_press(SHIFT) && mouse_wheel_up()) onWUp();
|
||||
if(onWDown != undefined && key_mod_press(SHIFT) && mouse_wheel_down()) onWDown();
|
||||
|
||||
} else {
|
||||
draw_sprite_stretched_ext(spr, toggled? 2 : 0, _x, _y, _w, _h, b, 1);
|
||||
if(mouse_press(mb_left)) deactivate();
|
||||
|
|
|
@ -128,7 +128,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
|
|||
if(draw_sel != noone)
|
||||
draw_sprite_stretched_ext(draw_sel[0], 3, draw_sel[1], _y, ww, _h, COLORS._main_accent, 1);
|
||||
|
||||
if(point_in_rectangle(_m[0], _m[1], _x, _y, _x + w, _y + _h)) {
|
||||
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + w, _y + _h)) {
|
||||
if(is_array(data) && key_mod_press(SHIFT)) {
|
||||
var len = array_length(data);
|
||||
if(len) {
|
||||
|
|
|
@ -242,9 +242,14 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
|||
tooltip_loop_type.index = jun.on_end;
|
||||
|
||||
var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _hover, _focus, tooltip_loop_type, THEME.prop_on_end, jun.on_end)
|
||||
if(b) cHov = true;
|
||||
|
||||
if(b) cHov = true;
|
||||
if(b == 2) jun.on_end = safe_mod(jun.on_end + 1, sprite_get_number(THEME.prop_on_end));
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 jun.on_end mod_dec_mf1 jun.on_end mod_dec_mf2 sprite_get_number(THEME.prop_on_end) mod_dec_mf3 sprite_get_number(THEME.prop_on_end) mod_dec_mf4;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 jun.on_end mod_inc_mf1 jun.on_end mod_inc_mf2 sprite_get_number(THEME.prop_on_end) mod_inc_mf3;
|
||||
}
|
||||
|
||||
if(b == 2) mod_inc_mf0 jun.on_end mod_inc_mf1 jun.on_end mod_inc_mf2 sprite_get_number(THEME.prop_on_end) mod_inc_mf3;
|
||||
}
|
||||
|
||||
if(jun.connect_type == CONNECT_TYPE.input && breakLine && !jun.is_anim && !global_var) { // Right buttons
|
||||
|
|
|
@ -497,23 +497,23 @@ function isGraphable(prop) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function nodeValueUnit(_nodeValue) constructor {
|
||||
function nodeValueUnit(__nodeValue) constructor {
|
||||
INLINE
|
||||
|
||||
self._nodeValue = _nodeValue;
|
||||
self._nodeValue = __nodeValue;
|
||||
|
||||
mode = VALUE_UNIT.constant;
|
||||
mode = VALUE_UNIT.constant;
|
||||
reference = noone;
|
||||
triggerButton = button(function() {
|
||||
modeTrigger = function() /*=>*/ {
|
||||
mode = !mode;
|
||||
_nodeValue.cache_value[0] = false;
|
||||
_nodeValue.unitConvert(mode);
|
||||
_nodeValue.node.doUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
triggerButton.icon_blend = COLORS._main_icon_light;
|
||||
triggerButton.icon = THEME.unit_ref;
|
||||
triggerButton.tooltip = new tooltipSelector("Unit", ["Pixel", "Fraction"]);
|
||||
triggerButton = button(modeTrigger).setWheel(modeTrigger)
|
||||
.setIcon(THEME.unit_ref, 0, COLORS._main_icon_light)
|
||||
.setTooltip(new tooltipSelector("Unit", ["Pixel", "Fraction"]));
|
||||
|
||||
static setMode = function(type) {
|
||||
if((type == "constant" || type == VALUE_UNIT.constant) && mode == VALUE_UNIT.constant) return;
|
||||
|
|
|
@ -1638,16 +1638,16 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
if(pHOVER && point_in_rectangle(msx, msy, tx - ui(10), ty - ui(9), tx + ui(10), ty + ui(8))) {
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon_on_inner, _on_end_disp);
|
||||
|
||||
if(tooltip_loop_prop != prop)
|
||||
tooltip_loop_type.arrow_pos = noone;
|
||||
if(tooltip_loop_prop != prop) tooltip_loop_type.arrow_pos = noone;
|
||||
tooltip_loop_prop = prop;
|
||||
tooltip_loop_type.index = prop.on_end;
|
||||
TOOLTIP = tooltip_loop_type;
|
||||
|
||||
if(mouse_release(mb_left, pFOCUS))
|
||||
prop.on_end = safe_mod(prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
on_end_dragging_anim = prop;
|
||||
if(mouse_release(mb_left, pFOCUS)) prop.on_end = safe_mod(prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
|
||||
if(mouse_press(mb_left, pFOCUS)) on_end_dragging_anim = prop;
|
||||
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 prop.on_end mod_dec_mf1 prop.on_end mod_dec_mf2 sprite_get_number(THEME.prop_on_end) mod_dec_mf3 sprite_get_number(THEME.prop_on_end) mod_dec_mf4;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 prop.on_end mod_inc_mf1 prop.on_end mod_inc_mf2 sprite_get_number(THEME.prop_on_end) mod_inc_mf3;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, on_end_dragging_anim == prop? COLORS._main_accent : COLORS._main_icon, _on_end_disp);
|
||||
|
||||
|
@ -2588,9 +2588,12 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
by += ui(32); if(by > max_y) return;
|
||||
node_name_tooltip.index = node_name_type;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, node_name_tooltip, THEME.node_name_type, node_name_type) == 2)
|
||||
node_name_type = (node_name_type + 1) % 3;
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, node_name_tooltip, THEME.node_name_type, node_name_type);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 node_name_type mod_dec_mf1 node_name_type mod_dec_mf2 3 mod_dec_mf3 3 mod_dec_mf4;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 node_name_type mod_inc_mf1 node_name_type mod_inc_mf2 3 mod_inc_mf3;
|
||||
}
|
||||
if(b == 2) mod_inc_mf0 node_name_type mod_inc_mf1 node_name_type mod_inc_mf2 3 mod_inc_mf3;
|
||||
|
||||
by += ui(32); if(by > max_y) return;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, tooltip_toggle_nodes, THEME.junc_visible, show_nodes) == 2)
|
||||
|
|
|
@ -673,10 +673,12 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
var tb_w = w - pad - tb_x - bs - ui(4);
|
||||
var tb_h = top_bar - pad - ui(8);
|
||||
|
||||
if(buttonInstant(THEME.button_hide, w - pad - bs, pad, bs, bs, [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.view_mode, !view_mode) == 2) {
|
||||
view_mode = !view_mode;
|
||||
PREFERENCES.file_explorer_view = view_mode;
|
||||
var b = buttonInstant(THEME.button_hide, w - pad - bs, pad, bs, bs, [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.view_mode, !view_mode);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) { view_mode = !view_mode; PREFERENCES.file_explorer_view = view_mode; }
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) { view_mode = !view_mode; PREFERENCES.file_explorer_view = view_mode; }
|
||||
}
|
||||
if(b == 2) { view_mode = !view_mode; PREFERENCES.file_explorer_view = view_mode; }
|
||||
view_mode_tooltip.index = view_mode;
|
||||
|
||||
tb_root.setFocusHover(pFOCUS, pHOVER);
|
||||
|
|
|
@ -1281,10 +1281,12 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
if(inspecting && !inspecting.active) inspecting = noone;
|
||||
|
||||
view_mode_tooltip.index = viewMode;
|
||||
if(buttonInstant(THEME.button_hide, ui(8), ui(48), ui(32), ui(32), [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.inspector_view, viewMode) == 2) {
|
||||
viewMode = !viewMode;
|
||||
PREFERENCES.inspector_view_default = viewMode;
|
||||
}
|
||||
var b = buttonInstant(THEME.button_hide, ui(8), ui(48), ui(32), ui(32), [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.inspector_view, viewMode);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) { viewMode = !viewMode; PREFERENCES.inspector_view_default = viewMode; }
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) { viewMode = !viewMode; PREFERENCES.inspector_view_default = viewMode; }
|
||||
}
|
||||
if(b == 2) { viewMode = !viewMode; PREFERENCES.inspector_view_default = viewMode; }
|
||||
|
||||
if(inspecting) {
|
||||
var _nodes = PANEL_GRAPH.nodes_selecting;
|
||||
|
|
|
@ -99,12 +99,20 @@ function quarternionBox(_onModify) : widget() constructor {
|
|||
if((_w - _bs) / 2 > ui(64)) {
|
||||
var bx = _x + _w - _bs;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
var tg = false;
|
||||
tooltip.index = _disp;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, ihover, iactive, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
|
||||
clickable = false;
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, ihover, iactive, tooltip, THEME.unit_angle, _disp, c_white);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) tg = true;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) tg = true;
|
||||
}
|
||||
if(b == 2) tg = true;
|
||||
|
||||
if(tg) {
|
||||
attributes.angle_display = (_disp + 1) % 2;
|
||||
onModify([ 0, 0, 0, 1 ]);
|
||||
clickable = false;
|
||||
}
|
||||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
|
|
@ -39,14 +39,12 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
|||
self.interactable = interactable;
|
||||
|
||||
tb[0].interactable = interactable;
|
||||
if(!linked)
|
||||
tb[1].interactable = interactable;
|
||||
if(!linked) tb[1].interactable = interactable;
|
||||
}
|
||||
|
||||
static register = function(parent = noone) {
|
||||
tb[0].register(parent);
|
||||
if(!linked)
|
||||
tb[1].register(parent);
|
||||
if(!linked) tb[1].register(parent);
|
||||
}
|
||||
|
||||
static isHovering = function() {
|
||||
|
@ -79,10 +77,18 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
|||
_w -= _bs + ui(4);
|
||||
}
|
||||
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
var bx = _x;
|
||||
var by = _y + _h / 2 - _bs / 2;
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip, THEME.value_link, linked, _icon_blend);
|
||||
var tg = false;
|
||||
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) tg = true;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) tg = true;
|
||||
}
|
||||
if(b == 2) tg = true;
|
||||
|
||||
if(tg) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
|
|
|
@ -50,6 +50,32 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||
}
|
||||
|
||||
static setMode = function(_data, _mode) {
|
||||
onModify(_mode, 0);
|
||||
|
||||
if(_mode == 0) {
|
||||
onModify( 0, 1);
|
||||
onModify(180, 2);
|
||||
|
||||
} else if(_mode == 1) {
|
||||
onModify((_data[1] + _data[2]) / 2, 1);
|
||||
onModify(abs(_data[1] - _data[2]) / 2, 2);
|
||||
|
||||
} else if(_mode == 2) {
|
||||
onModify(0, 1);
|
||||
onModify(90, 2);
|
||||
onModify(180, 3);
|
||||
onModify(270, 4);
|
||||
|
||||
} else if(_mode == 3) {
|
||||
onModify(45, 1);
|
||||
onModify(225, 2);
|
||||
onModify(45, 3);
|
||||
}
|
||||
|
||||
return _mode;
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _data, _m) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
|
@ -85,31 +111,15 @@ function rotatorRandom(_onModify) : widget() constructor {
|
|||
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, hover, active, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region
|
||||
mode = (mode + 1) % 4;
|
||||
onModify(mode, 0);
|
||||
|
||||
if(mode == 0) {
|
||||
onModify( 0, 1);
|
||||
onModify(180, 2);
|
||||
|
||||
} else if(mode == 1) {
|
||||
onModify((_data[1] + _data[2]) / 2, 1);
|
||||
onModify(abs(_data[1] - _data[2]) / 2, 2);
|
||||
|
||||
} else if(mode == 2) {
|
||||
onModify(0, 1);
|
||||
onModify(90, 2);
|
||||
onModify(180, 3);
|
||||
onModify(270, 4);
|
||||
|
||||
} else if(mode == 3) {
|
||||
onModify(45, 1);
|
||||
onModify(225, 2);
|
||||
onModify(45, 3);
|
||||
}
|
||||
|
||||
} #endregion
|
||||
var _bx = _x + _w - _bs;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
var b = buttonInstant(noone, _bx, _by, _bs, _bs, _m, hover, active, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]);
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) mode = setMode(_data, (mode - 1 + 4) % 4);
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) mode = setMode(_data, (mode + 1) % 4);
|
||||
}
|
||||
if(b == 2) mode = setMode(_data, (mode + 1) % 4);
|
||||
|
||||
_tw -= _bs + ui(4);
|
||||
}
|
||||
|
|
|
@ -131,8 +131,16 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
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, hover, active, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip, THEME.value_link, linked, _icon_blend);
|
||||
|
||||
var tg = false;
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) tg = true;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) tg = true;
|
||||
}
|
||||
if(b == 2) tg = true;
|
||||
|
||||
if(tg) {
|
||||
linked = !linked;
|
||||
_display_data.linked = linked;
|
||||
|
||||
|
|
|
@ -107,7 +107,15 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
|||
by += _h + ui(4);
|
||||
|
||||
tooltip_ranged.index = ranged;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip_ranged, THEME.value_range, ranged, COLORS._main_icon) == 2) {
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip_ranged, THEME.value_range, ranged, COLORS._main_icon);
|
||||
var tg = false;
|
||||
if(b == 1) {
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_up()) tg = true;
|
||||
if(key_mod_press(SHIFT) && mouse_wheel_down()) tg = true;
|
||||
}
|
||||
if(b == 2) tg = true;
|
||||
|
||||
if(tg) {
|
||||
ranged = !ranged;
|
||||
_display_data.ranged = ranged;
|
||||
|
||||
|
|
Loading…
Reference in a new issue