- Improve slider widget.

This commit is contained in:
Tanasart 2024-03-24 10:58:08 +07:00
parent 31dca9d403
commit b622e89088
69 changed files with 371 additions and 323 deletions

View file

@ -272,6 +272,7 @@
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"button","order":34,"path":"folders/widgets/button.yy",},
{"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",},
{"name":"sliders","order":39,"path":"folders/widgets/sliders.yy",},
{"name":"text","order":36,"path":"folders/widgets/text.yy",},
],
"ResourceOrderSettings": [
@ -589,6 +590,7 @@
{"name":"node_FLIP_destroy","order":11,"path":"scripts/node_FLIP_destroy/node_FLIP_destroy.yy",},
{"name":"libborderless","order":1,"path":"extensions/libborderless/libborderless.yy",},
{"name":"node_dynasurf_in","order":4,"path":"scripts/node_dynasurf_in/node_dynasurf_in.yy",},
{"name":"__sliderRange","order":3,"path":"scripts/__sliderRange/__sliderRange.yy",},
{"name":"s_node_vfx_attract","order":8,"path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",},
{"name":"s_node_pixel_cloud","order":29,"path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},
{"name":"node_grid_noise","order":4,"path":"scripts/node_grid_noise/node_grid_noise.yy",},
@ -966,7 +968,6 @@
{"name":"node_mesh_transform","order":2,"path":"scripts/node_mesh_transform/node_mesh_transform.yy",},
{"name":"node_smoke_turbulence","order":10,"path":"scripts/node_smoke_turbulence/node_smoke_turbulence.yy",},
{"name":"sh_sdf","order":1,"path":"shaders/sh_sdf/sh_sdf.yy",},
{"name":"slider","order":15,"path":"scripts/slider/slider.yy",},
{"name":"biterator","order":1,"path":"scripts/biterator/biterator.yy",},
{"name":"s_node_convolution","order":44,"path":"sprites/s_node_convolution/s_node_convolution.yy",},
{"name":"fd_rectangle_get_velocity_time_step","order":25,"path":"scripts/fd_rectangle_get_velocity_time_step/fd_rectangle_get_velocity_time_step.yy",},
@ -1171,7 +1172,7 @@
{"name":"node_alpha_cutoff","order":10,"path":"scripts/node_alpha_cutoff/node_alpha_cutoff.yy",},
{"name":"sh_channel_R","order":4,"path":"shaders/sh_channel_R/sh_channel_R.yy",},
{"name":"draw_circle_functions","order":3,"path":"scripts/draw_circle_functions/draw_circle_functions.yy",},
{"name":"sliderRange","order":16,"path":"scripts/sliderRange/sliderRange.yy",},
{"name":"sliderRange","order":2,"path":"scripts/sliderRange/sliderRange.yy",},
{"name":"node_FLIP_to_VFX","order":14,"path":"scripts/node_FLIP_to_VFX/node_FLIP_to_VFX.yy",},
{"name":"point_rect_overlap","order":2,"path":"scripts/point_rect_overlap/point_rect_overlap.yy",},
{"name":"s_node_bevel","order":6,"path":"sprites/s_node_bevel/s_node_bevel.yy",},
@ -2066,7 +2067,7 @@
{"name":"node_array_shuffle","order":10,"path":"scripts/node_array_shuffle/node_array_shuffle.yy",},
{"name":"panel_node_data_gen","order":9,"path":"scripts/panel_node_data_gen/panel_node_data_gen.yy",},
{"name":"node_dynasurf_out","order":1,"path":"scripts/node_dynasurf_out/node_dynasurf_out.yy",},
{"name":"slider_Slider","order":37,"path":"objects/slider_Slider/slider_Slider.yy",},
{"name":"slider_Slider","order":1,"path":"objects/slider_Slider/slider_Slider.yy",},
{"name":"fd_rectangle_update_material","order":21,"path":"scripts/fd_rectangle_update_material/fd_rectangle_update_material.yy",},
{"name":"s_node_array_convolute","order":16,"path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},
{"name":"sh_perlin_tiled","order":6,"path":"shaders/sh_perlin_tiled/sh_perlin_tiled.yy",},

View file

@ -308,6 +308,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sliders","folderPath":"folders/widgets/sliders.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",},
],
"IncludedFiles": [
@ -821,6 +822,7 @@
{"id":{"name":"node_FLIP_destroy","path":"scripts/node_FLIP_destroy/node_FLIP_destroy.yy",},},
{"id":{"name":"libborderless","path":"extensions/libborderless/libborderless.yy",},},
{"id":{"name":"node_dynasurf_in","path":"scripts/node_dynasurf_in/node_dynasurf_in.yy",},},
{"id":{"name":"__sliderRange","path":"scripts/__sliderRange/__sliderRange.yy",},},
{"id":{"name":"s_node_vfx_attract","path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",},},
{"id":{"name":"s_node_pixel_cloud","path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},},
{"id":{"name":"node_grid_noise","path":"scripts/node_grid_noise/node_grid_noise.yy",},},

Binary file not shown.

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

@ -27,6 +27,9 @@
DIALOG_DEPTH_HOVER = 0;
UPDATE = RENDER_TYPE.none;
CURSOR = cr_default;
CURSOR_LOCK = false;
CURSOR_LOCK_X = 0;
CURSOR_LOCK_Y = 0;
TOOLTIP = "";
DRAGGING = noone;
KEYBOARD_STRING = "";
@ -43,6 +46,8 @@
kb_hold = false;
kb_hkey = 0;
_cursor_lock = false;
watcher_surface = surface_create(1, 1);
panelInit();

View file

@ -28,9 +28,17 @@ _HOVERING_ELEMENT = noone;
if(_cursor != CURSOR) {
window_set_cursor(CURSOR);
_cursor = CURSOR;
}
CURSOR = cr_default;
if(_cursor_lock != CURSOR_LOCK) {
window_mouse_set_locked(CURSOR_LOCK);
if(!CURSOR_LOCK) window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y);
}
CURSOR = cr_default;
_cursor_lock = CURSOR_LOCK;
CURSOR_LOCK = false;
if(!is_surface(watcher_surface)) {
RENDER_ALL

View file

@ -9,8 +9,8 @@
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "widgets",
"path": "folders/widgets.yy",
"name": "sliders",
"path": "folders/widgets/sliders.yy",
},
"parentObjectId": null,
"persistent": false,

View file

@ -1,12 +1,23 @@
/// @description
depth = -19999;
tb = noone;
val = 0;
tb_de = 0;
function activate() {
slide_da = -1;
slide_dx = mouse_mx;
slide_dy = mouse_my;
def_val = 0;
cur_val = 0;
def_mx = 0;
def_my = 0;
prev_mx = 0;
function activate(defVal) {
def_val = defVal;
cur_val = defVal;
def_mx = mouse_mx;
def_my = mouse_my;
prev_mx = mouse_mx;
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
}

View file

@ -1,28 +1,11 @@
/// @description
if(tb == noone) exit;
if(slide_da == -1) {
var _dist = point_distance(slide_dx, slide_dy, mouse_mx, mouse_my);
var _dirr = point_direction(slide_dx, slide_dy, mouse_mx, mouse_my);
if(_dist > 8) {
if(_dirr < 45) slide_da = 0;
else if(_dirr < 135) slide_da = 1;
else if(_dirr < 225) slide_da = 0;
else if(_dirr < 315) slide_da = 1;
else slide_da = 0;
}
tb = noone;
exit;
}
tb_de = 1;
MOUSE_BLOCK = true;
CURSOR_LOCK = true;
if(mouse_check_button_pressed(mb_right)) {
tb._input_text = string_real(tb.slide_sv);
tb._input_text = string_real(def_val);
tb.apply();
tb.sliding = false;
tb.deactivate();
@ -32,90 +15,23 @@ if(mouse_check_button_pressed(mb_right)) {
exit;
}
var _s = tb.slide_speed;
var _s = tb.slide_speed;
var _dx = window_mouse_get_delta_x();
if(!MOUSE_WRAPPING) {
var _adx = mouse_mx - slide_dx;
var _ady = slide_dy - mouse_my;
var sc = 10;
if(key_mod_press(CTRL)) _s *= sc;
if(key_mod_press(ALT)) _s /= sc;
var spd = (slide_da? _ady : _adx) * _s;
val = value_snap(tb.slide_sv + spd, _s);
if(tb.slide_int) val = round(val);
if(tb.slide_range != noone) val = clamp(val, tb.slide_range[0], tb.slide_range[1]);
var _stp_sz = 50 * _s;
var _stp_fl = round(val / _stp_sz) * _stp_sz;
var _stp_md = val - _stp_fl;
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
var _tw = 48;
for( var i = -2; i <= 2; i++ ) {
var _v = _stp_fl + i * _stp_sz;
_tw = max(_tw, string_width(_v) + 24);
}
var _snp_s = 50 * _s;
var _snp_v = round(val / _snp_s) * _snp_s;
if(abs(val - _snp_v) < 5 * _s)
val = _snp_v;
if(slide_da) {
var _val_y = slide_dy - (val - tb.slide_sv) / _s;
var _sdw = _tw;
var _sdh = 256;
var _sdx = slide_dx - _sdw / 2;
var _sdy = _val_y - _sdh / 2;
draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1);
for( var i = -2; i <= 2; i++ ) {
var _v = _stp_fl + i * _stp_sz;
draw_set_color(_v == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(0.4 - abs(i) * 0.1);
draw_text(slide_dx, slide_dy - (_v - tb.slide_sv) / _s, _v);
}
draw_set_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(1);
draw_text(slide_dx, _val_y, val);
} else {
var _val_x = slide_dx + (val - tb.slide_sv) / _s;
var _sdw = 240;
var _sdh = 48;
var _sdx = _val_x - _sdw / 2;
var _sdy = slide_dy - _sdh / 2;
draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1);
for( var i = -2; i <= 2; i++ ) {
var _v = _stp_fl + i * _stp_sz;
draw_set_color(_v == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(0.4 - abs(i) * 0.1);
draw_text(slide_dx + (_v - tb.slide_sv) / _s, slide_dy, _v);
}
draw_set_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(1);
draw_text(_val_x, slide_dy, val);
}
tb._input_text = string_real(val);
if(tb.apply()) UNDO_HOLDING = true;
}
if(MOUSE_WRAPPING) {
if(slide_da) slide_dy = mouse_my + (val - tb.slide_sv) / _s;
else slide_dx = mouse_mx - (val - tb.slide_sv) / _s;
}
setMouseWrap();
tb = noone;
if(key_mod_press(CTRL)) _s *= 10;
if(key_mod_press(ALT)) _s /= 10;
cur_val += _dx * _s;
if(tb.slide_range != noone)
cur_val = clamp(cur_val, tb.curr_range[0], tb.curr_range[1]);
var _val = value_snap(cur_val, _s);
if(tb.slide_int)
_val = round(_val);
tb._input_text = string_real(_val);
if(tb.apply()) UNDO_HOLDING = true;
tb = noone;
CURSOR = cr_none;

View file

@ -49,7 +49,7 @@ function __Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) constr
.rejectArray();
inputs[| 12] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 1 ] })
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 0.1 ] })
.rejectArray();
inputs[| 13] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -41,7 +41,7 @@ function __Node_3D_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.rejectArray();
inputs[| 13] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 14] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);

