textbox pen slide

This commit is contained in:
Tanasart 2024-04-18 13:01:23 +07:00
parent 1431137e82
commit 6b7e882eab
7 changed files with 76 additions and 56 deletions

View file

@ -1,4 +1,4 @@
// 2024-04-18 11:59:25
// 2024-04-18 13:01:11
#event properties (no comments/etc. here are saved)
parent_index = -1;
persistent = true;
@ -653,6 +653,9 @@ _HOVERING_ELEMENT = noone;
PEN_RIGHT_PRESS = false;
PEN_RIGHT_RELEASE = false;
PEN_X_DELTA = 0;
PEN_Y_DELTA = 0;
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
@ -1042,7 +1045,6 @@ PROJECT.modified = false;
var e; e = tabletstuff_get_event_data();
if (!ds_map_exists(e, "pointer_info_pen")) exit;
PEN_USE = true;
/*
See:
@ -1062,11 +1064,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
var ty = e[? "pointer_info_pen_tilt_y"];
PEN_X_DELTA = px - PEN_X;
PEN_Y_DELTA = px - PEN_Y;
PEN_Y_DELTA = py - PEN_Y;
PEN_X = px;
PEN_Y = py;
// print($"{PEN_X} | {PEN_X_DELTA}");
PEN_PRESSURE = pp;
var contact = bool(f & 0x4);
@ -1083,7 +1087,7 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
PEN_RIGHT_CLICK = b2;
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
PEN_USE = true;
#event async_image
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;

View file

@ -1,4 +1,4 @@
// 2024-04-18 11:59:03
// 2024-04-18 12:59:59
#event properties (no comments/etc. here are saved)
parent_index = -1;
persistent = true;
@ -653,6 +653,9 @@ _HOVERING_ELEMENT = noone;
PEN_RIGHT_PRESS = false;
PEN_RIGHT_RELEASE = false;
PEN_X_DELTA = 0;
PEN_Y_DELTA = 0;
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
@ -1042,7 +1045,6 @@ PROJECT.modified = false;
var e; e = tabletstuff_get_event_data();
if (!ds_map_exists(e, "pointer_info_pen")) exit;
PEN_USE = true;
/*
See:
@ -1062,13 +1064,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
var ty = e[? "pointer_info_pen_tilt_y"];
PEN_X_DELTA = px - PEN_X;
PEN_Y_DELTA = px - PEN_Y;
//print($"{PEN_X_DELTA}, {PEN_Y_DELTA}");
PEN_Y_DELTA = py - PEN_Y;
PEN_X = px;
PEN_Y = py;
// print($"{PEN_X} | {PEN_X_DELTA}");
PEN_PRESSURE = pp;
var contact = bool(f & 0x4);
@ -1085,7 +1087,7 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
PEN_RIGHT_CLICK = b2;
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
PEN_USE = true;
#event async_image
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;

View file

@ -1,4 +1,4 @@
// 2024-04-18 12:07:15
// 2024-04-18 13:00:44
enum TEXTBOX_INPUT {
text,
number
@ -21,6 +21,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
slidable = false;
sliding = false;
slidePen = false;
slide_delta = 0;
slide_int = false;
slide_speed = 1 / 10;
@ -511,33 +512,38 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
var _defval = toNumber(_current_text);
slider_def_val = _defval;
slider_cur_val = _defval;
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
slidePen = PEN_USE;
if(!slidePen) {
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
}
sliding = 2;
}
if(sliding == 2) {
MOUSE_BLOCK = true;
CURSOR_LOCK = true;
if(!slidePen)
CURSOR_LOCK = true;
if(mouse_check_button_pressed(mb_right)) {
if(mouse_press(mb_right)) {
_input_text = string_real(slider_def_val);
sliding = 0;
apply();
deactivate();
UNDO_HOLDING = false;
} else {
MOUSE_BLOCK = true;
var _s = slide_speed;
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
if(key_mod_press(CTRL) && !slide_snap) _s *= 10;
if(key_mod_press(ALT)) _s /= 10;
@ -695,11 +701,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
}
if(slidable && mouse_press(mb_left, active)) {
sliding = 1;
sliding = 1;
slide_delta = 0;
slide_mx = _m[0];
slide_my = _m[1];
}
} else if(!hide)

View file

@ -1,4 +1,4 @@
// 2024-04-18 12:00:32
// 2024-04-18 13:00:36
enum TEXTBOX_INPUT {
text,
number
@ -21,6 +21,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
slidable = false;
sliding = false;
slidePen = false;
slide_delta = 0;
slide_int = false;
slide_speed = 1 / 10;
@ -511,33 +512,38 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
var _defval = toNumber(_current_text);
slider_def_val = _defval;
slider_cur_val = _defval;
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
slidePen = PEN_USE;
if(!slidePen) {
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
}
sliding = 2;
}
if(sliding == 2) {
MOUSE_BLOCK = true;
CURSOR_LOCK = true;
if(!slidePen)
CURSOR_LOCK = true;
if(mouse_check_button_pressed(mb_right)) {
if(mouse_press(mb_right)) {
_input_text = string_real(slider_def_val);
sliding = 0;
apply();
deactivate();
UNDO_HOLDING = false;
} else {
MOUSE_BLOCK = true;
var _s = slide_speed;
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
if(key_mod_press(CTRL) && !slide_snap) _s *= 10;
if(key_mod_press(ALT)) _s /= 10;
@ -695,11 +701,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
}
if(slidable && mouse_press(mb_left, active)) {
sliding = 1;
sliding = 1;
slide_delta = 0;
slide_mx = _m[0];
slide_my = _m[1];
}
} else if(!hide)

View file

@ -2,7 +2,6 @@
var e; e = tabletstuff_get_event_data();
if (!ds_map_exists(e, "pointer_info_pen")) exit;
PEN_USE = true;
/*
See:
@ -22,11 +21,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
var ty = e[? "pointer_info_pen_tilt_y"];
PEN_X_DELTA = px - PEN_X;
PEN_Y_DELTA = px - PEN_Y;
PEN_Y_DELTA = py - PEN_Y;
PEN_X = px;
PEN_Y = py;
// print($"{PEN_X} | {PEN_X_DELTA}");
PEN_PRESSURE = pp;
var contact = bool(f & 0x4);
@ -43,3 +44,4 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
PEN_RIGHT_CLICK = b2;
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
PEN_USE = true;

View file

@ -63,6 +63,9 @@ _HOVERING_ELEMENT = noone;
PEN_RIGHT_PRESS = false;
PEN_RIGHT_RELEASE = false;
PEN_X_DELTA = 0;
PEN_Y_DELTA = 0;
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");

View file

@ -20,6 +20,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
slidable = false;
sliding = false;
slidePen = false;
slide_delta = 0;
slide_int = false;
slide_speed = 1 / 10;
@ -510,33 +511,38 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
var _defval = toNumber(_current_text);
slider_def_val = _defval;
slider_cur_val = _defval;
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
slidePen = PEN_USE;
if(!slidePen) {
CURSOR_LOCK_X = mouse_mx;
CURSOR_LOCK_Y = mouse_my;
}
sliding = 2;
}
if(sliding == 2) {
MOUSE_BLOCK = true;
CURSOR_LOCK = true;
if(!slidePen)
CURSOR_LOCK = true;
if(mouse_check_button_pressed(mb_right)) {
if(mouse_press(mb_right)) {
_input_text = string_real(slider_def_val);
sliding = 0;
apply();
deactivate();
UNDO_HOLDING = false;
} else {
MOUSE_BLOCK = true;
var _s = slide_speed;
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
if(key_mod_press(CTRL) && !slide_snap) _s *= 10;
if(key_mod_press(ALT)) _s /= 10;
@ -694,11 +700,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
}
if(slidable && mouse_press(mb_left, active)) {
sliding = 1;
sliding = 1;
slide_delta = 0;
slide_mx = _m[0];
slide_my = _m[1];
}
} else if(!hide)