From 4d6d06c738cbe3e5d52e8f95e441aea49de73ec5 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 15 Jun 2024 09:29:31 +0700 Subject: [PATCH] - [Inline Group] Fix error when deleteing the last node in the group. --- .../node_collection_inline.gml | 10 +--------- scripts/panel_graph/panel_graph.gml | 12 ++++++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/scripts/node_collection_inline/node_collection_inline.gml b/scripts/node_collection_inline/node_collection_inline.gml index 1459ab24c..32bfb252a 100644 --- a/scripts/node_collection_inline/node_collection_inline.gml +++ b/scripts/node_collection_inline/node_collection_inline.gml @@ -101,6 +101,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c if(add_point) _hash += $"{point_x},{point_y}|"; if(_hash == "") { + group_vertex = []; destroy(); return; } @@ -289,15 +290,6 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c draw_set_alpha(1); - //draw_set_color(c_white); - //for( var i = 0, n = array_length(group_vertex); i < n; i++ ) { - // a = group_vertex[i]; - // var _vx = _x + a[0] * _s; - // var _vy = _y + a[1] * _s; - - // draw_circle(_vx, _vy, 1, false); - //} - add_point = false; return _hov; diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 2a7441468..bd1903142 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1024,15 +1024,19 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { frame_hovering = noone; for(var i = 0; i < array_length(nodes_list); i++) { - nodes_list[i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); - nodes_list[i].preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); + var _nl = nodes_list[i]; + + _nl.cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64); + _nl.preDraw(gr_x, gr_y, graph_s, gr_x, gr_y); } printIf(log, $"Predraw time: {get_timer() - t}"); t = get_timer(); #region draw frame for(var i = 0; i < array_length(nodes_list); i++) { - if(nodes_list[i].drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter)) - frame_hovering = nodes_list[i]; + var _nl = nodes_list[i]; + + if(_nl.drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter)) + frame_hovering = _nl; } #endregion printIf(log, $"Frame draw time: {get_timer() - t}"); t = get_timer();