This commit is contained in:
Tanasart 2023-12-05 15:51:24 +07:00
parent 9d8718e8b5
commit b65a2f685c
23 changed files with 1262 additions and 1080 deletions

View file

@ -317,6 +317,7 @@
{"name":"sh_perlin_smear","order":5,"path":"shaders/sh_perlin_smear/sh_perlin_smear.yy",},
{"name":"node_array_remove","order":4,"path":"scripts/node_array_remove/node_array_remove.yy",},
{"name":"node_path_blend","order":2,"path":"scripts/node_path_blend/node_path_blend.yy",},
{"name":"rotator_Rotator","order":3,"path":"objects/rotator_Rotator/rotator_Rotator.yy",},
{"name":"node_switch","order":5,"path":"scripts/node_switch/node_switch.yy",},
{"name":"sh_corner","order":20,"path":"shaders/sh_corner/sh_corner.yy",},
{"name":"node_array","order":5,"path":"scripts/node_array/node_array.yy",},
@ -736,7 +737,7 @@
{"name":"s_node_surface_from_buffer","order":1,"path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",},
{"name":"node_iterator_filter_output","order":2,"path":"scripts/node_iterator_filter_output/node_iterator_filter_output.yy",},
{"name":"color_function","order":9,"path":"scripts/color_function/color_function.yy",},
{"name":"o_dialog_textbox_slider","order":9,"path":"objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy",},
{"name":"textBox_slider","order":16,"path":"objects/textBox_slider/textBox_slider.yy",},
{"name":"fd_rectangle_set_pressure_size","order":11,"path":"scripts/fd_rectangle_set_pressure_size/fd_rectangle_set_pressure_size.yy",},
{"name":"s_node_smokeSim_group","order":12,"path":"sprites/s_node_smokeSim_group/s_node_smokeSim_group.yy",},
{"name":"node_color_data","order":6,"path":"scripts/node_color_data/node_color_data.yy",},
@ -1802,6 +1803,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_dynamic_surface_out","order":1,"path":"scripts/node_dynamic_surface_out/node_dynamic_surface_out.yy",},
{"name":"slider_Slider","order":37,"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

@ -892,6 +892,7 @@
{"id":{"name":"node_iterate_filter","path":"scripts/node_iterate_filter/node_iterate_filter.yy",},},
{"id":{"name":"node_array_remove","path":"scripts/node_array_remove/node_array_remove.yy",},},
{"id":{"name":"node_path_blend","path":"scripts/node_path_blend/node_path_blend.yy",},},
{"id":{"name":"rotator_Rotator","path":"objects/rotator_Rotator/rotator_Rotator.yy",},},
{"id":{"name":"node_switch","path":"scripts/node_switch/node_switch.yy",},},
{"id":{"name":"sh_corner","path":"shaders/sh_corner/sh_corner.yy",},},
{"id":{"name":"node_array","path":"scripts/node_array/node_array.yy",},},
@ -1373,7 +1374,7 @@
{"id":{"name":"s_node_surface_from_buffer","path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",},},
{"id":{"name":"node_iterator_filter_output","path":"scripts/node_iterator_filter_output/node_iterator_filter_output.yy",},},
{"id":{"name":"color_function","path":"scripts/color_function/color_function.yy",},},
{"id":{"name":"o_dialog_textbox_slider","path":"objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy",},},
{"id":{"name":"textBox_slider","path":"objects/textBox_slider/textBox_slider.yy",},},
{"id":{"name":"d3d_cube_faces","path":"scripts/d3d_cube_faces/d3d_cube_faces.yy",},},
{"id":{"name":"fd_rectangle_set_pressure_size","path":"scripts/fd_rectangle_set_pressure_size/fd_rectangle_set_pressure_size.yy",},},
{"id":{"name":"s_node_smokeSim_group","path":"sprites/s_node_smokeSim_group/s_node_smokeSim_group.yy",},},
@ -2597,6 +2598,7 @@
{"id":{"name":"node_array_shuffle","path":"scripts/node_array_shuffle/node_array_shuffle.yy",},},
{"id":{"name":"panel_node_data_gen","path":"scripts/panel_node_data_gen/panel_node_data_gen.yy",},},
{"id":{"name":"node_dynamic_surface_out","path":"scripts/node_dynamic_surface_out/node_dynamic_surface_out.yy",},},
{"id":{"name":"slider_Slider","path":"objects/slider_Slider/slider_Slider.yy",},},
{"id":{"name":"fd_rectangle_update_material","path":"scripts/fd_rectangle_update_material/fd_rectangle_update_material.yy",},},
{"id":{"name":"s_node_array_convolute","path":"sprites/s_node_array_convolute/s_node_array_convolute.yy",},},
{"id":{"name":"sh_perlin_tiled","path":"shaders/sh_perlin_tiled/sh_perlin_tiled.yy",},},

Binary file not shown.

View file

@ -232,7 +232,7 @@
DIALOGS = ds_list_create();
WIDGET_TAB_BLOCK = false;
instance_create(0, 0, o_dialog_textbox_slider);
instance_create(0, 0, textBox_slider);
instance_create(0, 0, o_dialog_textbox_autocomplete);
instance_create(0, 0, o_dialog_textbox_function_guide);
#endregion

View file

@ -0,0 +1,24 @@
/// @description Insert description here
drag_mx = mouse_mx;
drag_my = mouse_my;
drag_sx = 0;
drag_sy = 0;
drag_cx = 0;
drag_cy = 0;
drag_sa = 0;
delta = 0;
delta_acc = 0;
function init(_m, cx, cy) {
drag_sx = _m[0];
drag_sy = _m[1];
drag_cx = cx;
drag_cy = cy;
drag_sa = point_direction(drag_cx, drag_cy, drag_sx, drag_sy);
return self;
}

View file

@ -0,0 +1,14 @@
/// @description Insert description here
var dx = mouse_mx - drag_mx;
var dy = mouse_my - drag_my;
drag_mx = mouse_mx;
drag_my = mouse_my;
drag_sx += dx;
drag_sy += dy;
var _dirr = point_direction(drag_cx, drag_cy, drag_sx, drag_sy);
delta = angle_difference(_dirr, drag_sa);
delta_acc += delta;
drag_sa = _dirr;

View file

@ -0,0 +1,34 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "rotator_Rotator",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,},
],
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "rotator",
"path": "folders/widgets/rotator.yy",
},
"parentObjectId": null,
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 1,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": [],
"physicsStartAwake": true,
"properties": [],
"solid": false,
"spriteId": null,
"spriteMaskId": null,
"visible": true,
}