View file

@ -49,7 +49,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
.rejectArray();
inputs[| 17] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 18] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -59,7 +59,7 @@ function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
.rejectArray();
inputs[| 16] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 1 ] })
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 0.1 ] })
.rejectArray();
inputs[| 17] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -31,7 +31,7 @@ function __Node_3D_Plane(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
.rejectArray();
inputs[| 9] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 10] = nodeValue("Texture scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -40,7 +40,7 @@ function __Node_3D_Cone(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.rejectArray();
inputs[| 13] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 14] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16);

View file

@ -53,7 +53,7 @@ function __Node_3D_Cube(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.rejectArray();
inputs[| 21] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 22] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -49,7 +49,7 @@ function __Node_3D_Cylinder(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.rejectArray();
inputs[| 18] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 19] = nodeValue("Taper", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -46,7 +46,7 @@ function __Node_3D_Sphere(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
.rejectArray();
inputs[| 15] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 16] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -64,7 +64,7 @@ function __Node_3D_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constru
.rejectArray();
inputs[| 21] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 22] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -41,7 +41,7 @@ function __Node_3D_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
.rejectArray();
inputs[| 13] = nodeValue("Field of view", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 60)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 90, 0.1 ] });
inputs[| 14] = nodeValue("Scale view with dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)

View file

@ -0,0 +1,130 @@
function __sliderRange(_min, _max, _step, _onModify) : widget() constructor {
minn = _min;
maxx = _max;
stepSize = _step;
spr = THEME.slider;
onModify = _onModify;
dragging = noone;
drag_sv = 0;
tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, minn, maxx)); });
tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, minn, maxx)); });
tb_value_min.slidable = true;
tb_value_max.slidable = true;
static setSlideSpeed = function(speed) { #region
tb_value_min.setSlidable(speed);
tb_value_max.setSlidable(speed);
} #endregion
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_value_min.interactable = interactable;
tb_value_max.interactable = interactable;
} #endregion
static register = function(parent = noone) { #region
tb_value_min.register(parent);
tb_value_max.register(parent);
} #endregion
static drawParam = function(params) { #region
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion
static draw = function(_x, _y, _w, _h, _data, _m) { #region
x = _x;
y = _y;
w = _w;
h = _h;
if(!is_real(_data[0])) return h;
if(!is_real(_data[1])) return h;
var tb_w = ui(64);
var sw = _w - (tb_w + ui(16)) * 2;
tb_value_min.setFocusHover(active, hover);
tb_value_min.draw(_x, _y, tb_w, TEXTBOX_HEIGHT, _data[0], _m);
tb_value_max.setFocusHover(active, hover);
tb_value_max.draw(_x + _w - tb_w, _y, tb_w, TEXTBOX_HEIGHT, _data[1], _m);
var _x0 = _x + tb_w + ui(16);
draw_sprite_stretched(spr, 0, _x0, _y + _h / 2 - ui(4), sw, ui(8));
if(stepSize >= 1 && sw / ((maxx - minn) / stepSize) > ui(16)) {
for( var i = minn; i <= maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x0 + clamp((_v - minn) / (maxx - minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, _cx - ui(4), _y + _h / 2 - ui(4), ui(8), ui(8), COLORS.widget_slider_step, 1);
}
}
var _slider_x0 = _x0 + clamp((_data[0] - minn) / (maxx - minn), 0, 1) * sw;
var _slider_x1 = _x0 + clamp((_data[1] - minn) / (maxx - minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, min(_slider_x0, _slider_x1), _y + _h / 2 - ui(4), abs(_slider_x1 - _slider_x0), ui(8), COLORS._main_accent, 1);
draw_sprite_stretched(spr, 1, _slider_x0 - ui(10), _y, ui(20), _h);
draw_sprite_stretched(spr, 1, _slider_x1 - ui(10), _y, ui(20), _h);
if(dragging) {
if(dragging_index == 0)
draw_sprite_stretched_ext(spr, 3, _slider_x0 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1);
else if(dragging_index == 1)
draw_sprite_stretched_ext(spr, 3, _slider_x1 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1);
var val = (dragging.drag_sx - dragging.drag_msx) / dragging.drag_sw * (maxx - minn) + minn;
val = round(val / stepSize) * stepSize;
val = clamp(val, minn, maxx);
if(key_mod_press(CTRL))
val = round(val);
if(onModify(dragging_index, val))
UNDO_HOLDING = true;
MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) {
onModify(dragging_index, 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(hover) {
var _hover = -1;
if(point_in_rectangle(_m[0], _m[1], _slider_x0 - ui(10), _y, _slider_x0 + ui(10), _y + _h)) {
draw_sprite_stretched(spr, 2, _slider_x0 - ui(10), _y, ui(20), _h);
_hover = 0;
}
if(point_in_rectangle(_m[0], _m[1], _slider_x1 - ui(10), _y, _slider_x1 + ui(10), _y + _h)) {
draw_sprite_stretched(spr, 2, _slider_x1 - ui(10), _y, ui(20), _h);
_hover = 1;
}
if(_hover > -1 && mouse_press(mb_left, active)) {
dragging = instance_create(0, 0, slider_Slider);
dragging_index = _hover;
dragging.drag_sx = _m[0];
dragging.drag_msx = _x0;
dragging.drag_sw = sw;
drag_sv = _data[_hover];
}
}
resetFocus();
return h;
} #endregion
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "__sliderRange",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "sliders",
"path": "folders/widgets/sliders.yy",
},
}

View file

@ -9,14 +9,14 @@ function Biterator(node) : VCT(node) constructor {
dimension = VCT_var(VALUE_TYPE.integer, 0);
shape = VCT_var(VALUE_TYPE.integer, 0);
shape_par[0] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [- 8, 8, 1] });
shape_par[1] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [- 8, 8, 1] });
shape_par[2] = VCT_var(VALUE_TYPE.integer, 2).setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 1] });
shape_par[3] = VCT_var(VALUE_TYPE.integer, 2).setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 1] });
shape_par[4] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 1] });
shape_par[5] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 1] });
shape_par[0] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [- 8, 8, 0.1] });
shape_par[1] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [- 8, 8, 0.1] });
shape_par[2] = VCT_var(VALUE_TYPE.integer, 2).setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.1] });
shape_par[3] = VCT_var(VALUE_TYPE.integer, 2).setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.1] });
shape_par[4] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 0.1] });
shape_par[5] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 0.1] });
shape_par[5] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 1] });
shape_par[5] = VCT_var(VALUE_TYPE.integer, 0).setDisplay(VALUE_DISPLAY.slider, { range: [ -4, 4, 0.1] });
for( var i = 0; i < 3; i++ )
color[i] = VCT_var(VALUE_TYPE.color, c_white);

