Graph widget
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -43,7 +43,8 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
var cw = _w - ui(32);
|
var drawScale = _w - ui(32) > ui(100);
|
||||||
|
var cw = drawScale? _w - ui(32) : _w;
|
||||||
hovering = false;
|
hovering = false;
|
||||||
|
|
||||||
if(!is_array(_data) || array_length(_data) == 0) return 0;
|
if(!is_array(_data) || array_length(_data) == 0) return 0;
|
||||||
|
@ -264,6 +265,7 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ==== buttons ====
|
#region ==== buttons ====
|
||||||
|
if(drawScale) {
|
||||||
var bs = ui(20);
|
var bs = ui(20);
|
||||||
|
|
||||||
var bxF = _x + cw + ui(8);
|
var bxF = _x + cw + ui(8);
|
||||||
|
@ -301,6 +303,7 @@ function curveBox(_onModify) : widget() constructor {
|
||||||
|
|
||||||
if(buttonInstant(THEME.button_hide, bx, by1, bs, bs, _m, active, hover,, THEME.minus_16) == 2)
|
if(buttonInstant(THEME.button_hide, bx, by1, bs, bs, _m, active, hover,, THEME.minus_16) == 2)
|
||||||
zoom_level_to = clamp(zoom_level_to + 1, zoom_min, zoom_max);
|
zoom_level_to = clamp(zoom_level_to + 1, zoom_min, zoom_max);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + cw, _y + _h)) { #region
|
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + cw, _y + _h)) { #region
|
||||||
|
|
|
@ -39,7 +39,8 @@ function fontScrollBox(_onModify) : widget() constructor {
|
||||||
w = _w;
|
w = _w;
|
||||||
|
|
||||||
var _bs = min(_h, ui(32));
|
var _bs = min(_h, ui(32));
|
||||||
if(extra_button != noone) {
|
|
||||||
|
if(_w - _bs > ui(100) && extra_button != noone) {
|
||||||
extra_button.setFocusHover(active, hover);
|
extra_button.setFocusHover(active, hover);
|
||||||
extra_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
extra_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||||
w -= _bs + ui(4);
|
w -= _bs + ui(4);
|
||||||
|
|
|
@ -82,6 +82,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
h = 128;
|
h = 128;
|
||||||
min_w = w;
|
min_w = w;
|
||||||
min_h = h;
|
min_h = h;
|
||||||
|
fix_h = h;
|
||||||
will_setHeight = false;
|
will_setHeight = false;
|
||||||
|
|
||||||
selectable = true;
|
selectable = true;
|
||||||
|
@ -386,6 +387,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(outputs[| i].isVisible()) _ho += junction_draw_hei_y;
|
if(outputs[| i].isVisible()) _ho += junction_draw_hei_y;
|
||||||
|
|
||||||
h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height);
|
h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height);
|
||||||
|
fix_h = h;
|
||||||
} run_in(1, function() { setHeight(); }); #endregion
|
} run_in(1, function() { setHeight(); }); #endregion
|
||||||
|
|
||||||
static setDisplayName = function(_name) { #region
|
static setDisplayName = function(_name) { #region
|
||||||
|
@ -1071,7 +1073,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(!active) return;
|
if(!active) return;
|
||||||
var hover = noone;
|
var hover = noone;
|
||||||
|
|
||||||
var wh = 28 * _s;
|
var wh = junction_draw_hei_y * _s;
|
||||||
var ww = w * _s * 0.5;
|
var ww = w * _s * 0.5;
|
||||||
var wx = _x + w * _s - ww - 8;
|
var wx = _x + w * _s - ww - 8;
|
||||||
var lx = _x + 12 * _s;
|
var lx = _x + 12 * _s;
|
||||||
|
@ -1080,25 +1082,23 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
var rx = PANEL_GRAPH.x;
|
var rx = PANEL_GRAPH.x;
|
||||||
var ry = PANEL_GRAPH.y;
|
var ry = PANEL_GRAPH.y;
|
||||||
|
|
||||||
var jy = 0;
|
var jy = _y + junction_draw_pad_y * _s + wh / 2;
|
||||||
var y1 = _y + h * _s;
|
|
||||||
var ay = 0;
|
|
||||||
|
|
||||||
var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2];
|
var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2];
|
||||||
var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3];
|
var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3];
|
||||||
|
var extY = 0;
|
||||||
|
|
||||||
if(wh > line_get_height(f_p2)) {
|
|
||||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||||
var jun = inputDisplayList[i];
|
var jun = inputDisplayList[i];
|
||||||
|
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
||||||
if(jy == 0) jy = jun.y - wh / 2;
|
|
||||||
|
|
||||||
var _param = jun.graphWidgetP;
|
var _param = jun.graphWidgetP;
|
||||||
|
|
||||||
_param.x = wx;
|
|
||||||
_param.y = jy;
|
|
||||||
_param.w = ww;
|
_param.w = ww;
|
||||||
_param.h = wh;
|
_param.h = wh - 4 * _s;
|
||||||
|
_param.x = wx;
|
||||||
|
_param.y = jy - _param.h / 2;
|
||||||
|
|
||||||
_param.data = jun.showValue();
|
_param.data = jun.showValue();
|
||||||
_param.m = _m;
|
_param.m = _m;
|
||||||
_param.rx = rx;
|
_param.rx = rx;
|
||||||
|
@ -1106,38 +1106,33 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
_param.s = wh;
|
_param.s = wh;
|
||||||
_param.font = f_p2;
|
_param.font = f_p2;
|
||||||
|
|
||||||
jun.y = jy + wh / 2;
|
jun.y = jy;
|
||||||
|
|
||||||
if(is_instanceof(jun, checkBox))
|
if(is_instanceof(jun, checkBox))
|
||||||
_param.halign = fa_center;
|
_param.halign = fa_center;
|
||||||
|
|
||||||
//boundV = jy + max(wh, jun.graphWidgetH) > draw_boundary[1] && jy < draw_boundary[3];
|
|
||||||
|
|
||||||
if((boundH && boundV) || jun.graphWidgetH == 0) {
|
|
||||||
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
|
||||||
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
||||||
|
|
||||||
var wd = jun.graphWidget;
|
var wd = jun.graphWidget;
|
||||||
|
|
||||||
if(wd == noone) {
|
if(wd == noone) {
|
||||||
jy += wh + 4 * _s;
|
jy += wh;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wd.setInteract(wh > line_get_height(f_p2));
|
||||||
wd.setFocusHover(_focus, _hover);
|
wd.setFocusHover(_focus, _hover);
|
||||||
var _h = wd.drawParam(_param);
|
var _h = wd.drawParam(_param);
|
||||||
|
|
||||||
jun.graphWidgetH = _h / _s;
|
jun.graphWidgetH = _h / _s;
|
||||||
|
|
||||||
|
extY += max(0, (jun.graphWidgetH + 4) - junction_draw_hei_y);
|
||||||
|
|
||||||
if(wd.isHovering()) draggable = false;
|
if(wd.isHovering()) draggable = false;
|
||||||
}
|
|
||||||
|
|
||||||
jy += (jun.graphWidgetH + 4) * _s;
|
jy += (jun.graphWidgetH + 4) * _s;
|
||||||
}
|
}
|
||||||
|
|
||||||
ay = jy + 2 * _s;
|
h = fix_h + extY;
|
||||||
h += (ay - y1) / _s;
|
|
||||||
}
|
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
|
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
|
||||||
|
|
|
@ -32,9 +32,11 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||||
hovering = false;
|
hovering = false;
|
||||||
|
|
||||||
var _bs = min(_h, ui(32));
|
var _bs = min(_h, ui(32));
|
||||||
|
if(_w - _bs > ui(100)) {
|
||||||
openPath.setFocusHover(active, hover);
|
openPath.setFocusHover(active, hover);
|
||||||
openPath.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
openPath.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||||
_w -= _bs + ui(4);
|
_w -= _bs + ui(4);
|
||||||
|
}
|
||||||
|
|
||||||
var click = false;
|
var click = false;
|
||||||
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
|
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
|
||||||
|
@ -65,10 +67,12 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||||
txt += (i? ", " : "") + filename_name_only(_files[i]);
|
txt += (i? ", " : "") + filename_name_only(_files[i]);
|
||||||
txt += "]";
|
txt += "]";
|
||||||
|
|
||||||
draw_set_alpha(aa);
|
|
||||||
draw_set_text(font, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(font, fa_left, fa_center, COLORS._main_text);
|
||||||
|
if(_h >= line_get_height()) {
|
||||||
|
draw_set_alpha(aa);
|
||||||
draw_text_cut(_x + ui(8), _y + _h / 2, txt, _w - ui(16));
|
draw_text_cut(_x + ui(8), _y + _h / 2, txt, _w - ui(16));
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
|
}
|
||||||
|
|
||||||
if(WIDGET_CURRENT == self)
|
if(WIDGET_CURRENT == self)
|
||||||
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
|
||||||
|
|
|
@ -111,10 +111,12 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
|
||||||
if(_spr) _x0 += ui(32);
|
if(_spr) _x0 += ui(32);
|
||||||
|
|
||||||
draw_set_text(font, align, fa_center, COLORS._main_text);
|
draw_set_text(font, align, fa_center, COLORS._main_text);
|
||||||
|
if(_h >= line_get_height()) {
|
||||||
draw_set_alpha(0.5 + 0.5 * interactable);
|
draw_set_alpha(0.5 + 0.5 * interactable);
|
||||||
if(align == fa_center) draw_text_add((_x0 + _x1) / 2, _yc, _text);
|
if(align == fa_center) draw_text_add((_x0 + _x1) / 2, _yc, _text);
|
||||||
else if(align == fa_left) draw_text_add(_x0 + ui(8), _yc, _text);
|
else if(align == fa_left) draw_text_add(_x0 + ui(8), _yc, _text);
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
|
}
|
||||||
|
|
||||||
if(_spr) draw_sprite_ext(_selVal.spr, _selVal.spr_ind, _x + ui(16), _yc, 1, 1, 0, _selVal.spr_blend, 1);
|
if(_spr) draw_sprite_ext(_selVal.spr, _selVal.spr_ind, _x + ui(16), _yc, 1, 1, 0, _selVal.spr_blend, 1);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
align = _input == TEXTBOX_INPUT.number? fa_center : fa_left;
|
align = _input == TEXTBOX_INPUT.number? fa_center : fa_left;
|
||||||
hide = false;
|
hide = false;
|
||||||
font = noone;
|
|
||||||
color = COLORS._main_text;
|
color = COLORS._main_text;
|
||||||
boxColor = c_white;
|
boxColor = c_white;
|
||||||
format = TEXT_AREA_FORMAT._default;
|
format = TEXT_AREA_FORMAT._default;
|
||||||
|
@ -336,20 +335,22 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
static display_text = function(_x, _y, _text, _w, _m = -1) { #region
|
static display_text = function(_x, _y, _text, _w, _m = -1) { #region
|
||||||
draw_set_alpha(0.5 + 0.5 * interactable);
|
draw_set_alpha(0.5 + 0.5 * interactable);
|
||||||
_y += ui(1);
|
_y += ui(1); //Huh?
|
||||||
|
|
||||||
var cc = color;
|
var cc = color;
|
||||||
if(sliding == 2) cc = COLORS._main_accent
|
if(sliding == 2) cc = COLORS._main_accent
|
||||||
|
|
||||||
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, cc);
|
draw_set_text(font, fa_left, fa_top, cc);
|
||||||
draw_text_add(_x + disp_x, _y, _text + suffix);
|
draw_text_add(_x + disp_x, _y, _text + suffix);
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
|
|
||||||
|
_disp_text = _text;
|
||||||
|
|
||||||
var _xx = _x + disp_x;
|
var _xx = _x + disp_x;
|
||||||
var _mm = _m;
|
var _mm = _m;
|
||||||
var target = -999;
|
var target = -999;
|
||||||
|
|
||||||
if(!sliding && _mm >= 0) {
|
if(!sliding && selecting) {
|
||||||
for( var i = 1; i <= string_length(_text); i++ ) {
|
for( var i = 1; i <= string_length(_text); i++ ) {
|
||||||
var _ch = string_char_at(_text, i);
|
var _ch = string_char_at(_text, i);
|
||||||
var _chw = string_width(_ch);
|
var _chw = string_width(_ch);
|
||||||
|
@ -364,7 +365,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
_xx += _chw;
|
_xx += _chw;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(target != -999) {
|
if(target != -999) {
|
||||||
if(!click_block) {
|
if(!click_block) {
|
||||||
|
@ -378,6 +378,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
if(mouse_release(mb_left, active))
|
if(mouse_release(mb_left, active))
|
||||||
click_block = false;
|
click_block = false;
|
||||||
|
|
||||||
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) { #region
|
||||||
|
@ -393,9 +395,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
hovering = false;
|
hovering = false;
|
||||||
|
if(shake_amount != 0) {
|
||||||
_x += irandom_range(-shake_amount, shake_amount);
|
_x += irandom_range(-shake_amount, shake_amount);
|
||||||
_y += irandom_range(-shake_amount, shake_amount);
|
_y += irandom_range(-shake_amount, shake_amount);
|
||||||
if(shake_amount) shake_amount--;
|
if(shake_amount) shake_amount--;
|
||||||
|
}
|
||||||
|
|
||||||
switch(halign) {
|
switch(halign) {
|
||||||
case fa_left: _x = _x; break;
|
case fa_left: _x = _x; break;
|
||||||
|
@ -411,13 +415,12 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
var _bs = min(h, ui(32));
|
var _bs = min(h, ui(32));
|
||||||
|
|
||||||
if(_w - _bs > ui(100) && side_button && instanceof(side_button) == "buttonClass") {
|
if(_w - _bs > ui(100) && side_button) {
|
||||||
side_button.setFocusHover(active, hover);
|
side_button.setFocusHover(active, hover);
|
||||||
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
|
||||||
_w -= _bs + ui(4);
|
_w -= _bs + ui(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_font(font == noone? f_p0 : font);
|
|
||||||
var _raw_text = _text;
|
var _raw_text = _text;
|
||||||
_text = string_real(_text);
|
_text = string_real(_text);
|
||||||
_current_text = _text;
|
_current_text = _text;
|
||||||
|
@ -425,8 +428,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
var tb_surf_x = _x + ui(8);
|
var tb_surf_x = _x + ui(8);
|
||||||
var tb_surf_y = _y;
|
var tb_surf_y = _y;
|
||||||
|
|
||||||
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top);
|
|
||||||
|
|
||||||
var tx = _x;
|
var tx = _x;
|
||||||
switch(align) {
|
switch(align) {
|
||||||
case fa_left : tx = _x + ui(8); break;
|
case fa_left : tx = _x + ui(8); break;
|
||||||
|
@ -434,7 +435,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
case fa_right : tx = _x + _w - ui(8); break;
|
case fa_right : tx = _x + _w - ui(8); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
text_surface = surface_verify(text_surface, _w - ui(16), _h);
|
var _update = !surface_valid(text_surface, _w - ui(16), _h);
|
||||||
|
if(_update) text_surface = surface_verify(text_surface, _w - ui(16), _h);
|
||||||
|
|
||||||
if(!hide) {
|
if(!hide) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
|
@ -465,8 +467,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
draw_sprite_ui_uniform(THEME.arrow, 0, _ax1, _ay, 1, COLORS._main_accent, 1);
|
draw_sprite_ui_uniform(THEME.arrow, 0, _ax1, _ay, 1, COLORS._main_accent, 1);
|
||||||
|
|
||||||
} else if(label != "") {
|
} else if(label != "") {
|
||||||
draw_set_valign(fa_center)
|
draw_set_text(font, fa_left, fa_center, COLORS._main_text_sub);
|
||||||
draw_set_color(COLORS._main_text_sub);
|
|
||||||
draw_set_alpha(0.5);
|
draw_set_alpha(0.5);
|
||||||
draw_text_add(_x + ui(8), _y + _h / 2, label);
|
draw_text_add(_x + ui(8), _y + _h / 2, label);
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
|
@ -478,10 +480,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
|
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
|
||||||
|
|
||||||
if(selecting) {
|
if(selecting) {
|
||||||
if(sprite_index == -1)
|
if(sprite_index == -1) draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, _h, COLORS._main_accent, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, _h, COLORS._main_accent, 1);
|
else draw_sprite_stretched(THEME.textbox, sprite_index, _x, _y, _w, _h);
|
||||||
else
|
|
||||||
draw_sprite_stretched(THEME.textbox, sprite_index, _x, _y, _w, _h);
|
|
||||||
editText();
|
editText();
|
||||||
|
|
||||||
#region multiplier
|
#region multiplier
|
||||||
|
@ -509,7 +510,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
#region draw
|
#region draw
|
||||||
var txt = _input_text;
|
var txt = _input_text;
|
||||||
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top);
|
draw_set_text(font, fa_left, fa_top);
|
||||||
var tw = string_width(txt);
|
var tw = string_width(txt);
|
||||||
var th = string_height(txt == ""? "l" : txt);
|
var th = string_height(txt == ""? "l" : txt);
|
||||||
|
|
||||||
|
@ -560,9 +561,12 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
_my = _m[1];
|
_my = _m[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _display_text = string_real(txt);
|
||||||
|
if(_update || _display_text != _disp_text) {
|
||||||
surface_set_shader(text_surface, noone, true, BLEND.add);
|
surface_set_shader(text_surface, noone, true, BLEND.add);
|
||||||
display_text(tx - tb_surf_x, _h / 2 - th / 2, string_real(txt), _w - ui(4), _mx - tb_surf_x);
|
display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4), _mx - tb_surf_x);
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
}
|
||||||
|
|
||||||
BLEND_ALPHA
|
BLEND_ALPHA
|
||||||
draw_surface(text_surface, tb_surf_x, tb_surf_y);
|
draw_surface(text_surface, tb_surf_x, tb_surf_y);
|
||||||
|
@ -580,13 +584,16 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
if(!hoverRect && mouse_press(mb_left))
|
if(!hoverRect && mouse_press(mb_left))
|
||||||
deactivate();
|
deactivate();
|
||||||
} else { #region draw
|
|
||||||
draw_set_text(font == noone? f_p0 : font, fa_left, fa_center);
|
} else {
|
||||||
|
draw_set_text(font, fa_left, fa_center);
|
||||||
var _display_text = _raw_text;
|
var _display_text = _raw_text;
|
||||||
|
|
||||||
if(input == TEXTBOX_INPUT.number) {
|
if(input == TEXTBOX_INPUT.number) {
|
||||||
var dig = floor(_w / string_width("0")) - 3;
|
var dig = floor(_w / string_width("0")) - 3;
|
||||||
_display_text = string_real(_display_text, dig, precision);
|
_display_text = string_real(_display_text, dig, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tw = string_width(_display_text);
|
var tw = string_width(_display_text);
|
||||||
var th = string_height(_display_text);
|
var th = string_height(_display_text);
|
||||||
|
|
||||||
|
@ -611,10 +618,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
if(mouse_wheel_down()) modifyValue(toNumber(_text) + amo * SCROLL_SPEED);
|
if(mouse_wheel_down()) modifyValue(toNumber(_text) + amo * SCROLL_SPEED);
|
||||||
if(mouse_wheel_up()) modifyValue(toNumber(_text) - amo * SCROLL_SPEED);
|
if(mouse_wheel_up()) modifyValue(toNumber(_text) - amo * SCROLL_SPEED);
|
||||||
}
|
}
|
||||||
} else if(!hide)
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
|
||||||
|
|
||||||
if(slidable && hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h) && mouse_press(mb_left, active)) {
|
if(slidable && mouse_press(mb_left, active)) {
|
||||||
sliding = 1;
|
sliding = 1;
|
||||||
slide_delta = 0;
|
slide_delta = 0;
|
||||||
|
|
||||||
|
@ -622,14 +627,19 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
slide_my = _m[1];
|
slide_my = _m[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if(!hide)
|
||||||
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
|
if(_update || _display_text != _disp_text) {
|
||||||
surface_set_shader(text_surface, noone, true, BLEND.add);
|
surface_set_shader(text_surface, noone, true, BLEND.add);
|
||||||
display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4));
|
display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4));
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
}
|
||||||
|
|
||||||
BLEND_ALPHA
|
BLEND_ALPHA
|
||||||
draw_surface(text_surface, tb_surf_x, tb_surf_y);
|
draw_surface(text_surface, tb_surf_x, tb_surf_y);
|
||||||
BLEND_NORMAL
|
BLEND_NORMAL
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
if(sliding > 0) { #region
|
if(sliding > 0) { #region
|
||||||
slide_delta += window_mouse_get_delta_x();
|
slide_delta += window_mouse_get_delta_x();
|
||||||
|
|