View file

@ -0,0 +1,5 @@
/// @description slider
drag_mx = mouse_mx;
drag_sx = 0;
drag_msx = 0;
drag_sw = 0;

View file

@ -0,0 +1,4 @@
/// @description Insert description here
var dx = mouse_mx - drag_mx;
drag_mx = mouse_mx;
drag_sx += dx;

View file

@ -0,0 +1,34 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "slider_Slider",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,},
],
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "widgets",
"path": "folders/widgets.yy",
},
"parentObjectId": null,
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 1,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": [],
"physicsStartAwake": true,
"properties": [],
"solid": false,
"spriteId": null,
"spriteMaskId": null,
"visible": true,
}

View file

@ -1,6 +1,7 @@
/// @description
depth = -19999;
tb = noone;
depth = -19999;
tb = noone;
val = 0;
function activate() {
slide_da = -1;

View file

@ -17,23 +17,24 @@ if(slide_da == -1) {
exit;
}
var _s = tb.slide_speed;
if(!MOUSE_WRAPPING) {
var _adx = mouse_mx - slide_dx;
var _ady = slide_dy - mouse_my;
var _s = tb.slide_speed;
var sc = 10;
if(key_mod_press(CTRL)) _s *= sc;
if(key_mod_press(ALT)) _s /= sc;
var spd = (slide_da? _ady : _adx) * _s;
var _val = value_snap(tb.slide_sv + spd, _s);
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
var spd = (slide_da? _ady : _adx) * _s;
val = value_snap(tb.slide_sv + spd, _s);
var _stp_sz = 50 * _s;
var _stp_fl = round(_val / _stp_sz) * _stp_sz;
var _stp_md = _val - _stp_fl;
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++ ) {
@ -42,9 +43,9 @@ if(!MOUSE_WRAPPING) {
}
var _snp_s = 50 * _s;
var _snp_v = round(_val / _snp_s) * _snp_s;
if(abs(_val - _snp_v) < 5 * _s)
_val = _snp_v;
var _snp_v = round(val / _snp_s) * _snp_s;
if(abs(val - _snp_v) < 5 * _s)
val = _snp_v;
if(slide_da) {
var _sdw = _tw;
@ -62,9 +63,9 @@ if(!MOUSE_WRAPPING) {
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_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(1);
draw_text(slide_dx, slide_dy - (_val - tb.slide_sv) / _s, _val);
draw_text(slide_dx, slide_dy - (val - tb.slide_sv) / _s, val);
} else {
var _sdw = 240;
var _sdh = 48;
@ -81,18 +82,18 @@ if(!MOUSE_WRAPPING) {
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_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text);
draw_set_alpha(1);
draw_text(slide_dx + (_val - tb.slide_sv) / _s, slide_dy, _val);
draw_text(slide_dx + (val - tb.slide_sv) / _s, slide_dy, val);
}
tb._input_text = string_real(_val);
tb._input_text = string_real(val);
if(tb.apply()) UNDO_HOLDING = true;
}
if(MOUSE_WRAPPING) {
slide_dx = mouse_mx;
slide_dy = mouse_my;
if(slide_da) slide_dy = mouse_my + (val - tb.slide_sv) / _s;
else slide_dx = mouse_mx - (val - tb.slide_sv) / _s;
}
setMouseWrap();

View file

@ -1,7 +1,7 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "o_dialog_textbox_slider",
"name": "textBox_slider",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
@ -9,8 +9,8 @@
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "widget",
"path": "folders/dialog/widget.yy",
"name": "text",
"path": "folders/widgets/text.yy",
},
"parentObjectId": null,
"persistent": false,

View file

@ -1,9 +1,9 @@
function draw_circle_prec(x, y, r, border, precision = 32) {
function draw_circle_prec(x, y, r, border, precision = 32) { #region
draw_set_circle_precision(precision);
draw_circle(x, y, r, border);
}
} #endregion
function draw_circle_border(xx, yy, r, w) {
function draw_circle_border(xx, yy, r, w) { #region
var step = 32;
var angle_step = 360 / step;
@ -18,9 +18,9 @@ function draw_circle_border(xx, yy, r, w) {
draw_vertex(p1x, p1y);
}
draw_primitive_end();
}
} #endregion
function draw_ellipse_border(x0, y0, x1, y1, w) {
function draw_ellipse_border(x0, y0, x1, y1, w) { #region
var step = 32;
var angle_step = 360 / step;
@ -41,9 +41,9 @@ function draw_ellipse_border(x0, y0, x1, y1, w) {
_px = px;
_py = py;
}
}
} #endregion
function draw_circle_angle(_x, _y, _r, _angSt, _angEd, precision = 32) {
function draw_circle_angle(_x, _y, _r, _angSt, _angEd, precision = 32) { #region
var ox, oy, nx, ny, oa, na;
draw_primitive_begin(pr_trianglelist);
@ -65,9 +65,9 @@ function draw_circle_angle(_x, _y, _r, _angSt, _angEd, precision = 32) {
}
draw_primitive_end();
}
} #endregion
function draw_arc_width(_x, _y, _r, _th, _angSt, _angEd) {
function draw_arc_width(_x, _y, _r, _th, _angSt, _angEd) { #region
draw_primitive_begin(pr_trianglelist);
var oxI, oyI, oxO, oyO;
@ -99,4 +99,38 @@ function draw_arc_width(_x, _y, _r, _th, _angSt, _angEd) {
}
draw_primitive_end();
}
} #endregion
function draw_arc_forward(_x, _y, _r, _th, _angSt, _angEd) { #region
draw_primitive_begin(pr_trianglelist);
var oxI, oyI, oxO, oyO;
var _aSt = min(_angSt, _angEd);
var _aEd = max(_angSt, _angEd);
var diff = _aEd - _aSt;
for(var i = 0; i <= abs(diff); i += 4) {
var as = _aSt + i * sign(diff);
var nxI = _x + lengthdir_x(_r - _th / 2, as);
var nyI = _y + lengthdir_y(_r - _th / 2, as);
var nxO = _x + lengthdir_x(_r + _th / 2, as);
var nyO = _y + lengthdir_y(_r + _th / 2, as);
if(i) {
draw_vertex(oxI, oyI);
draw_vertex(oxO, oyO);
draw_vertex(nxI, nyI);
draw_vertex(oxO, oyO);
draw_vertex(nxI, nyI);
draw_vertex(nxO, nyO);
}
oxI = nxI;
oyI = nyI;
oxO = nxO;
oyO = nyO;
}
draw_primitive_end();
} #endregion

View file

@ -1,24 +1,28 @@
function mouse_click(mouse, focus = true) {
INLINE
return focus && mouse_check_button(mouse);
}
function mouse_press(mouse, focus = true) {
INLINE
return focus && mouse_check_button_pressed(mouse);
}
function mouse_release(mouse, focus = true) {
INLINE
return focus && mouse_check_button_released(mouse);
}
#region mouse global
globalvar MOUSE_WRAP, MOUSE_WRAPPING;
MOUSE_WRAP = false;
MOUSE_WRAP = false;
MOUSE_WRAPPING = false;
#macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed
function setMouseWrap() {
INLINE
MOUSE_WRAP = true;
}
#endregion

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
step = _step;
scale = 1;
dragging = false;
dragging = noone;
drag_sv = 0;
drag_sa = 0;
real_val = 0;
slide_speed = 1 / 10;
@ -16,21 +15,21 @@ function rotator(_onModify, _step = -1) : widget() constructor {
halign = fa_center;
static setInteract = function(interactable = noone) {
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_value.interactable = interactable;
}
} #endregion
static register = function(parent = noone) {
static register = function(parent = noone) { #region
tb_value.register(parent);
}
} #endregion
static drawParam = function(params) {
static drawParam = function(params) { #region
halign = params.halign;
return draw(params.x, params.y, params.w, params.data, params.m);
}
} #endregion
static draw = function(_x, _y, _w, _data, _m, draw_tb = true) {
static draw = function(_x, _y, _w, _data, _m, draw_tb = true) { #region
x = _x;
y = _y;
w = _w;
@ -60,12 +59,10 @@ function rotator(_onModify, _step = -1) : widget() constructor {
var py = knob_y + lengthdir_y(_r, _data);
if(dragging) {
var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa);
var real_val = round(delta + drag_sv);
var real_val = round(dragging.delta_acc + drag_sv);
var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
if(step != -1)
val = round(real_val / step) * step;
if(step != -1) val = round(real_val / step) * step;
draw_sprite(spr_knob, 1, px, py);
@ -74,11 +71,9 @@ function rotator(_onModify, _step = -1) : widget() constructor {
UNDO_HOLDING = true;
}
drag_sa = point_direction(_x, knob_y, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = false;
instance_destroy(dragging);
dragging = noone;
UNDO_HOLDING = false;
}
@ -86,9 +81,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
draw_sprite(spr_knob, 1, px, py);
if(mouse_press(mb_left, active)) {
dragging = true;
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _x, knob_y);
drag_sv = _data;
drag_sa = point_direction(_x, knob_y, _m[0], _m[1]);
}
var amo = 1;
@ -106,5 +100,5 @@ function rotator(_onModify, _step = -1) : widget() constructor {
resetFocus();
return h;
}
} #endregion
}

View file

@ -1,9 +1,9 @@
function rotatorRandom(_onModify) : widget() constructor {
onModify = _onModify;
dragging = -1;
dragging = false;
dragging_index = -1;
drag_sv = 0;
drag_sa = 0;
mode = 0;
tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable(true, 1);
@ -18,28 +18,28 @@ function rotatorRandom(_onModify) : widget() constructor {
__txtx("widget_rotator_random_double_span", "Double Span")
]);
static setInteract = function(interactable = noone) {
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_min_0.interactable = interactable;
tb_max_0.interactable = interactable;
if(mode == 2 || mode == 3) tb_min_1.interactable = interactable;
if(mode == 2) tb_max_1.interactable = interactable;
}
} #endregion
static register = function(parent = noone) {
static register = function(parent = noone) { #region
tb_min_0.register(parent);
tb_max_0.register(parent);
if(mode == 2 || mode == 3) tb_min_1.register(parent);
if(mode == 2) tb_max_1.register(parent);
}
} #endregion
static drawParam = function(params) {
static drawParam = function(params) { #region
return draw(params.x, params.y, params.w, params.data, params.m);
}
} #endregion
static draw = function(_x, _y, _w, _data, _m) {
static draw = function(_x, _y, _w, _data, _m) { #region
x = _x;
y = _y;
w = _w;
@ -98,7 +98,7 @@ function rotatorRandom(_onModify) : widget() constructor {
#region draw arc
var hover_arc = false;
var diss = point_distance(_m[0], _m[1], knx, kny);
if(abs(diss - _r) < 6 || dragging == 2)
if(abs(diss - _r) < 6 || dragging_index == 2)
hover_arc = true;
for(var i = 0; i < 2; i++) {
@ -113,68 +113,73 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 0, px[i], py[i]);
#endregion
if(dragging > -1) { #region
if(dragging_index > -1) { #region
var val = point_direction(knx, kny, _m[0], _m[1]);
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
var delta = angle_difference(point_direction(knx, kny, _m[0], _m[1]), drag_sa);
var val, real_val = drag_sv;
var val;
if(dragging == 2) {
var modi = false;
real_val[1] = round(delta + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
if(dragging_index == 2) {
var curr_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
var modi = false;
curr_val[1] = round(dragging.delta_acc + drag_sv[1]);
curr_val[2] = round(dragging.delta_acc + drag_sv[2]);
val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1];
modi |= onModify(1, val);
real_val[2] = round(delta + drag_sv[2]);
val = key_mod_press(CTRL)? round(real_val[2] / 15) * 15 : real_val[2];
val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2];
modi |= onModify(2, val);
if(modi) UNDO_HOLDING = true;
} else {
var _o = _data[dragging];
real_val = round(delta + drag_sv);
val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
draw_sprite(THEME.rotator_knob, 1, px[dragging], py[dragging]);
if(_data[dragging] != val) {
var _o = _data[dragging_index];
var curr_val = round(dragging.delta_acc + drag_sv);
val = key_mod_press(CTRL)? round(curr_val / 15) * 15 : curr_val;
draw_sprite(THEME.rotator_knob, 1, px[dragging_index], py[dragging_index]);
if(_data[dragging_index] != val) {
var modi = false;
modi |= onModify(1 + dragging, val);
modi |= onModify(1 + dragging_index, val);
if(key_mod_press(ALT)) {
var dt = val - _o;
modi |= onModify(1 + !dragging, _data[!dragging] - dt);
modi |= onModify(1 + !dragging_index, _data[!dragging_index] - dt);
}
if(modi) UNDO_HOLDING = true;
}
}
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = -1;
UNDO_HOLDING = false;
instance_destroy(dragging);
dragging = noone;
dragging_index = -1;
UNDO_HOLDING = false;
}
#endregion
} else if(hover) { #region
for(var i = 0; i < 2; i++) {
if(point_in_circle(_m[0], _m[1], px[i], py[i], ui(20))) {
draw_sprite(THEME.rotator_knob, 1, px[i], py[i]);
if(mouse_press(mb_left, active)) {
dragging = i;
dragging_index = i;
drag_sv = _data[1 + i];
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
dragging = instance_create(0, 0, rotator_Rotator).init(_m, knx, kny);
}
}
}
if(dragging == -1 && hover_arc && mouse_press(mb_left, active)) {
dragging = 2;
drag_sv = _data;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
if(dragging_index == -1 && hover_arc && mouse_press(mb_left, active)) {
dragging_index = 2;
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
dragging = instance_create(0, 0, rotator_Rotator).init(_m, knx, kny);
}
#endregion
}
@ -206,34 +211,33 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 0, px[i], py[i]);
#endregion
if(dragging > -1) { #region
if(dragging_index > -1) { #region
var val = point_direction(knx, kny, _m[0], _m[1]);
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
var delta = angle_difference(point_direction(knx, kny, _m[0], _m[1]), drag_sa);
var val, real_val = drag_sv;
var val;
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
if(dragging == 2) {
real_val[1] = round(delta + drag_sv[1]);
if(dragging_index == 2) {
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
draw_sprite(THEME.rotator_knob, 1, px[2], py[2]);
if(onModify(1, val)) UNDO_HOLDING = true;
} else {
real_val[2] = round(drag_sv[2] + (delta * (dragging? 1 : -1)));
real_val[2] = round(drag_sv[2] + (dragging.delta_acc * (dragging_index? 1 : -1)));
val = key_mod_press(CTRL)? round(real_val[2] / 15) * 15 : real_val[2];
draw_sprite(THEME.rotator_knob, 1, px[dragging], py[dragging]);
draw_sprite(THEME.rotator_knob, 1, px[dragging_index], py[dragging_index]);
if(onModify(2, val)) UNDO_HOLDING = true;
}
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = -1;
instance_destroy(dragging);
dragging = noone;
dragging_index = -1;
UNDO_HOLDING = false;
}
#endregion
@ -243,9 +247,9 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 1, px[i], py[i]);
if(mouse_press(mb_left, active)) {
dragging = i;
drag_sv = _data;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
dragging_index = i;
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
dragging = instance_create(0, 0, rotator_Rotator).init(_m, knx, kny);
}
}
}
@ -289,26 +293,25 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 0, px[i], py[i]);
#endregion
if(dragging > -1) { #region
if(dragging_index > -1) { #region
var val = point_direction(knx, kny, _m[0], _m[1]);
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
var delta = angle_difference(point_direction(knx, kny, _m[0], _m[1]), drag_sa);
var val, real_val = drag_sv;
var ind = dragging + 1;
var val;
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
var ind = dragging_index + 1;
real_val[ind] = round(drag_sv[ind] + (delta * (ind? 1 : -1)));
real_val[ind] = round(drag_sv[ind] + (dragging.delta_acc * (ind? 1 : -1)));
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
draw_sprite(THEME.rotator_knob, 1, px[dragging], py[dragging]);
draw_sprite(THEME.rotator_knob, 1, px[dragging_index], py[dragging_index]);
if(onModify(ind, val)) UNDO_HOLDING = true;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = -1;
instance_destroy(dragging);
dragging = noone;
dragging_index = -1;
UNDO_HOLDING = false;
}
#endregion
@ -318,9 +321,9 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 1, px[i], py[i]);
if(mouse_press(mb_left, active)) {
dragging = i;
drag_sv = _data;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
dragging_index = i;
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
dragging = instance_create(0, 0, rotator_Rotator).init(_m, knx, kny);
}
}
}
@ -371,26 +374,25 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 0, px[1], py[1]);
#endregion
if(dragging > -1) { #region
if(dragging_index > -1) { #region
var val = point_direction(knx, kny, _m[0], _m[1]);
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
var delta = angle_difference(point_direction(knx, kny, _m[0], _m[1]), drag_sa);
var val, real_val = drag_sv;
var ind = dragging + 1;
var real_val = [ drag_sv[0], drag_sv[1], drag_sv[2], drag_sv[3], drag_sv[4] ];
var val;
var ind = dragging_index + 1;
real_val[ind] = round(drag_sv[ind] + (delta * (ind? 1 : -1)));
real_val[ind] = round(drag_sv[ind] + (dragging.delta_acc * (ind? 1 : -1)));
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
draw_sprite(THEME.rotator_knob, 1, px[dragging], py[dragging]);
draw_sprite(THEME.rotator_knob, 1, px[dragging_index], py[dragging_index]);
if(onModify(ind, val)) UNDO_HOLDING = true;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = -1;
instance_destroy(dragging);
dragging = noone;
dragging_index = -1;
UNDO_HOLDING = false;
}
#endregion
@ -400,9 +402,9 @@ function rotatorRandom(_onModify) : widget() constructor {
draw_sprite(THEME.rotator_knob, 1, px[i], py[i]);
if(mouse_press(mb_left, active)) {
dragging = i;
drag_sv = _data;
drag_sa = point_direction(knx, kny, _m[0], _m[1]);
dragging_index = i;
drag_sv = [ _data[0], _data[1], _data[2], _data[3], _data[4] ];
dragging = instance_create(0, 0, rotator_Rotator).init(_m, knx, kny);
}
}
}
@ -414,5 +416,5 @@ function rotatorRandom(_onModify) : widget() constructor {
resetFocus();
return h;
}
} #endregion
}