View file

@ -41,7 +41,8 @@
HOTKEY_CONTEXT = ds_list_create();
HOTKEY_CONTEXT[| 0] = "";
globalvar CURSOR, TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
globalvar CURSOR, CURSOR_LOCK, CURSOR_LOCK_X, CURSOR_LOCK_Y;
globalvar TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
#endregion
#region inputs

View file

@ -4,7 +4,7 @@ function __init_mask_modifier(_mask_index) { #region
inputs[| _ind + 0] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| _ind + 1] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 32, 0.1] });
__mask_index = _mask_index;
__mask_mod_index = _ind;

View file

@ -1,10 +1,15 @@
enum INSP_VIEW_MODE {
compact,
spacious
}
function drawWidgetInit() {
anim_toggling = false;
anim_hold = noone;
visi_hold = noone;
min_w = ui(160);
lineBreak = PREFERENCES.inspector_view_default;
viewMode = PREFERENCES.inspector_view_default;
tooltip_loop_type = new tooltipSelector(__txtx("panel_animation_looping_mode", "Looping mode"), global.junctionEndName);
}
@ -12,9 +17,9 @@ function drawWidgetInit() {
function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) {
var con_w = ww - ui(4);
var xc = xx + ww / 2;
var _font = lineBreak? f_p0 : f_p1;
var _font = viewMode == INSP_VIEW_MODE.spacious? f_p0 : f_p2;
var breakLine = lineBreak || jun.expUse;
var breakLine = viewMode || jun.expUse;
var lb_h = line_get_height(_font) + ui(8);
var lb_y = yy + lb_h / 2;
@ -130,7 +135,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
return [ 0, true ];
} #endregion
draw_text_add(lb_x, lb_y, _name);
draw_text_over(lb_x, lb_y, _name);
#region tooltip
if(jun.tooltip != "") {

View file

@ -40,13 +40,13 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 8] = nodeValue("Sweep", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 15)
.setDisplay(VALUE_DISPLAY.slider, { range: [-80, 80, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [-80, 80, 0.1] });
inputs[| 9] = nodeValue("Sweep end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [-80, 80, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [-80, 80, 0.1] });
inputs[| 10] = nodeValue("Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.1] });
inputs[| 11] = nodeValue("Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Quadratic", s_node_curve, 0),
@ -54,7 +54,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
new scrollItem("Linear", s_node_curve, 2), ]);
inputs[| 12] = nodeValue("Radial banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.1] });
inputs[| 13] = nodeValue("Radial start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.rotation);

View file

@ -18,7 +18,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
global.SKY_SPHERE = new __3dUVSphere(0.5, 16, 8, true);
inputs[| in_d3d + 0] = nodeValue("FOV", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 60 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 10, 90, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 10, 90, 0.1 ] });
inputs[| in_d3d + 1] = nodeValue("Clipping Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 10 ] )
.setDisplay(VALUE_DISPLAY.vector);
@ -55,7 +55,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| in_d3d + 13] = nodeValue("Vertical Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
inputs[| in_d3d + 14] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 );

View file

@ -10,7 +10,7 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
inputs[| in_cam + 1] = nodeValue("L1 V angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setName("Vertical angle")
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
inputs[| in_cam + 2] = nodeValue("L1 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
.setName("Color")
@ -25,7 +25,7 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
inputs[| in_cam + 5] = nodeValue("L2 V angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setName("Vertical angle")
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
inputs[| in_cam + 6] = nodeValue("L2 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
.setName("Color")

View file

@ -10,7 +10,7 @@ function Node_3DSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 2] = nodeValue("Vertical Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
inputs[| 3] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 );

View file

@ -56,7 +56,7 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
inputs[| 12] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 13] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
inputs[| 14] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ])
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -3,7 +3,7 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.")
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 2] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5, "How bright a pixel should be to start blooming.")
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -2,8 +2,8 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
name = "Blur";
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 32, 0.1 ] });
inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);

