diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index f7b9d5518..e0d864ae4 100644 Binary files a/fonts/_f_sdf/_f_sdf.old.png and b/fonts/_f_sdf/_f_sdf.old.png differ diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index 10af973b9..846fe97ba 100644 Binary files a/fonts/_f_sdf/_f_sdf.png and b/fonts/_f_sdf/_f_sdf.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.old.png b/fonts/_f_sdf_medium/_f_sdf_medium.old.png index 383399136..01d31346f 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.old.png and b/fonts/_f_sdf_medium/_f_sdf_medium.old.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index ba25afc6c..333b431a0 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.png and b/fonts/_f_sdf_medium/_f_sdf_medium.png differ diff --git a/scripts/curveBox/curveBox.gml b/scripts/curveBox/curveBox.gml index 5f0f30430..bb16613f1 100644 --- a/scripts/curveBox/curveBox.gml +++ b/scripts/curveBox/curveBox.gml @@ -43,7 +43,8 @@ function curveBox(_onModify) : widget() constructor { w = _w; h = _h; - var cw = _w - ui(32); + var drawScale = _w - ui(32) > ui(100); + var cw = drawScale? _w - ui(32) : _w; hovering = false; if(!is_array(_data) || array_length(_data) == 0) return 0; @@ -264,43 +265,45 @@ function curveBox(_onModify) : widget() constructor { #endregion #region ==== buttons ==== - var bs = ui(20); + if(drawScale) { + var bs = ui(20); - var bxF = _x + cw + ui(8); - var bx = bxF + ui(0); + var bxF = _x + cw + ui(8); + var bx = bxF + ui(0); - var by0 = _y; - var by1 = _y + _h - bs + ui(2); + var by0 = _y; + var by1 = _y + _h - bs + ui(2); - var byF = _y + (bs + ui(6)); - var byH = _h + ui(2) - (bs + ui(6)) * 2; + var byF = _y + (bs + ui(6)); + var byH = _h + ui(2) - (bs + ui(6)) * 2; - draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, bxF, byF, bs, byH, COLORS.assetbox_current_bg, 1); + draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, bxF, byF, bs, byH, COLORS.assetbox_current_bg, 1); - var zH = ui(16); - var zy = byF + zH / 2 + (byH - zH) * (zoom_level_to - zoom_min) / (zoom_max - zoom_min); + var zH = ui(16); + var zy = byF + zH / 2 + (byH - zH) * (zoom_level_to - zoom_min) / (zoom_max - zoom_min); - if(zooming) { - zoom_level_to = lerp(zoom_min, zoom_max, clamp((_m[1] - byF - zH / 2) / (byH - zH), 0, 1)); + if(zooming) { + zoom_level_to = lerp(zoom_min, zoom_max, clamp((_m[1] - byF - zH / 2) / (byH - zH), 0, 1)); - if(mouse_release(mb_left)) - zooming = false; - } + if(mouse_release(mb_left)) + zooming = false; + } - var cc = merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.5); - if(point_in_rectangle(_m[0], _m[1], bxF, byF, _x + _w, byF + byH)) { - cc = COLORS._main_icon; - if(mouse_press(mb_left, active)) - zooming = true; - } + var cc = merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.5); + if(point_in_rectangle(_m[0], _m[1], bxF, byF, _x + _w, byF + byH)) { + cc = COLORS._main_icon; + if(mouse_press(mb_left, active)) + zooming = true; + } - draw_sprite_stretched_ext(THEME.timeline_dopesheet_bg, 0, bxF, zy - zH / 2, bs, zH, cc, 1); + draw_sprite_stretched_ext(THEME.timeline_dopesheet_bg, 0, bxF, zy - zH / 2, bs, zH, cc, 1); - if(buttonInstant(THEME.button_hide, bx, by0, bs, bs, _m, active, hover,, THEME.add_16) == 2) - zoom_level_to = clamp(zoom_level_to - 1, zoom_min, zoom_max); + if(buttonInstant(THEME.button_hide, bx, by0, bs, bs, _m, active, hover,, THEME.add_16) == 2) + zoom_level_to = clamp(zoom_level_to - 1, zoom_min, zoom_max); - 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); + 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); + } #endregion if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + cw, _y + _h)) { #region diff --git a/scripts/fontScrollBox/fontScrollBox.gml b/scripts/fontScrollBox/fontScrollBox.gml index f682e0f7b..1b5ac8467 100644 --- a/scripts/fontScrollBox/fontScrollBox.gml +++ b/scripts/fontScrollBox/fontScrollBox.gml @@ -39,7 +39,8 @@ function fontScrollBox(_onModify) : widget() constructor { w = _w; 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.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); w -= _bs + ui(4); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index aac8072aa..93fb1824a 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -82,6 +82,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { h = 128; min_w = w; min_h = h; + fix_h = h; will_setHeight = false; selectable = true; @@ -385,7 +386,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { for( var i = 0; i < ds_list_size(outputs); i++ ) 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 static setDisplayName = function(_name) { #region @@ -1071,7 +1073,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(!active) return; var hover = noone; - var wh = 28 * _s; + var wh = junction_draw_hei_y * _s; var ww = w * _s * 0.5; var wx = _x + w * _s - ww - 8; var lx = _x + 12 * _s; @@ -1080,64 +1082,57 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var rx = PANEL_GRAPH.x; var ry = PANEL_GRAPH.y; - var jy = 0; - var y1 = _y + h * _s; - var ay = 0; + var jy = _y + junction_draw_pad_y * _s + wh / 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 extY = 0; - if(wh > line_get_height(f_p2)) { - for(var i = 0, n = array_length(inputDisplayList); i < n; i++) { - var jun = inputDisplayList[i]; + for(var i = 0, n = array_length(inputDisplayList); i < n; 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.h = wh; - _param.data = jun.showValue(); - _param.m = _m; - _param.rx = rx; - _param.ry = ry; - _param.s = wh; - _param.font = f_p2; - - jun.y = jy + wh / 2; + _param.w = ww; + _param.h = wh - 4 * _s; + _param.x = wx; + _param.y = jy - _param.h / 2; - if(is_instanceof(jun, checkBox)) - _param.halign = fa_center; + _param.data = jun.showValue(); + _param.m = _m; + _param.rx = rx; + _param.ry = ry; + _param.s = wh; + _param.font = f_p2; - //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); - - var wd = jun.graphWidget; - - if(wd == noone) { - jy += wh + 4 * _s; - continue; - } - - wd.setFocusHover(_focus, _hover); - var _h = wd.drawParam(_param); - - jun.graphWidgetH = _h / _s; + jun.y = jy; - if(wd.isHovering()) draggable = false; - } + if(is_instanceof(jun, checkBox)) + _param.halign = fa_center; - jy += (jun.graphWidgetH + 4) * _s; + draw_text_add(lx, jun.y, jun.getName(), _s * 0.25); + + var wd = jun.graphWidget; + + if(wd == noone) { + jy += wh; + continue; } - - ay = jy + 2 * _s; - h += (ay - y1) / _s; + + wd.setInteract(wh > line_get_height(f_p2)); + wd.setFocusHover(_focus, _hover); + var _h = wd.drawParam(_param); + jun.graphWidgetH = _h / _s; + + extY += max(0, (jun.graphWidgetH + 4) - junction_draw_hei_y); + + if(wd.isHovering()) draggable = false; + + jy += (jun.graphWidgetH + 4) * _s; } + + h = fix_h + extY; } #endregion static drawJunctions = function(_x, _y, _mx, _my, _s) { #region diff --git a/scripts/pathArrayBox/pathArrayBox.gml b/scripts/pathArrayBox/pathArrayBox.gml index fce67614e..df553c3de 100644 --- a/scripts/pathArrayBox/pathArrayBox.gml +++ b/scripts/pathArrayBox/pathArrayBox.gml @@ -32,9 +32,11 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { hovering = false; var _bs = min(_h, ui(32)); - openPath.setFocusHover(active, hover); - openPath.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); - _w -= _bs + ui(4); + if(_w - _bs > ui(100)) { + openPath.setFocusHover(active, hover); + openPath.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); + _w -= _bs + ui(4); + } var click = false; 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 += "]"; - draw_set_alpha(aa); draw_set_text(font, fa_left, fa_center, COLORS._main_text); - draw_text_cut(_x + ui(8), _y + _h / 2, txt, _w - ui(16)); - draw_set_alpha(1); + if(_h >= line_get_height()) { + draw_set_alpha(aa); + draw_text_cut(_x + ui(8), _y + _h / 2, txt, _w - ui(16)); + draw_set_alpha(1); + } 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); diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index 4866d1ec1..2de54456b 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -111,10 +111,12 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor if(_spr) _x0 += ui(32); draw_set_text(font, align, fa_center, COLORS._main_text); - draw_set_alpha(0.5 + 0.5 * interactable); - 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); - draw_set_alpha(1); + if(_h >= line_get_height()) { + draw_set_alpha(0.5 + 0.5 * interactable); + 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); + 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); diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index e9ecb47aa..b3503ebae 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -8,7 +8,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { align = _input == TEXTBOX_INPUT.number? fa_center : fa_left; hide = false; - font = noone; color = COLORS._main_text; boxColor = c_white; 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 draw_set_alpha(0.5 + 0.5 * interactable); - _y += ui(1); + _y += ui(1); //Huh? var cc = color; 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_set_alpha(1); + _disp_text = _text; + var _xx = _x + disp_x; var _mm = _m; var target = -999; - if(!sliding && _mm >= 0) { + if(!sliding && selecting) { for( var i = 1; i <= string_length(_text); i++ ) { var _ch = string_char_at(_text, i); var _chw = string_width(_ch); @@ -364,20 +365,21 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { _xx += _chw; } - } - - if(target != -999) { - 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(target != -999) { + 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; + if(mouse_release(mb_left, active)) + click_block = false; + + } } #endregion static drawParam = function(params) { #region @@ -393,9 +395,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { h = _h; hovering = false; - _x += irandom_range(-shake_amount, shake_amount); - _y += irandom_range(-shake_amount, shake_amount); - if(shake_amount) shake_amount--; + if(shake_amount != 0) { + _x += irandom_range(-shake_amount, shake_amount); + _y += irandom_range(-shake_amount, shake_amount); + if(shake_amount) shake_amount--; + } switch(halign) { case fa_left: _x = _x; break; @@ -411,22 +415,19 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { 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.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide); _w -= _bs + ui(4); } - draw_set_font(font == noone? f_p0 : font); var _raw_text = _text; - _text = string_real(_text); + _text = string_real(_text); _current_text = _text; var tb_surf_x = _x + ui(8); var tb_surf_y = _y; - draw_set_text(font == noone? f_p0 : font, fa_left, fa_top); - var tx = _x; switch(align) { 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; } - 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) { 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); } else if(label != "") { - draw_set_valign(fa_center) - draw_set_color(COLORS._main_text_sub); + draw_set_text(font, fa_left, fa_center, COLORS._main_text_sub); + draw_set_alpha(0.5); draw_text_add(_x + ui(8), _y + _h / 2, label); 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); if(selecting) { - if(sprite_index == -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); + if(sprite_index == -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); + editText(); #region multiplier @@ -509,7 +510,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { #region draw 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 th = string_height(txt == ""? "l" : txt); @@ -560,9 +561,12 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { _my = _m[1]; } - 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); - surface_reset_shader(); + var _display_text = string_real(txt); + if(_update || _display_text != _disp_text) { + surface_set_shader(text_surface, noone, true, BLEND.add); + display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4), _mx - tb_surf_x); + surface_reset_shader(); + } BLEND_ALPHA 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)) 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; + 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); } + var tw = string_width(_display_text); var th = string_height(_display_text); @@ -611,25 +618,28 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(mouse_wheel_down()) modifyValue(toNumber(_text) + amo * SCROLL_SPEED); if(mouse_wheel_up()) modifyValue(toNumber(_text) - amo * SCROLL_SPEED); } + + if(slidable && mouse_press(mb_left, active)) { + sliding = 1; + slide_delta = 0; + + slide_mx = _m[0]; + 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(slidable && hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h) && mouse_press(mb_left, active)) { - sliding = 1; - slide_delta = 0; - - slide_mx = _m[0]; - slide_my = _m[1]; - } - - surface_set_shader(text_surface, noone, true, BLEND.add); - display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4)); - surface_reset_shader(); + if(_update || _display_text != _disp_text) { + surface_set_shader(text_surface, noone, true, BLEND.add); + display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4)); + surface_reset_shader(); + } BLEND_ALPHA draw_surface(text_surface, tb_surf_x, tb_surf_y); BLEND_NORMAL - } #endregion + } if(sliding > 0) { #region slide_delta += window_mouse_get_delta_x();