From 3fc5ab2b751f2a4be6dc18039a5da6100c0b575e Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Sat, 12 Aug 2023 09:41:13 +0200 Subject: [PATCH] Fix dialog close order --- objects/_p_dialog/Create_0.gml | 15 +++++++++++++-- objects/o_dialog_color_selector/Create_0.gml | 2 -- objects/o_dialog_gradient/Create_0.gml | 1 - objects/o_dialog_palette/Create_0.gml | 1 - objects/o_main/Step_1.gml | 10 ++++------ scripts/directory_object/directory_object.gml | 7 ++----- scripts/node_registry/node_registry.gml | 2 +- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/objects/_p_dialog/Create_0.gml b/objects/_p_dialog/Create_0.gml index 906360ed1..dccd97431 100644 --- a/objects/_p_dialog/Create_0.gml +++ b/objects/_p_dialog/Create_0.gml @@ -160,10 +160,21 @@ } function checkMouse() { - if(!DIALOG_CLICK) return; + if(!DIALOG_CLICK) { + //printIf(mouse_press(mb_any), $"Check {object_get_name(object_index)} : Click"); + return; + } + + with(_p_dialog) if(depth < other.depth) { + //printIf(mouse_press(mb_any), $"Check {object_get_name(object_index)} : Top"); + return; + } for( var i = 0, n = array_length(children); i < n; i++ ) - if(instance_exists(children[i])) return; + if(instance_exists(children[i])) { + //printIf(mouse_press(mb_any), $"Check {object_get_name(object_index)} : Children"); + return; + } var x0 = dialog_x - dialog_resizable * 6; var x1 = dialog_x + dialog_w + dialog_resizable * 6; diff --git a/objects/o_dialog_color_selector/Create_0.gml b/objects/o_dialog_color_selector/Create_0.gml index 167089804..e0958a09f 100644 --- a/objects/o_dialog_color_selector/Create_0.gml +++ b/objects/o_dialog_color_selector/Create_0.gml @@ -21,14 +21,12 @@ event_inherited(); b_cancel = button(function() { onApply(previous_color); - DIALOG_CLICK = false; instance_destroy(); }).setIcon(THEME.undo, 0, COLORS._main_icon) .setTooltip(__txtx("dialog_revert_and_exit", "Revert and exit")); b_apply = button(function() { onApply(selector.current_color); - DIALOG_CLICK = false; instance_destroy(); }).setIcon(THEME.accept, 0, COLORS._main_icon_dark); #endregion diff --git a/objects/o_dialog_gradient/Create_0.gml b/objects/o_dialog_gradient/Create_0.gml index f061a9985..83e0d9a14 100644 --- a/objects/o_dialog_gradient/Create_0.gml +++ b/objects/o_dialog_gradient/Create_0.gml @@ -49,7 +49,6 @@ event_inherited(); b_cancel = button(function() { onApply(previous_gradient); - DIALOG_CLICK = false; instance_destroy(); }).setIcon(THEME.undo, 0, COLORS._main_icon) .setTooltip(__txtx("dialog_revert_and_exit", "Revert and exit")); diff --git a/objects/o_dialog_palette/Create_0.gml b/objects/o_dialog_palette/Create_0.gml index b2fe5b3e8..c7e6206c1 100644 --- a/objects/o_dialog_palette/Create_0.gml +++ b/objects/o_dialog_palette/Create_0.gml @@ -36,7 +36,6 @@ event_inherited(); b_cancel = button(function() { onApply(previous_palette); - DIALOG_CLICK = false; instance_destroy(); }).setIcon(THEME.undo, 0, COLORS._main_icon) .setTooltip(__txtx("dialog_revert_and_exit", "Revert and exit")); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index c195d13f0..1b3bdf834 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -37,18 +37,21 @@ _HOVERING_ELEMENT = noone; #endregion #region focus + if(mouse_release(mb_any)) DIALOG_CLICK = true; + HOVER = noone; + with(_p_dialog) checkMouse(); if(PANEL_MAIN != 0) PANEL_MAIN.stepBegin(); DIALOG_DEPTH_HOVER = 0; + with(_p_dialog) checkFocus(); with(_p_dialog) checkDepth(); with(_p_dialog) doDrag(); with(_p_dialog) doResize(); - with(_p_dialog) checkMouse(); #endregion #region auto save @@ -127,11 +130,6 @@ _HOVERING_ELEMENT = noone; action_last_frame = []; #endregion -#region dialog - if(mouse_release(mb_any)) - DIALOG_CLICK = true; -#endregion - #region modifiers if(CTRL == KEYBOARD_STATUS.up) CTRL = KEYBOARD_STATUS.idle; diff --git a/scripts/directory_object/directory_object.gml b/scripts/directory_object/directory_object.gml index 69d99d003..294550ace 100644 --- a/scripts/directory_object/directory_object.gml +++ b/scripts/directory_object/directory_object.gml @@ -104,11 +104,8 @@ function FileObject(_name, _path) constructor { } else { var m = json_load_struct(path); - if(struct_has(m, "metadata")) - meta.deserialize(m.metadata); - if(struct_has(m, "preview")) - thumbnail_data = json_try_parse(m.preview, -1); - meta.version = m.version; + if(struct_has(m, "metadata")) meta.deserialize(m.metadata); + if(struct_has(m, "preview")) thumbnail_data = json_try_parse(m.preview, -1); } meta.name = name; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index ea9c4debd..32fcb195b 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -15,7 +15,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { new_node = false; if(struct_has(global.NODE_GUIDE, node)) { - var _n = global.NODE_GUIDE[$ node]; + var _n = global.NODE_GUIDEarn[$ node]; name = _n.name; if(_n.tooltip != "") tooltip = _n.tooltip;