diff --git a/scripts/curveBox/curveBox.gml b/scripts/curveBox/curveBox.gml index c7211608f..a2bbe7f1d 100644 --- a/scripts/curveBox/curveBox.gml +++ b/scripts/curveBox/curveBox.gml @@ -42,26 +42,25 @@ function curveBox(_onModify) : widget() constructor { static get_x = function(val) { return cw * (val - minx) / (maxx - minx); } static get_y = function(val) { return ch * (1 - (val - miny) / (maxy - miny)); } - static register = function() {} - - static setInteract = function(interactable = noone) { #region + static setInteract = function(interactable = noone) { self.interactable = interactable; tb_shift.setInteract(interactable); tb_scale.setInteract(interactable); - } #endregion + } static register = function(parent = noone) { + self.parent = parent; tb_shift.register(parent); tb_scale.register(parent); } - static isHovering = function() { #region + static isHovering = function() { if(tb_shift.isHovering()) return true; if(tb_scale.isHovering()) return true; return hovering; - } #endregion + } static drawParam = function(params) { rx = params.rx; @@ -109,6 +108,7 @@ function curveBox(_onModify) : widget() constructor { curve_surface = surface_verify(curve_surface, cw, ch); if(node_dragging != -1) { #region editing + if(parent) parent.pen_scroll_lock = true; show_coord = true; _data = array_clone(_data); @@ -540,8 +540,8 @@ function curveBox(_onModify) : widget() constructor { return h; } - static clone = function() { #region + static clone = function() { var cln = new curveBox(onModify); return cln; - } #endregion + } } \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 1e7bc9fad..bf9f4bcac 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -95,7 +95,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { x = _x; y = _y; - name_height = 16; + name_height = ui(16); w = 128; h = 128; min_w = w; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index 3cf1536f2..ff729c4b3 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -98,6 +98,10 @@ function Panel_Animation() : PanelContent() constructor { timeline_preview = noone; timeline_contents = []; + + scroll_s = sprite_get_width(THEME.ui_scrollbar); + scroll_w = scroll_s; + #endregion #region ---- keyframes ---- @@ -1750,7 +1754,7 @@ function Panel_Animation() : PanelContent() constructor { #region scroll dope_sheet_y = lerp_float(dope_sheet_y, dope_sheet_y_to, 4); - + if(pHOVER && point_in_rectangle(mx, my, ui(8), ui(8), bar_x, ui(8) + dope_sheet_h)) { if(mouse_wheel_down()) dope_sheet_y_to = clamp(dope_sheet_y_to - ui(32) * SCROLL_SPEED, -dope_sheet_y_max, 0); if(mouse_wheel_up()) dope_sheet_y_to = clamp(dope_sheet_y_to + ui(32) * SCROLL_SPEED, -dope_sheet_y_max, 0); @@ -1765,9 +1769,9 @@ function Panel_Animation() : PanelContent() constructor { var scr_scale_s = scr_s * scr_size; var scr_prog_s = scr_prog * (scr_s - scr_scale_s); - var scr_w = ui(sprite_get_width(THEME.ui_scrollbar)); + var scr_w = scroll_w; var scr_h = scr_s; - var s_bar_w = ui(sprite_get_width(THEME.ui_scrollbar)); + var s_bar_w = scroll_w; var s_bar_h = scr_scale_s; var s_bar_x = scr_x; var s_bar_y = scr_y + scr_prog_s; @@ -1786,6 +1790,9 @@ function Panel_Animation() : PanelContent() constructor { } else { draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, s_bar_x, s_bar_y, s_bar_w, s_bar_h, COLORS.scrollbar_idle, 1); } + + var _p = PEN_USE && (is_scrolling || point_in_rectangle(mx, my, scr_x - ui(2), scr_y - ui(2), scr_x + scr_w + ui(2), scr_y + scr_h + ui(2))); + scroll_w = lerp_float(scroll_w, _p? 12 : scroll_s, 5); #endregion surface_set_target(dope_sheet_surface); diff --git a/scripts/scrollPane/scrollPane.gml b/scripts/scrollPane/scrollPane.gml index bc1f1d82b..6ba7943d5 100644 --- a/scripts/scrollPane/scrollPane.gml +++ b/scripts/scrollPane/scrollPane.gml @@ -28,6 +28,10 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { pen_scroll_my = 0; pen_scroll_sy = 0; pen_scroll_py = 0; + pen_scroll_lock = false; + + scroll_s = sprite_get_width(THEME.ui_scrollbar); + scroll_w = scroll_s; static resize = function(_w, _h) { w = _w; @@ -41,26 +45,25 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { scroll_y_to = clamp(_scroll_y, -content_h, 0); } - static draw = function(x, y, _mx = mouse_mx - x, _my = mouse_my - y) { + static draw = function(x, y, mx = mouse_mx - x, my = mouse_my - y) { self.x = x; self.y = y; - var mx = _mx, my = _my; - - hover &= point_in_rectangle(mx, my, 0, 0, surface_w, surface_h); + hover &= point_in_rectangle( mx, my, 0, 0, surface_w, surface_h); hover &= pen_scrolling != 2; surface = surface_verify(surface, surface_w, surface_h); surface_set_target(surface); draw_clear(COLORS.panel_bg_clear); - var hh = drawFunc(scroll_y, [mx, my], [x, y]); + var hh = drawFunc(scroll_y, [ mx, my ], [ x, y ]); content_h = max(0, hh - surface_h); surface_reset_target(); var sc = is_scroll; is_scroll = hh > surface_h; - if(sc != is_scroll) - resize(w, h); + if(sc != is_scroll) resize(w, h); + + //// Scrolling scroll_y_to = clamp(scroll_y_to, -content_h, 0); scroll_y_raw = lerp_float(scroll_y_raw, scroll_y_to, 4); @@ -71,13 +74,12 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { if(mouse_wheel_down()) scroll_y_to -= scroll_step * SCROLL_SPEED; if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED; } - scroll_lock = false; - - if(hover && PEN_USE && mouse_press(mb_left)) { - pen_scrolling = 1; - pen_scroll_my = 0; - } + // if(pen_scroll_lock) pen_scrolling = 0; + // else if(hover && PEN_USE && mouse_press(mb_left)) { + // pen_scrolling = 1; + // pen_scroll_my = 0; + // } if(pen_scrolling == 1) { pen_scroll_my += PEN_Y_DELTA; @@ -99,32 +101,37 @@ function scrollPane(_w, _h, ondraw) : widget() constructor { } if(show_scroll && (abs(content_h) > 0 || always_scroll)) { - var scr_w = sprite_get_width(THEME.ui_scrollbar); - draw_scroll(x + w - scr_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h), - COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + _mx, y + _my); + var _p = PEN_USE && (is_scrolling || point_in_rectangle(x + mx, y + my, x + w - scroll_w - 2, y, x + w, y + surface_h)); + scroll_w = lerp_float(scroll_w, _p? 12 : scroll_s, 5); + + draw_scroll(x + w - scroll_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h), + COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + mx, y + my, scroll_w); } + + scroll_lock = false; + pen_scroll_lock = false; } - static draw_scroll = function(scr_x, scr_y, is_vert, scr_s, scr_prog, scr_ratio, bg_col, bar_col, bar_hcol, mx, my) { + static draw_scroll = function(scr_x, scr_y, is_vert, scr_s, scr_prog, scr_ratio, bg_col, bar_col, bar_hcol, mx, my, bar_spr_w) { var scr_scale_s = scr_s * scr_ratio; var scr_prog_s = scr_prog * (scr_s - scr_scale_s); var scr_w, scr_h, bar_w, bar_h, bar_x, bar_y; if(is_vert) { - scr_w = ui(sprite_get_width(THEME.ui_scrollbar)); + scr_w = bar_spr_w; scr_h = scr_s; - bar_w = ui(sprite_get_width(THEME.ui_scrollbar)); + bar_w = bar_spr_w; bar_h = scr_scale_s; bar_x = scr_x; bar_y = scr_y + scr_prog_s; } else { scr_w = scr_s; - scr_h = ui(sprite_get_width(THEME.ui_scrollbar)); + scr_h = bar_spr_w; bar_w = scr_scale_s; - bar_h = ui(sprite_get_width(THEME.ui_scrollbar)); + bar_h = bar_spr_w; bar_x = scr_x + scr_prog_s; bar_y = scr_y; diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 3b1bdb631..a3162e0c5 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -718,12 +718,16 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor if(target != undefined) { if(!click_block) { if(mouse_press(mb_left, active) && HOVER != o_dialog_textbox_autocomplete.id) { + if(parent) parent.pen_scroll_lock = true; cursor_select = target; cursor = target; o_dialog_textbox_autocomplete.deactivate(self); - } else if(mouse_click(mb_left, active)) + + } else if(mouse_click(mb_left, active)) { + if(parent) parent.pen_scroll_lock = true; cursor = target; + } } } @@ -993,6 +997,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor var bar_y = scr_y + (scr_h - bar_h) * abs(text_y / text_y_max); if(text_scrolling) { + if(parent) parent.pen_scroll_lock = true; text_y_to = text_scroll_sy - (_m[1] - text_scroll_my) / bar_h * scr_h; text_y_to = clamp(text_y_to, -text_y_max, 0); diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 39503a0b3..a5549659e 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -502,6 +502,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h); if(sliding > 0) { #region slide + if(parent) parent.pen_scroll_lock = true; slide_delta += PEN_USE? PEN_X_DELTA : window_mouse_get_delta_x(); slide_delta += PEN_USE? PEN_Y_DELTA : window_mouse_get_delta_y();