View file

@ -1,31 +1,30 @@
function rotatorRange(_onModify) : widget() constructor {
onModify = _onModify;
dragging = -1;
dragging_index = -1;
dragging = noone;
drag_sv = 0;
drag_sa = 0;
drag_sc = 0;
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ).setSlidable();
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable();
static setInteract = function(interactable = noone) {
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_min.interactable = interactable;
tb_max.interactable = interactable;
}
} #endregion
static register = function(parent = noone) {
static register = function(parent = noone) { #region
tb_min.register(parent);
tb_max.register(parent);
}
} #endregion
static drawParam = function(params) {
static drawParam = function(params) { #region
return draw(params.x, params.y, params.w, params.data, params.m);
}
} #endregion
static draw = function(_x, _y, _w, _data, _m) {
static draw = function(_x, _y, _w, _data, _m) { #region
x = _x;
y = _y;
w = _w;
@ -60,95 +59,89 @@ function rotatorRange(_onModify) : widget() constructor {
#region draw arc
var hover_arc = false;
var diss = point_distance(_m[0], _m[1], _x, knob_y);
if(abs(diss - _r) < 6 || dragging == 2)
if(abs(diss - _r) < 6 || dragging_index == 2)
hover_arc = true;
for(var i = 0; i < 2; i++) {
if(point_in_circle(_m[0], _m[1], px[i], py[i], ui(20)))
hover_arc = false;
}
draw_set_color(hover_arc? COLORS.widget_rotator_range_hover : COLORS.widget_rotator_range);
draw_arc_width(_x, knob_y, _r, 3, _data[0], _data[1]);
draw_arc_forward(_x, knob_y, _r, 3, _data[0], _data[1]);
#endregion
for(var i = 0; i < 2; i++)
draw_sprite(THEME.rotator_knob, 0, px[i], py[i]);
if(dragging > -1) {
if(dragging_index > -1) { #region
var val = point_direction(_x, knob_y, _m[0], _m[1]);
if(key_mod_press(CTRL)) val = round(val / 15) * 15;
var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa);
var val, real_val;
if(dragging == 2) {
if(dragging_index == 2) {
var modi = false;
real_val[0] = round(delta + drag_sv[0]);
val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0];
real_val[0] = round(dragging.delta_acc + drag_sv[0]);
real_val[1] = round(dragging.delta_acc + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0];
modi |= onModify(0, val);
real_val[1] = round(delta + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
modi |= onModify(1, val);
if(modi)
UNDO_HOLDING = true;
if(modi) UNDO_HOLDING = true;
} else {
var _o = _data[dragging];
real_val = round(delta + drag_sv);
var _o = _data[dragging_index];
real_val = round(dragging.delta_acc + drag_sv);
val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
draw_sprite(THEME.rotator_knob, 1, px[dragging], py[dragging]);
draw_sprite(THEME.rotator_knob, 1, px[dragging_index], py[dragging_index]);
if(_data[dragging] != val) {
if(_data[dragging_index] != val) {
var modi = false;
modi |= onModify(dragging, val);
modi |= onModify(dragging_index, val);
if(key_mod_press(ALT)) {
var dt = val - _o;
modi |= onModify(!dragging, _data[!dragging] - dt);
modi |= onModify(!dragging_index, _data[!dragging_index] - dt);
}
if(modi)
UNDO_HOLDING = true;
if(modi) UNDO_HOLDING = true;
}
drag_sv = real_val;
}
drag_sa = point_direction(_x, knob_y, _m[0], _m[1]);
drag_sv = real_val;
if(mouse_release(mb_left)) {
dragging = -1;
instance_destroy(dragging);
dragging = noone;
dragging_index = -1;
UNDO_HOLDING = false;
}
} else if(hover) {
#endregion
} else if(hover) { #region
for(var i = 0; i < 2; i++) {
if(point_in_circle(_m[0], _m[1], px[i], py[i], ui(20))) {
draw_sprite(THEME.rotator_knob, 1, px[i], py[i]);
if(mouse_press(mb_left, active)) {
dragging = i;
dragging_index = i;
drag_sv = _data[i];
drag_sa = point_direction(_x, knob_y, _m[0], _m[1]);
drag_sc = lerp_angle(_data[0], _data[1], 0.5);
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _x, knob_y);
}
}
}
if(dragging == -1 && hover_arc && mouse_press(mb_left, active)) {
dragging = 2;
drag_sv = _data;
drag_sa = point_direction(_x, knob_y, _m[0], _m[1]);
if(dragging_index == -1 && hover_arc && mouse_press(mb_left, active)) {
dragging_index = 2;
drag_sv = [ _data[0], _data[1] ];
dragging = instance_create(0, 0, rotator_Rotator).init(_m, _x, knob_y);
}
}
//draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
//draw_text(_x, knob_y - ui(8), string(_data[0]));
//draw_text(_x, knob_y + ui(8), string(_data[1]));
} #endregion
resetFocus();
return h;
}
} #endregion
}

View file

@ -21,13 +21,9 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
update_stat = SLIDER_UPDATE.realtime;
dragging = false;
drag_mx = 0;
drag_sx = 0;
spr = THEME.slider;
blend = c_white;
spr = THEME.slider;
blend = c_white;
dragging = noone;
handle_w = ui(20);
tb_value = new textBox(TEXTBOX_INPUT.number, onApply);
@ -37,24 +33,24 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
onModify(value);
} #endregion
static setSlideSpeed = function(speed) {
static setSlideSpeed = function(speed) { #region
tb_value.setSlidable(speed);
}
} #endregion
static setInteract = function(interactable = noone) {
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_value.interactable = interactable;
}
} #endregion
static register = function(parent = noone) {
static register = function(parent = noone) { #region
tb_value.register(parent);
}
} #endregion
static drawParam = function(params) {
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, tb_w = 64, halign = fa_left, valign = fa_top) {
static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 64, halign = fa_left, valign = fa_top) { #region
x = _x;
y = _y;
w = _w;
@ -63,17 +59,17 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(!dragging) current_value = _data;
switch(halign) {
switch(halign) { #region
case fa_left: _x = _x; break;
case fa_center: _x = _x - _w / 2; break;
case fa_right: _x = _x - _w; break;
}
} #endregion
switch(valign) {
switch(valign) { #region
case fa_top: _y = _y; break;
case fa_center: _y = _y - _h / 2; break;
case fa_bottom: _y = _y - _h; break;
}
} #endregion
var _rang = abs(maxx - minn);
if(!dragging) {
@ -94,7 +90,15 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(THEME_VALUE.slider_type == "full_height")
draw_sprite_stretched_ext(spr, 0, _x, _y, sw, _h, blend, 1);
else if(THEME_VALUE.slider_type == "stem")
draw_sprite_stretched_ext(spr, 0, _x, _y + _h / 2 - ui(4), sw, ui(8), blend, 1);
draw_sprite_stretched_ext(spr, 0, _x - ui(4), _y + _h / 2 - ui(4), sw + ui(8), ui(8), blend, 1);
if(stepSize >= 1 && sw / ((curr_maxx - curr_minn) / stepSize) > ui(8)) {
for( var i = curr_minn; i <= curr_maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x + clamp((_v - curr_minn) / (curr_maxx - curr_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 _pg = clamp((current_value - curr_minn) / (curr_maxx - curr_minn), 0, 1) * sw;
var _kx = _x + _pg;
@ -107,7 +111,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(THEME_VALUE.slider_type == "stem")
draw_sprite_stretched_ext(spr, 3, _kx - handle_w / 2, _y, handle_w, _h, COLORS._main_accent, 1);
var val = (_m[0] - _x) / sw * (curr_maxx - curr_minn) + curr_minn;
var val = (dragging.drag_sx - dragging.drag_msx) / dragging.drag_sw * (curr_maxx - curr_minn) + curr_minn;
val = round(val / stepSize) * stepSize;
val = clamp(val, curr_minn, curr_maxx);
@ -121,21 +125,22 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(mouse_release(mb_left)) {
if(update_stat == SLIDER_UPDATE.release && onModify != noone)
onModify(val);
dragging = false;
instance_destroy(dragging);
dragging = noone;
if(onRelease != noone) onRelease(val);
UNDO_HOLDING = false;
}
} else {
if(hover && (point_in_rectangle(_m[0], _m[1], _x, _y, _x + sw, _y + _h) || point_in_rectangle(_m[0], _m[1], _kx - handle_w / 2, _y, _kx + handle_w / 2, _y + _h))) {
if(THEME_VALUE.slider_type == "stem")
draw_sprite_stretched_ext(spr, 2, _kx - handle_w / 2, _y, handle_w, _h, blend, 1);
if(mouse_press(mb_left, active)) {
dragging = true;
drag_mx = _m[0];
drag_sx = _data;
dragging = instance_create(0, 0, slider_Slider);
dragging.drag_sx = _m[0];
dragging.drag_msx = _x;
dragging.drag_sw = sw;
}
var amo = slide_speed;
@ -150,5 +155,5 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
resetFocus();
return h;
}
} #endregion
}

View file

@ -6,9 +6,7 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
spr = THEME.slider;
onModify = _onModify;
dragging = -1;
drag_mx = 0;
drag_sx = 0;
dragging = noone;
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)); });
@ -16,33 +14,33 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
tb_value_min.slidable = true;
tb_value_max.slidable = true;
static setSlideSpeed = function(speed) {
static setSlideSpeed = function(speed) { #region
tb_value_min.setSlidable(speed);
tb_value_max.setSlidable(speed);
}
} #endregion
static setInteract = function(interactable = noone) {
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) {
static register = function(parent = noone) { #region
tb_value_min.register(parent);
tb_value_max.register(parent);
}
} #endregion
static drawParam = function(params) {
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) {
static draw = function(_x, _y, _w, _h, _data, _m) { #region
x = _x;
y = _y;
w = _w;
h = _h;
if(!is_real(_data[0])) return;
if(!is_real(_data[1])) return;
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;
@ -56,6 +54,14 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
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(8)) {
for( var i = minn; i <= maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x + 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;
@ -63,46 +69,50 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
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 > -1) {
if(dragging == 0)
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 == 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 = (_m[0] - _x0) / sw * (maxx - minn) + minn;
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, val))
if(onModify(dragging_index, val))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
instance_destroy(dragging);
dragging = noone;
UNDO_HOLDING = false;
dragging = -1;
}
} 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 = _hover;
drag_mx = _m[0];
drag_sx = _data[_hover];
dragging = instance_create(0, 0, slider_Slider);
dragging_index = _hover;
dragging.drag_sx = _m[0];
dragging.drag_msx = _x0;
dragging.drag_sw = sw;
}
}
resetFocus();
return h;
}
} #endregion
}

