Pixel-Composer/objects/textBox_slider/Draw_64.gml

41 lines
899 B
Text
Raw Normal View History

2023-11-06 12:08:59 +01:00
/// @description
if(tb == noone) exit;
2024-01-16 11:00:39 +01:00
MOUSE_BLOCK = true;
2024-03-24 04:58:08 +01:00
CURSOR_LOCK = true;
2024-01-16 11:00:39 +01:00
if(mouse_check_button_pressed(mb_right)) {
2024-03-24 04:58:08 +01:00
tb._input_text = string_real(def_val);
tb.apply();
tb.sliding = false;
tb.deactivate();
UNDO_HOLDING = false;
tb = noone;
exit;
}
2024-03-26 04:03:45 +01:00
var _s = tb.slide_speed;
var _mdx = window_mouse_get_delta_x();
var _mdy = window_mouse_get_delta_y();
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
2023-12-05 09:51:24 +01:00
2024-03-27 11:51:14 +01:00
if(key_mod_press(CTRL) && !tb.slide_snap) _s *= 10;
2024-03-24 04:58:08 +01:00
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);
2024-03-27 11:51:14 +01:00
if(key_mod_press(CTRL) && tb.slide_snap) _val = value_snap(cur_val, tb.slide_snap);
if(tb.slide_int) _val = round(_val);
if(abs(_val) < _s * 4) _val = 0;
2024-03-24 04:58:08 +01:00
tb._input_text = string_real(_val);
if(tb.apply()) UNDO_HOLDING = true;
2024-03-26 04:03:45 +01:00
tb = noone;