- [Graph Panel] Fix error when dropping project file to the panel.

This commit is contained in:
Tanasart 2024-07-06 08:16:01 +07:00
parent 1f4a67d126
commit dbb2fabca4
5 changed files with 16 additions and 12 deletions

View file

@ -36,10 +36,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
LATEST_VERSION = 11700;
VERSION = 11760;
VERSION = 11761;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.6";
BUILD_NUMBER = 11760;
VERSION_STRING = "1.17.6.1";
BUILD_NUMBER = 11761;
globalvar HOTKEYS, HOTKEY_CONTEXT;
HOTKEYS = ds_map_create();

View file

@ -28,12 +28,17 @@ function TEST_PATH(path) { #region
LOAD_AT(path);
} #endregion
function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
function LOAD_PATH(path, readonly = false, safe_mode = false) {
var _rep = false;
for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) {
var _p = array_safe_get_fast(PROJECTS, i);
if(!is_instanceof(_p, Project)) continue;
if(_p.path == path) closeProject(_p);
if(_p.path == path) {
_rep = true;
closeProject(_p);
}
}
var _PROJECT = PROJECT;
@ -42,7 +47,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
if(_PROJECT == noone) {
PROJECTS = [ PROJECT ];
} else if(_PROJECT.path == "" && !_PROJECT.modified) {
} else if(!_rep && _PROJECT.path == "" && !_PROJECT.modified) {
var ind = array_find(PROJECTS, _PROJECT);
if(ind == -1) ind = 0;
PROJECTS[ind] = PROJECT;
@ -62,11 +67,10 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
if(!res) return false;
PROJECT.safeMode = safe_mode;
if(!IS_CMD)
setFocus(PANEL_GRAPH.panel);
if(!IS_CMD) setFocus(PANEL_GRAPH.panel);
return PROJECT;
} #endregion
}
function LOAD_AT(path, params = new __loadParams()) { #region
static log = false;

View file

@ -1,5 +1,5 @@
{
"$GMScript":"v1",
"$GMScript":"",
"%Name":"load_function",
"isCompatibility":false,
"isDnD":false,

View file

@ -1,5 +1,5 @@
{
"$GMScript":"v1",
"$GMScript":"",
"%Name":"panel_data",
"isCompatibility":false,
"isDnD":false,

View file

@ -2188,7 +2188,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(FILE_DROPPED && !array_empty(FILE_DROPPING)) {
_gx = mx / graph_s - graph_x;
_gy = my / graph_s - graph_y;
load_file_path(FILE_DROPPING, _gx, _gy);
run_in(1, load_file_path, [ FILE_DROPPING, _gx, _gy ]);
}
}