View file

@ -4,7 +4,7 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2, "Brightness different to be blur together.")
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -3,7 +3,7 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);

View file

@ -4,7 +4,7 @@ function Node_Blur_Slope(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] })
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 32, 0.1 ] })
.setMappable(9);
inputs[| 2] = nodeValue("Slope Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -7,7 +7,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white );
inputs[| 2] = nodeValue("Brush size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 3] = nodeValue("Fill threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -58,7 +58,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
inputs[| 16] = nodeValue("Invert mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 17] = nodeValue("Mask feather", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
////////////////////////////////////////////////////////////////////////////////////////

View file

@ -53,16 +53,16 @@ function Node_Color_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 4].setDisplay(VALUE_DISPLAY.slider);
} else {
inputs[| 0].setType(VALUE_TYPE.integer);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 360, 1] });
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 360, 0.1] });
inputs[| 1].setType(VALUE_TYPE.integer);
inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
inputs[| 2].setType(VALUE_TYPE.integer);
inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
inputs[| 4].setType(VALUE_TYPE.integer);
inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
}
}
} #endregion

View file

@ -42,16 +42,16 @@ function Node_Color_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 4].setDisplay(VALUE_DISPLAY.slider);
} else {
inputs[| 0].setType(VALUE_TYPE.integer);
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 0].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
inputs[| 1].setType(VALUE_TYPE.integer);
inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 1].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
inputs[| 2].setType(VALUE_TYPE.integer);
inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 2].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
inputs[| 4].setType(VALUE_TYPE.integer);
inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 1] });
inputs[| 4].setDisplay(VALUE_DISPLAY.slider, { range: [0, 255, 0.1] });
}
}
} #endregion