View file

@ -34,7 +34,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
cursor_pos_y = 0;
cursor_pos_y_to = 0;
cursor_line = 0;
cursor_selecting = false;
char_run = 0
@ -78,7 +77,11 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
cursor_pos_x = 0;
cursor_pos_y = 0;
click_block = 1;
cursor = string_length(_current_text);
cursor_select = 0;
click_block = 1;
KEYBOARD_STRING = "";
keyboard_lastkey = -1;
@ -657,9 +660,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
ch_cxo = sx;
ch_x = sx;
//draw_set_color(c_white);
//draw_rectangle(ch_x, ch_y, ch_x + 100, ch_y + _ch_h, false);
if((i == 0 || ch_y <= _my) && (i == n - 1 || _my < ch_y + _ch_h)) {
for( var j = 0; j < _l; j++ ) {
_chr = string_char_at(_str, j + 1);
@ -689,21 +689,19 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
}
if(target != undefined) {
if(mouse_press(mb_left, active) && !click_block && (HOVER != o_dialog_textbox_autocomplete.id || cursor_selecting)) {
cursor_selecting = true;
cursor_select = target;
cursor = target;
o_dialog_textbox_autocomplete.deactivate(self);
}
if(mouse_click(mb_left, active))
cursor = target;
click_block = false;
if(!click_block) {
if(mouse_press(mb_left, active) && HOVER != o_dialog_textbox_autocomplete.id) {
cursor_select = target;
cursor = target;
o_dialog_textbox_autocomplete.deactivate(self);
} else if(mouse_click(mb_left, active))
cursor = target;
}
}
if(mouse_release(mb_left))
cursor_selecting = false;
if(mouse_release(mb_left, active))
click_block = false;
} #endregion
static drawParam = function(params) { #region
@ -803,16 +801,34 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
draw_set_color(COLORS.widget_text_highlight);
if(char_line <= ch_sel_min && char_line + _l > ch_sel_min) {
var x1 = tx + string_width(string_copy(_str, 1, ch_sel_min - char_line));
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_line));
var _hstr1 = string_copy(_str, 1, ch_sel_min - char_line);
var _hstr2 = string_copy(_str, 1, ch_sel_max - char_line);
if(format == TEXT_AREA_FORMAT.delimiter) {
_hstr1 = string_replace_all(_hstr1, " ", "<space>");
_hstr2 = string_replace_all(_hstr2, " ", "<space>");
}
var x1 = tx + string_width(_hstr1);
var x2 = tx + string_width(_hstr2);
draw_roundrect_ext(x1, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
} else if(char_line >= ch_sel_min && char_line + _l < ch_sel_max) {
var x2 = tx + string_width(_str);
var _hstr = _str;
if(format == TEXT_AREA_FORMAT.delimiter)
_hstr = string_replace_all(_hstr, " ", "<space>");
var x2 = tx + string_width(_hstr);
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
} else if(char_line > ch_sel_min && char_line <= ch_sel_max && char_line + _l >= ch_sel_max) {
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_line));
var _hstr = string_copy(_str, 1, ch_sel_max - char_line);
if(format == TEXT_AREA_FORMAT.delimiter)
_hstr = string_replace_all(_hstr, " ", "<space>");
var x2 = tx + string_width(_hstr);
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
}
@ -840,7 +856,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 2);
#endregion
display_text(tx, _y + ui(7), _input_text, _m[0], _m[1], (hover && hoverRect) || cursor_selecting);
display_text(tx, _y + ui(7), _input_text, _m[0], _m[1], hover && hoverRect);
if(cursor_pos_y != 0 && cursor_pos_x != 0) {
draw_set_color(COLORS._main_text_accent);

View file

@ -315,15 +315,17 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
}
if(target != -999) {
if(mouse_press(mb_left, active) && !click_block) {
cursor_select = target;
cursor = target;
} else if(mouse_click(mb_left, active) && cursor != target)
cursor = target;
if(mouse_press(mb_left, active))
click_block = false;
if(!click_block) {
if(mouse_press(mb_left, active)) {
cursor_select = target;
cursor = target;
} else if(mouse_click(mb_left, active) && cursor != target)
cursor = target;
}
}
if(mouse_release(mb_left, active))
click_block = false;
} #endregion
static drawParam = function(params) { #region
@ -538,11 +540,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(sliding == 1 && (abs(dx) > 16 || abs(dy) > 16)) {
sliding = 2;
slide_sv = toNumber(_input_text);
o_dialog_textbox_slider.activate()
textBox_slider.activate()
}
if(sliding == 2) {
o_dialog_textbox_slider.tb = self;
textBox_slider.tb = self;
if(mouse_release(mb_left)) deactivate();
}