Fix dialog close order

This commit is contained in:
Tanasart 2023-08-12 09:41:13 +02:00
parent 5c43dec581
commit 3fc5ab2b75
7 changed files with 20 additions and 18 deletions

View file

@ -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;

View file

@ -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

View file

@ -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"));

View file

@ -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"));

View file

@ -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;

View file

@ -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;

View file

@ -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;