View file

@ -4,7 +4,7 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2)
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 0.1] });
inputs[| 2] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -102,13 +102,13 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
.rejectArray();
inputs[| 10] = nodeValue("Quality", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 23)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 100, 1 ] })
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 100, 0.1 ] })
.rejectArray();
inputs[| 11] = nodeValue("Sequence begin", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);
inputs[| 12] = nodeValue("Frame range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, -1])
.setDisplay(VALUE_DISPLAY.slider_range, { range: [0, TOTAL_FRAMES, 1] });
.setDisplay(VALUE_DISPLAY.slider_range, { range: [0, TOTAL_FRAMES, 0.1] });
png_format = [ "INDEX4", "INDEX8", "Default (PNG32)" ];
inputs[| 13] = nodeValue("Subformat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2)

View file

@ -15,7 +15,7 @@ function Node_Flow_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y,
addShaderProp(SHADER_UNIFORM.float, "progress");
inputs[| 4] = nodeValue("Detail", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 1, 8 ])
.setDisplay(VALUE_DISPLAY.slider_range, { range: [ 1, 16, 1 ] });
.setDisplay(VALUE_DISPLAY.slider_range, { range: [ 1, 16, 0.1 ] });
addShaderProp(SHADER_UNIFORM.float, "detail");
input_display_list = [

View file

@ -12,7 +12,7 @@ function Node_Fold_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y,
addShaderProp(SHADER_UNIFORM.float, "scale");
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 6, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 6, 0.1] });
addShaderProp(SHADER_UNIFORM.integer, "iteration");
inputs[| 4] = nodeValue("Stretch", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2);

View file

@ -4,10 +4,10 @@ function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Border", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 4, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 4, 0.1] });
inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ]});

View file

@ -30,16 +30,16 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
.setDisplay(VALUE_DISPLAY.palette);
inputs[| 11] = nodeValue("Falloff 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 6 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 0.1 ] });
inputs[| 12] = nodeValue("Falloff 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 6 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 0.1 ] });
inputs[| 13] = nodeValue("Falloff 3", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 6 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 0.1 ] });
inputs[| 14] = nodeValue("Falloff 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 6 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 0.1 ] });
inputs[| 15] = nodeValue("Normalize weight", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )

View file

@ -7,7 +7,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 1] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 2] = nodeValue("Segment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 3] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ])
.setDisplay(VALUE_DISPLAY.vector);
@ -39,7 +39,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 13] = nodeValue("Round cap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 14] = nodeValue("Round segment", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 0.1] });
inputs[| 15] = nodeValue("Span color over path", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Apply the full 'color over length' to the trimmed path.");

View file

@ -7,7 +7,7 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Average (Blur)", "Maximum", "Minimum" ]);
inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 1, 16, 0.1] });
inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);

