mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-11 23:06:51 +01:00
textbox pen slide
This commit is contained in:
parent
1431137e82
commit
6b7e882eab
7 changed files with 76 additions and 56 deletions
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 11:59:25
|
// 2024-04-18 13:01:11
|
||||||
#event properties (no comments/etc. here are saved)
|
#event properties (no comments/etc. here are saved)
|
||||||
parent_index = -1;
|
parent_index = -1;
|
||||||
persistent = true;
|
persistent = true;
|
||||||
|
@ -653,6 +653,9 @@ _HOVERING_ELEMENT = noone;
|
||||||
PEN_RIGHT_PRESS = false;
|
PEN_RIGHT_PRESS = false;
|
||||||
PEN_RIGHT_RELEASE = false;
|
PEN_RIGHT_RELEASE = false;
|
||||||
|
|
||||||
|
PEN_X_DELTA = 0;
|
||||||
|
PEN_Y_DELTA = 0;
|
||||||
|
|
||||||
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
@ -1042,7 +1045,6 @@ PROJECT.modified = false;
|
||||||
|
|
||||||
var e; e = tabletstuff_get_event_data();
|
var e; e = tabletstuff_get_event_data();
|
||||||
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
||||||
PEN_USE = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
See:
|
See:
|
||||||
|
@ -1062,11 +1064,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
|
||||||
var ty = e[? "pointer_info_pen_tilt_y"];
|
var ty = e[? "pointer_info_pen_tilt_y"];
|
||||||
|
|
||||||
PEN_X_DELTA = px - PEN_X;
|
PEN_X_DELTA = px - PEN_X;
|
||||||
PEN_Y_DELTA = px - PEN_Y;
|
PEN_Y_DELTA = py - PEN_Y;
|
||||||
|
|
||||||
PEN_X = px;
|
PEN_X = px;
|
||||||
PEN_Y = py;
|
PEN_Y = py;
|
||||||
|
|
||||||
|
// print($"{PEN_X} | {PEN_X_DELTA}");
|
||||||
|
|
||||||
PEN_PRESSURE = pp;
|
PEN_PRESSURE = pp;
|
||||||
|
|
||||||
var contact = bool(f & 0x4);
|
var contact = bool(f & 0x4);
|
||||||
|
@ -1083,7 +1087,7 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
|
||||||
PEN_RIGHT_CLICK = b2;
|
PEN_RIGHT_CLICK = b2;
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
PEN_USE = true;
|
||||||
|
|
||||||
#event async_image
|
#event async_image
|
||||||
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;
|
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 11:59:03
|
// 2024-04-18 12:59:59
|
||||||
#event properties (no comments/etc. here are saved)
|
#event properties (no comments/etc. here are saved)
|
||||||
parent_index = -1;
|
parent_index = -1;
|
||||||
persistent = true;
|
persistent = true;
|
||||||
|
@ -653,6 +653,9 @@ _HOVERING_ELEMENT = noone;
|
||||||
PEN_RIGHT_PRESS = false;
|
PEN_RIGHT_PRESS = false;
|
||||||
PEN_RIGHT_RELEASE = false;
|
PEN_RIGHT_RELEASE = false;
|
||||||
|
|
||||||
|
PEN_X_DELTA = 0;
|
||||||
|
PEN_Y_DELTA = 0;
|
||||||
|
|
||||||
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
@ -1042,7 +1045,6 @@ PROJECT.modified = false;
|
||||||
|
|
||||||
var e; e = tabletstuff_get_event_data();
|
var e; e = tabletstuff_get_event_data();
|
||||||
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
||||||
PEN_USE = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
See:
|
See:
|
||||||
|
@ -1062,13 +1064,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
|
||||||
var ty = e[? "pointer_info_pen_tilt_y"];
|
var ty = e[? "pointer_info_pen_tilt_y"];
|
||||||
|
|
||||||
PEN_X_DELTA = px - PEN_X;
|
PEN_X_DELTA = px - PEN_X;
|
||||||
PEN_Y_DELTA = px - PEN_Y;
|
PEN_Y_DELTA = py - PEN_Y;
|
||||||
|
|
||||||
//print($"{PEN_X_DELTA}, {PEN_Y_DELTA}");
|
|
||||||
|
|
||||||
PEN_X = px;
|
PEN_X = px;
|
||||||
PEN_Y = py;
|
PEN_Y = py;
|
||||||
|
|
||||||
|
// print($"{PEN_X} | {PEN_X_DELTA}");
|
||||||
|
|
||||||
PEN_PRESSURE = pp;
|
PEN_PRESSURE = pp;
|
||||||
|
|
||||||
var contact = bool(f & 0x4);
|
var contact = bool(f & 0x4);
|
||||||
|
@ -1085,7 +1087,7 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
|
||||||
PEN_RIGHT_CLICK = b2;
|
PEN_RIGHT_CLICK = b2;
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
PEN_USE = true;
|
||||||
|
|
||||||
#event async_image
|
#event async_image
|
||||||
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;
|
if(!ds_map_exists(IMAGE_FETCH_MAP, async_load[? "id"])) exit;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 12:07:15
|
// 2024-04-18 13:00:44
|
||||||
enum TEXTBOX_INPUT {
|
enum TEXTBOX_INPUT {
|
||||||
text,
|
text,
|
||||||
number
|
number
|
||||||
|
@ -21,6 +21,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
slidable = false;
|
slidable = false;
|
||||||
sliding = false;
|
sliding = false;
|
||||||
|
slidePen = false;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
slide_int = false;
|
slide_int = false;
|
||||||
slide_speed = 1 / 10;
|
slide_speed = 1 / 10;
|
||||||
|
@ -512,17 +513,21 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
slider_def_val = _defval;
|
slider_def_val = _defval;
|
||||||
slider_cur_val = _defval;
|
slider_cur_val = _defval;
|
||||||
|
|
||||||
CURSOR_LOCK_X = mouse_mx;
|
slidePen = PEN_USE;
|
||||||
CURSOR_LOCK_Y = mouse_my;
|
|
||||||
|
if(!slidePen) {
|
||||||
|
CURSOR_LOCK_X = mouse_mx;
|
||||||
|
CURSOR_LOCK_Y = mouse_my;
|
||||||
|
}
|
||||||
|
|
||||||
sliding = 2;
|
sliding = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sliding == 2) {
|
if(sliding == 2) {
|
||||||
MOUSE_BLOCK = true;
|
if(!slidePen)
|
||||||
CURSOR_LOCK = true;
|
CURSOR_LOCK = true;
|
||||||
|
|
||||||
if(mouse_check_button_pressed(mb_right)) {
|
if(mouse_press(mb_right)) {
|
||||||
_input_text = string_real(slider_def_val);
|
_input_text = string_real(slider_def_val);
|
||||||
sliding = 0;
|
sliding = 0;
|
||||||
apply();
|
apply();
|
||||||
|
@ -531,10 +536,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
UNDO_HOLDING = false;
|
UNDO_HOLDING = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
MOUSE_BLOCK = true;
|
||||||
var _s = slide_speed;
|
var _s = slide_speed;
|
||||||
|
|
||||||
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
|
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
|
||||||
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
|
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
|
||||||
|
|
||||||
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
||||||
|
|
||||||
|
@ -695,11 +701,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slidable && mouse_press(mb_left, active)) {
|
if(slidable && mouse_press(mb_left, active)) {
|
||||||
sliding = 1;
|
sliding = 1;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
|
|
||||||
slide_mx = _m[0];
|
|
||||||
slide_my = _m[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(!hide)
|
} else if(!hide)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 12:00:32
|
// 2024-04-18 13:00:36
|
||||||
enum TEXTBOX_INPUT {
|
enum TEXTBOX_INPUT {
|
||||||
text,
|
text,
|
||||||
number
|
number
|
||||||
|
@ -21,6 +21,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
slidable = false;
|
slidable = false;
|
||||||
sliding = false;
|
sliding = false;
|
||||||
|
slidePen = false;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
slide_int = false;
|
slide_int = false;
|
||||||
slide_speed = 1 / 10;
|
slide_speed = 1 / 10;
|
||||||
|
@ -512,17 +513,21 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
slider_def_val = _defval;
|
slider_def_val = _defval;
|
||||||
slider_cur_val = _defval;
|
slider_cur_val = _defval;
|
||||||
|
|
||||||
CURSOR_LOCK_X = mouse_mx;
|
slidePen = PEN_USE;
|
||||||
CURSOR_LOCK_Y = mouse_my;
|
|
||||||
|
if(!slidePen) {
|
||||||
|
CURSOR_LOCK_X = mouse_mx;
|
||||||
|
CURSOR_LOCK_Y = mouse_my;
|
||||||
|
}
|
||||||
|
|
||||||
sliding = 2;
|
sliding = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sliding == 2) {
|
if(sliding == 2) {
|
||||||
MOUSE_BLOCK = true;
|
if(!slidePen)
|
||||||
CURSOR_LOCK = true;
|
CURSOR_LOCK = true;
|
||||||
|
|
||||||
if(mouse_check_button_pressed(mb_right)) {
|
if(mouse_press(mb_right)) {
|
||||||
_input_text = string_real(slider_def_val);
|
_input_text = string_real(slider_def_val);
|
||||||
sliding = 0;
|
sliding = 0;
|
||||||
apply();
|
apply();
|
||||||
|
@ -531,10 +536,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
UNDO_HOLDING = false;
|
UNDO_HOLDING = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
MOUSE_BLOCK = true;
|
||||||
var _s = slide_speed;
|
var _s = slide_speed;
|
||||||
|
|
||||||
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
|
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
|
||||||
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
|
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
|
||||||
|
|
||||||
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
||||||
|
|
||||||
|
@ -695,11 +701,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slidable && mouse_press(mb_left, active)) {
|
if(slidable && mouse_press(mb_left, active)) {
|
||||||
sliding = 1;
|
sliding = 1;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
|
|
||||||
slide_mx = _m[0];
|
|
||||||
slide_my = _m[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(!hide)
|
} else if(!hide)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
var e; e = tabletstuff_get_event_data();
|
var e; e = tabletstuff_get_event_data();
|
||||||
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
if (!ds_map_exists(e, "pointer_info_pen")) exit;
|
||||||
PEN_USE = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
See:
|
See:
|
||||||
|
@ -22,11 +21,13 @@ var tx = e[? "pointer_info_pen_tilt_x"];
|
||||||
var ty = e[? "pointer_info_pen_tilt_y"];
|
var ty = e[? "pointer_info_pen_tilt_y"];
|
||||||
|
|
||||||
PEN_X_DELTA = px - PEN_X;
|
PEN_X_DELTA = px - PEN_X;
|
||||||
PEN_Y_DELTA = px - PEN_Y;
|
PEN_Y_DELTA = py - PEN_Y;
|
||||||
|
|
||||||
PEN_X = px;
|
PEN_X = px;
|
||||||
PEN_Y = py;
|
PEN_Y = py;
|
||||||
|
|
||||||
|
// print($"{PEN_X} | {PEN_X_DELTA}");
|
||||||
|
|
||||||
PEN_PRESSURE = pp;
|
PEN_PRESSURE = pp;
|
||||||
|
|
||||||
var contact = bool(f & 0x4);
|
var contact = bool(f & 0x4);
|
||||||
|
@ -43,3 +44,4 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
|
||||||
PEN_RIGHT_CLICK = b2;
|
PEN_RIGHT_CLICK = b2;
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
PEN_USE = true;
|
|
@ -63,6 +63,9 @@ _HOVERING_ELEMENT = noone;
|
||||||
PEN_RIGHT_PRESS = false;
|
PEN_RIGHT_PRESS = false;
|
||||||
PEN_RIGHT_RELEASE = false;
|
PEN_RIGHT_RELEASE = false;
|
||||||
|
|
||||||
|
PEN_X_DELTA = 0;
|
||||||
|
PEN_Y_DELTA = 0;
|
||||||
|
|
||||||
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
|
|
|
@ -20,6 +20,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
slidable = false;
|
slidable = false;
|
||||||
sliding = false;
|
sliding = false;
|
||||||
|
slidePen = false;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
slide_int = false;
|
slide_int = false;
|
||||||
slide_speed = 1 / 10;
|
slide_speed = 1 / 10;
|
||||||
|
@ -511,17 +512,21 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
slider_def_val = _defval;
|
slider_def_val = _defval;
|
||||||
slider_cur_val = _defval;
|
slider_cur_val = _defval;
|
||||||
|
|
||||||
CURSOR_LOCK_X = mouse_mx;
|
slidePen = PEN_USE;
|
||||||
CURSOR_LOCK_Y = mouse_my;
|
|
||||||
|
if(!slidePen) {
|
||||||
|
CURSOR_LOCK_X = mouse_mx;
|
||||||
|
CURSOR_LOCK_Y = mouse_my;
|
||||||
|
}
|
||||||
|
|
||||||
sliding = 2;
|
sliding = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sliding == 2) {
|
if(sliding == 2) {
|
||||||
MOUSE_BLOCK = true;
|
if(!slidePen)
|
||||||
CURSOR_LOCK = true;
|
CURSOR_LOCK = true;
|
||||||
|
|
||||||
if(mouse_check_button_pressed(mb_right)) {
|
if(mouse_press(mb_right)) {
|
||||||
_input_text = string_real(slider_def_val);
|
_input_text = string_real(slider_def_val);
|
||||||
sliding = 0;
|
sliding = 0;
|
||||||
apply();
|
apply();
|
||||||
|
@ -530,10 +535,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
UNDO_HOLDING = false;
|
UNDO_HOLDING = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
MOUSE_BLOCK = true;
|
||||||
var _s = slide_speed;
|
var _s = slide_speed;
|
||||||
|
|
||||||
var _mdx = PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x();
|
var _mdx = slidePen? PEN_X_DELTA : window_mouse_get_delta_x();
|
||||||
var _mdy = PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();
|
var _mdy = slidePen? PEN_Y_DELTA : window_mouse_get_delta_y();
|
||||||
|
|
||||||
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
|
||||||
|
|
||||||
|
@ -694,11 +700,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slidable && mouse_press(mb_left, active)) {
|
if(slidable && mouse_press(mb_left, active)) {
|
||||||
sliding = 1;
|
sliding = 1;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
|
|
||||||
slide_mx = _m[0];
|
|
||||||
slide_my = _m[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(!hide)
|
} else if(!hide)
|
||||||
|
|
Loading…
Reference in a new issue