View file

@ -205,7 +205,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8, "Amount of grid subdivision. Higher number means more grid, detail.")
.setDisplay(VALUE_DISPLAY.slider, { range: [ 2, 32, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range: [ 2, 32, 0.1 ] });
inputs[| 2] = nodeValue("Spring Force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -25,7 +25,7 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
inputs[| 8] = nodeValue("Glow", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 9] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 )
.setDisplay(VALUE_DISPLAY.slider, { range : [ 1, 8, 1 ] });
.setDisplay(VALUE_DISPLAY.slider, { range : [ 1, 8, 0.1 ] });
inputs[| 10] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -12,7 +12,7 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.setMappable(8);
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] })
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] })
.setMappable(9);
inputs[| 4] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)

View file

@ -6,7 +6,7 @@ function Node_Onion_Skin(_x, _y, _group = noone) : Node(_x, _y, _group) construc
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [-1, 1])
.setDisplay(VALUE_DISPLAY.slider_range, { range: [ -16, 16, 1 ] });
.setDisplay(VALUE_DISPLAY.slider_range, { range: [ -16, 16, 0.1 ] });
inputs[| 2] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -7,7 +7,7 @@ function Node_Palette_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.setDisplay(VALUE_DISPLAY.palette);
inputs[| 2] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [-1, 1, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [-1, 1, 0.1] });
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -9,7 +9,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 2] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 3] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 0.1] });
inputs[| 4] = nodeValue("Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.6)
.setDisplay(VALUE_DISPLAY.slider)

View file

@ -273,7 +273,7 @@ function __initNodes() {
var favPath = DIRECTORY + "Nodes/fav.json";
global.FAV_NODES = file_exists_empty(favPath)? json_load_struct(favPath) : [];
if(!is_array(global.FAV_NODES)) global.FAV_NODES = [];
var recPath = DIRECTORY + "Nodes/recent.json";
global.RECENT_NODES = file_exists_empty(recPath)? json_load_struct(recPath) : [];
if(!is_array(global.RECENT_NODES)) global.RECENT_NODES = [];

View file

@ -9,7 +9,7 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
.setUnitRef(function(index) { return getDimension(index); });
inputs[| 2] = nodeValue("Sampling size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1, "Size of square around the position to sample and average pixel color.")
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 3, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 3, 0.1] });
inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);

View file

@ -12,10 +12,10 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
.setUnitRef(function(index) { return getDimension(index); });
inputs[| 4] = nodeValue("Grow", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.1] });
inputs[| 5] = nodeValue("Blur", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -25,7 +25,7 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] });
inputs[| 4] = nodeValue("Light density", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
inputs[| 5] = nodeValue("Light type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Point", s_node_shadow_type, 0),
@ -48,7 +48,7 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] });
inputs[| 13] = nodeValue("Banding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.1] });
inputs[| 14] = nodeValue("Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Control how light fade out over distance.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Quadratic", s_node_curve, 0),
@ -56,7 +56,7 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
new scrollItem("Linear", s_node_curve, 2), ]);
inputs[| 15] = nodeValue("Ambient occlusion", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.1] });
inputs[| 16] = nodeValue("Ambient occlusion strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] });

View file

@ -27,7 +27,7 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference);
inputs[| 8] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16)
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 64, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 64, 0.1] });
inputs[| 9] = nodeValue("Inner radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);
@ -36,7 +36,7 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 11] = nodeValue("Teeth", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 6)
.setDisplay(VALUE_DISPLAY.slider, { range: [3, 16, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [3, 16, 0.1] });
inputs[| 12] = nodeValue("Teeth height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -880,9 +880,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
switch(display_type) {
case VALUE_DISPLAY._default : #region
editWidget = new textBox(_txt, function(val) {
return setValueInspector(val);
} );
editWidget = new textBox(_txt, function(val) { return setValueInspector(val); } );
editWidget.slidable = true;
if(type == VALUE_TYPE.integer) editWidget.setSlidable();
@ -995,10 +993,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.slider : #region
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
editWidget = new slider(_range[0], _range[1], _range[2], function(val) {
return setValueInspector(toNumber(val));
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
editWidget = new textBox(TEXTBOX_INPUT.number, function(val) { return setValueInspector(toNumber(val)); } )
.setSlidable(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ]);
if(struct_has(display_data, "update_stat"))
editWidget.update_stat = display_data.update_stat;
@ -1008,10 +1004,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.slider_range : #region
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
editWidget = new sliderRange(_range[0], _range[1], _range[2], function(index, val) {
return setValueInspector(val, index);
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ],
function(index, val) { return setValueInspector(val, index); } );
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Range, i);

View file

@ -8,7 +8,7 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] });
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom_range(1000000, 9999999) );

View file

@ -529,7 +529,7 @@ function Panel_Inspector() : PanelContent() constructor {
var txt = __txt(jun_disp[0]);
var coll = jun_disp[1] && filter_text == "";
var lbh = lineBreak? ui(32) : ui(26);
var lbh = viewMode? ui(32) : ui(26);
var togl = array_safe_get(jun_disp, 2, noone);
if(togl != noone) var toging = _inspecting.getInputData(togl);
@ -570,11 +570,11 @@ function Panel_Inspector() : PanelContent() constructor {
}
draw_set_alpha(aa);
draw_set_text(lineBreak? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text);
draw_set_text(viewMode? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text);
draw_text_add(ltx, yy + lbh / 2, txt);
draw_set_alpha(1);
hh += lbh + ui(lineBreak? 8 : 6) + pad;
hh += lbh + ui(viewMode? 8 : 6) + pad;
if(coll) { // skip
_colsp = true;
@ -628,7 +628,7 @@ function Panel_Inspector() : PanelContent() constructor {
}
#region ++++ draw widget ++++
var _font = lineBreak? f_p0 : f_p1;
var _font = viewMode == INSP_VIEW_MODE.spacious? f_p0 : f_p2;
var lb_h = line_get_height(_font) + ui(8);
var lb_w = line_get_width(jun.getName(), _font) + ui(16);
@ -646,7 +646,7 @@ function Panel_Inspector() : PanelContent() constructor {
hh += lb_h + widH + padd;
var _selY1 = yy + lb_h + widH + ui(2);
var _selH = _selY1 - _selY + (lineBreak * ui(4));
var _selH = _selY1 - _selY + (viewMode * ui(4));
if(jun == prop_highlight && prop_highlight_time) {
if(prop_highlight_time == 60)
@ -858,10 +858,10 @@ function Panel_Inspector() : PanelContent() constructor {
}
by += ui(36);
view_mode_tooltip.index = lineBreak;
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2) {
lineBreak = !lineBreak;
PREFERENCES.inspector_view_default = lineBreak;
view_mode_tooltip.index = viewMode;
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, viewMode) == 2) {
viewMode = !viewMode;
PREFERENCES.inspector_view_default = viewMode;
}
//////////////////////////////////////////////////////////////////// INSPECTOR ACTIONS ////////////////////////////////////////////////////////////////////

View file

@ -5,7 +5,7 @@
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "widgets",
"path": "folders/widgets.yy",
"name": "sliders",
"path": "folders/widgets/sliders.yy",
},
}

View file

@ -1,19 +1,16 @@
function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
minn = _min;
maxx = _max;
stepSize = _step;
function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
slide_range = _range;
curr_range = [ _range[0], _range[1] ];
stepSize = _step;
isInt = _int;
spr = THEME.slider;
onModify = _onModify;
dragging = noone;
drag_sv = 0;
tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range);
tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range);
tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, minn, maxx)); });
tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, minn, maxx)); });
tb_value_min.slidable = true;
tb_value_max.slidable = true;
tb_value_min.hide = true;
tb_value_max.hide = true;
static setSlideSpeed = function(speed) { #region
tb_value_min.setSlidable(speed);
@ -43,87 +40,37 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
if(!is_real(_data[0])) return h;
if(!is_real(_data[1])) return h;
var tb_w = ui(64);
var sw = _w - (tb_w + ui(16)) * 2;
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
var _minn = slide_range[0];
var _maxx = slide_range[1];
var _rang = abs(_maxx - _minn);
var _currMin = min(_data[0], _data[1]);
var _currMax = max(_data[0], _data[1]);
if(tb_value_min.sliding != 2 && tb_value_max.sliding != 2) {
curr_range[0] = (_currMin >= _minn)? _minn : _minn - ceil(abs(_currMin - _minn) / _rang) * _rang;
curr_range[1] = (_currMax <= _maxx)? _maxx : _maxx + ceil(abs(_currMax - _maxx) / _rang) * _rang;
}
var lx = _w * (_currMin - curr_range[0]) / (curr_range[1] - curr_range[0]);
var lw = _w * ((_currMax - _currMin) - curr_range[0]) / (curr_range[1] - curr_range[0]);
draw_sprite_stretched_ext(THEME.textbox, 4, _x + lx, _y, lw, _h, c_white, 1);
var tb_w = _w / 2;
if(tb_value_min.selecting || tb_value_max.selecting) {
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, c_white, 1);
} else {
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
}
tb_value_min.setFocusHover(active, hover);
tb_value_min.draw(_x, _y, tb_w, TEXTBOX_HEIGHT, _data[0], _m);
tb_value_min.draw(_x, _y, tb_w, _h, _data[0], _m);
tb_value_max.setFocusHover(active, hover);
tb_value_max.draw(_x + _w - tb_w, _y, tb_w, TEXTBOX_HEIGHT, _data[1], _m);
var _x0 = _x + tb_w + ui(16);
draw_sprite_stretched(spr, 0, _x0, _y + _h / 2 - ui(4), sw, ui(8));
if(stepSize >= 1 && sw / ((maxx - minn) / stepSize) > ui(16)) {
for( var i = minn; i <= maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x0 + clamp((_v - minn) / (maxx - minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, _cx - ui(4), _y + _h / 2 - ui(4), ui(8), ui(8), COLORS.widget_slider_step, 1);
}
}
var _slider_x0 = _x0 + clamp((_data[0] - minn) / (maxx - minn), 0, 1) * sw;
var _slider_x1 = _x0 + clamp((_data[1] - minn) / (maxx - minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, min(_slider_x0, _slider_x1), _y + _h / 2 - ui(4), abs(_slider_x1 - _slider_x0), ui(8), COLORS._main_accent, 1);
draw_sprite_stretched(spr, 1, _slider_x0 - ui(10), _y, ui(20), _h);
draw_sprite_stretched(spr, 1, _slider_x1 - ui(10), _y, ui(20), _h);
if(dragging) {
if(dragging_index == 0)
draw_sprite_stretched_ext(spr, 3, _slider_x0 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1);
else if(dragging_index == 1)
draw_sprite_stretched_ext(spr, 3, _slider_x1 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1);
var val = (dragging.drag_sx - dragging.drag_msx) / dragging.drag_sw * (maxx - minn) + minn;
val = round(val / stepSize) * stepSize;
val = clamp(val, minn, maxx);
if(key_mod_press(CTRL))
val = round(val);
if(onModify(dragging_index, val))
UNDO_HOLDING = true;
MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) {
onModify(dragging_index, 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(hover) {
var _hover = -1;
if(point_in_rectangle(_m[0], _m[1], _slider_x0 - ui(10), _y, _slider_x0 + ui(10), _y + _h)) {
draw_sprite_stretched(spr, 2, _slider_x0 - ui(10), _y, ui(20), _h);
_hover = 0;
}
if(point_in_rectangle(_m[0], _m[1], _slider_x1 - ui(10), _y, _slider_x1 + ui(10), _y + _h)) {
draw_sprite_stretched(spr, 2, _slider_x1 - ui(10), _y, ui(20), _h);
_hover = 1;
}
if(_hover > -1 && mouse_press(mb_left, active)) {
dragging = instance_create(0, 0, slider_Slider);
dragging_index = _hover;
dragging.drag_sx = _m[0];
dragging.drag_msx = _x0;
dragging.drag_sw = sw;
drag_sv = _data[_hover];
}
}
resetFocus();
tb_value_max.draw(_x + tb_w, _y, tb_w, _h, _data[1], _m);
return h;
} #endregion

View file

@ -5,7 +5,7 @@
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "widgets",
"path": "folders/widgets.yy",
"name": "sliders",
"path": "folders/widgets/sliders.yy",
},
}

View file

@ -4,7 +4,7 @@ enum TEXTBOX_INPUT {
}
function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
align = _input == TEXTBOX_INPUT.number? fa_right : fa_left;
align = _input == TEXTBOX_INPUT.number? fa_center : fa_left;
hide = false;
font = noone;
color = COLORS._main_text;
@ -18,9 +18,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
slidable = false;
sliding = false;
slide_int = false;
slide_sv = 0;
slide_speed = 1 / 10;
slide_range = noone;
curr_range = [ 0, 1 ];
label = "";
@ -402,7 +402,25 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
text_surface = surface_verify(text_surface, _w - ui(16), _h);
if(!hide) draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
if(!hide) {
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 _currVal = toNumber(_current_text);
if(sliding != 2) {
curr_range[0] = (_currVal >= _minn)? _minn : _minn - ceil(abs(_currVal - _minn) / _rang) * _rang;
curr_range[1] = (_currVal <= _maxx)? _maxx : _maxx + ceil(abs(_currVal - _maxx) / _rang) * _rang;
}
var lw = _w * (_currVal - curr_range[0]) / (curr_range[1] - curr_range[0]);
draw_sprite_stretched_ext(THEME.textbox, 4, _x, _y, lw, _h, boxColor, 1);
}
}
disp_x = lerp_float(disp_x, disp_x_to, 5);
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
@ -545,12 +563,12 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
if(slidable) {
if(_w > ui(64) && _h >= TEXTBOX_HEIGHT && label == "")
draw_sprite_ui_uniform(THEME.text_slider, 0, _x + ui(20), _y + _h / 2, 1, COLORS._main_icon, 0.5);
//if(_w > ui(64) && _h >= TEXTBOX_HEIGHT && label == "")
// draw_sprite_ui_uniform(THEME.text_slider, 0, _x + ui(20), _y + _h / 2, 1, COLORS._main_icon, 0.5);
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h) && mouse_press(mb_left, active)) {
sliding = 1;
slide_mx = _m[0];
slide_my = _m[1];
}
@ -573,18 +591,17 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} #endregion
if(sliding > 0) { #region
var dx = _m[0] - slide_mx;
var dy = _m[1] - slide_my;
if(sliding == 1 && (abs(dx) > 8 || abs(dy) > 8)) {
if(sliding == 1 && window_mouse_get_delta_x() != 0) {
deactivate();
textBox_slider.activate(toNumber(_input_text));
sliding = 2;
slide_sv = toNumber(_input_text);
textBox_slider.activate()
}
if(sliding == 2) {
textBox_slider.tb = self;
if(mouse_release(mb_left)) deactivate();
if(mouse_release(mb_left))
deactivate();
}
if(mouse_release(mb_left)) {