- [Canvas] Add image file dropping to the surface.

This commit is contained in:
Tanasart 2024-07-02 08:51:03 +07:00
parent 217133980c
commit 529e9267d6
10 changed files with 191 additions and 71 deletions

View file

@ -430,6 +430,47 @@
{"$GMIncludedFile":"","%Name":"4 Loop.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"4 Loop.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"5 Particles.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"5 Particles.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"5 Particles.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"5 Particles.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"arrowRight.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"arrowRight.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_back.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"card_back.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_02.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"card_clubs_02.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_03.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"card_clubs_03.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_04.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"card_clubs_04.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_05.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"card_clubs_05.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_1.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_1.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_2.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_2.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_3.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_3.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_4.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_4.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_5.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_5.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_6.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"dice_6.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"multi file dialog.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"multi file dialog.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0044.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"tile_0044.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0067.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"tile_0067.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0126.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Getting started","name":"tile_0126.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Broken heart.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Broken heart.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Broken heart.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_back.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_back.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_02.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_02.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_03.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_03.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_04.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_04.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"card_clubs_05.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"card_clubs_05.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Cards flipping.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Cards flipping.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Cards flipping.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Cards flipping.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_1.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_1.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_2.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_2.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_3.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_3.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_4.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_4.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_5.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_5.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dice_6.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"dice_6.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Dice.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Dice.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Dice.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Dice.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Shiny gem.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Shiny gem.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Shiny gem.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"spark.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"spark.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0044.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0044.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0067.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0067.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"tile_0126.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"tile_0126.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Tree sway.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Tree sway.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Tree sway.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Sample Projects","name":"Tree sway.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -21,7 +21,7 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
mouse_pre_x = 0;
mouse_pre_y = 0;
function createSelection(_mask, sel_x0, sel_y0, sel_w, sel_h) { #region
function createSelection(_mask, sel_x0, sel_y0, sel_w, sel_h) {
if(is_selected)
apply();
else {
@ -37,9 +37,37 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
else
createNewSelection(_mask, sel_x0, sel_y0, sel_w, sel_h);
} #endregion
}
function modifySelection(_mask, sel_x0, sel_y0, sel_w, sel_h, _add) { #region
function createSelectionFromSurface(surface, sel_x0 = 0, sel_y0 = 0) {
if(!surface_exists(surface)) return;
var sel_w = surface_get_width(surface);
var sel_h = surface_get_height(surface);
selection_surface = surface_verify(selection_surface, sel_w, sel_h);
selection_mask = surface_verify(selection_mask, sel_w, sel_h);
surface_set_target(selection_surface);
DRAW_CLEAR
BLEND_OVERRIDE
draw_surface(surface, 0, 0);
BLEND_NORMAL
surface_reset_target();
surface_set_target(selection_mask);
DRAW_CLEAR
BLEND_OVERRIDE
draw_surface(surface, 0, 0);
BLEND_NORMAL
surface_reset_target();
selection_position = [ sel_x0, sel_y0 ];
selection_size = [ sel_w, sel_h ];
is_selected = true;
}
function modifySelection(_mask, sel_x0, sel_y0, sel_w, sel_h, _add) {
if(sel_w == 1 && sel_h == 1) return;
var _x0, _y0, _x1, _y1;
@ -99,9 +127,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
createNewSelection(_selection_mask, _x0, _y0, _nw, _nh);
surface_free(_selection_mask);
} #endregion
}
function createNewSelection(_mask, sel_x0, sel_y0, sel_w, sel_h) { #region
function createNewSelection(_mask, sel_x0, sel_y0, sel_w, sel_h) {
if(sel_w == 1 && sel_h == 1) return;
selection_surface = surface_verify(selection_surface, sel_w, sel_h);
@ -133,15 +161,15 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
selection_position = [ sel_x0, sel_y0 ];
selection_size = [ sel_w, sel_h ];
is_selected = true;
} #endregion
}
function copySelection() { #region
function copySelection() {
var s = surface_encode(selection_surface, false);
s.position = selection_position;
clipboard_set_text(json_stringify(s));
} #endregion
}
function apply() { #region
function apply() {
var _drawLay = node.tool_attribute.drawLayer;
var _sw = surface_get_width(_canvas_surface);
var _sh = surface_get_height(_canvas_surface);
@ -172,9 +200,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
node.surface_store_buffer();
is_selected = false;
} #endregion
}
function onSelected(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
function onSelected(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(!is_surface(selection_surface)) {
is_selected = false;
return;
@ -196,6 +224,7 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
var pos_y = selection_position[1];
var sel_w = surface_get_width_safe(selection_surface);
var sel_h = surface_get_height_safe(selection_surface);
var _app = true;
if(point_in_rectangle(mouse_cur_x, mouse_cur_y, pos_x, pos_y, pos_x + sel_w, pos_y + sel_h)) {
var _c = surface_getpixel_ext(selection_mask, mouse_cur_x - pos_x, mouse_cur_y - pos_y);
@ -205,32 +234,35 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
selection_sy = pos_y;
selection_mx = mouse_cur_x;
selection_my = mouse_cur_y;
_app = false;
}
}
if(_app && PANEL_PREVIEW.tool_current == noone)
apply();
}
if(key_press(vk_delete)) {
is_selected = false;
surface_free(selection_surface);
} else if(key_press(vk_escape)) {
} else if(key_press(vk_escape))
apply();
}
}
} #endregion
function step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
function step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
mouse_cur_x = round((_mx - _x) / _s - 0.5);
mouse_cur_y = round((_my - _y) / _s - 0.5);
if(is_selected) { onSelected(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); return; }
else if(is_surface(selection_surface)) { apply(); }
} #endregion
}
function onDrawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {}
function drawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
function drawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var sel_x0, sel_y0;
if(is_selecting) {
@ -247,9 +279,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
draw_surface_ext_safe(selection_mask, _dx, _dy, _s, _s);
onDrawMask(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
} #endregion
}
function drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
function drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(!is_selected) {
if(!is_selecting) {
var x0 = _x + mouse_cur_x * _s;
@ -273,11 +305,11 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
draw_set_color(c_white);
draw_rectangle_dashed(pos_x, pos_y, pos_x + sel_w, pos_y + sel_h, true, 6, current_time / 100);
} #endregion
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function rotate90cw() { #region
function rotate90cw() {
var _sw = surface_get_width(selection_surface);
var _sh = surface_get_height(selection_surface);
@ -288,9 +320,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
surface_free(selection_surface);
selection_surface = _newS;
} #endregion
}
function rotate90ccw() { #region
function rotate90ccw() {
var _sw = surface_get_width(selection_surface);
var _sh = surface_get_height(selection_surface);
@ -301,9 +333,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
surface_free(selection_surface);
selection_surface = _newS;
} #endregion
}
function flipH() { #region
function flipH() {
var _sw = surface_get_width(selection_surface);
var _sh = surface_get_height(selection_surface);
@ -314,9 +346,9 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
surface_free(selection_surface);
selection_surface = _newS;
} #endregion
}
function flipV() { #region
function flipV() {
var _sw = surface_get_width(selection_surface);
var _sh = surface_get_height(selection_surface);
@ -327,5 +359,5 @@ function canvas_tool_selection(selector = noone) : canvas_tool() constructor {
surface_free(selection_surface);
selection_surface = _newS;
} #endregion
}
}

View file

@ -38,7 +38,7 @@
LATEST_VERSION = 11700;
VERSION = 11760;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.6.003";
VERSION_STRING = "1.17.6.004";
BUILD_NUMBER = 11760;
globalvar HOTKEYS, HOTKEY_CONTEXT;

View file

@ -715,19 +715,20 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_tool.subtool = _currTool.selecting;
array_append(rightTools, _tool.rightTools);
}
}
if(tool_selection.is_selected) {
tool_selection.node = self;
tool_selection.drawing_surface = drawing_surface;
tool_selection._canvas_surface = _canvas_surface;
tool_selection.apply_draw_surface = apply_draw_surface;
if(is_instanceof(_tool, canvas_tool_selection) && tool_selection.is_selected) tool_selection.step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
tool_selection.step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
tool_mirror_edit.sprs = (!tool_selection.is_selected && tool_attribute.mirror[0])? THEME.canvas_mirror_diag : THEME.canvas_mirror;
}
if(tool_selection.is_selected) array_append(rightTools, rightTools_selection);
else array_append(rightTools, rightTools_not_selection);
array_append(rightTools, rightTools_selection);
} else
array_append(rightTools, rightTools_not_selection);
if(_tool && _tool.override) {
_tool.node = self;
@ -906,11 +907,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var _surf = surface_decode(_str);
if(surface_exists(_surf)) {
tool_selection.selection_surface = _surf;
tool_selection.is_selected = true;
tool_selection.selection_position = [ 0, 0 ];
tool_selection.selection_size = [ surface_get_width(_surf), surface_get_height(_surf) ];
tool_selection.createSelectionFromSurface(_surf);
surface_free(_surf);
if(key_mod_press(SHIFT)) {
var _sel_pos = struct_try_get(_str, "position", [ 0, 0 ]);
@ -1121,6 +1119,29 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
return self;
} #endregion
static dropPath = function(path) {
if(!file_exists_empty(path)) return noone;
if(tool_selection.is_selected)
tool_selection.apply();
var _spr = sprite_add(path, 0, 0, 0, 0, 0);
if(_spr == -1) return noone;
var _sw = sprite_get_width(_spr);
var _sh = sprite_get_height(_spr);
var surf = surface_create(_sw, _sh);
surface_set_shader(surf, noone);
draw_sprite(_spr, 0, 0, 0);
surface_reset_shader();
sprite_delete(_spr);
tool_selection.createSelectionFromSurface(surf);
surface_free(surf);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -297,6 +297,10 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
canvases[i].inputs[| 0].setValue(_dim);
}
static dropPath = function(path) {
if(canvas_sel) canvas_sel.dropPath(path);
}
static getPreviewValues = function() { return composite == noone? noone : composite.getPreviewValues(); }
static postDeserialize = function() {

View file

@ -2321,6 +2321,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
} #endregion
static dropPath = noone;
static clone = function(target = PANEL_GRAPH.getCurrentContext()) { #region
CLONING = true;
var _type = instanceof(self);

View file

@ -2049,18 +2049,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
else if(UPDATE == RENDER_TYPE.partial)
draw_text(w - ui(8), ui(28), __txtx("panel_graph_rendering_partial", "Rendering partial") + "...");
if(DRAGGING && pHOVER) { #region file dropping
if(node_hovering && node_hovering.droppable(DRAGGING)) {
node_hovering.draw_droppable = true;
if(mouse_release(mb_left))
node_hovering.onDrop(DRAGGING);
} else {
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, 2, 2, w - 4, h - 4, COLORS._main_value_positive, 1);
if(mouse_release(mb_left))
checkDropItem();
}
} #endregion
graph_dragging_key = false;
graph_zooming_key = false;
@ -2071,20 +2059,36 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
////////////////////////////////// File drop //////////////////////////////////
if(!array_empty(FILE_DROPPING)) {
load_file_path(FILE_DROPPING);
FILE_DROPPING = [];
}
if(pHOVER) {
var _gx = mx / graph_s - graph_x;
var _gy = my / graph_s - graph_y;
if(FILE_IS_DROPPING)
if(DRAGGING) { // file dropping
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
if(FILE_DROPPED && !array_empty(FILE_DROPPING))
if(node_hovering && node_hovering.droppable(DRAGGING)) {
node_hovering.draw_droppable = true;
if(mouse_release(mb_left))
node_hovering.onDrop(DRAGGING);
} else {
if(mouse_release(mb_left))
checkDropItem();
}
}
var _mx = (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx) - x;
var _my = (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my) - y;
var _gx = _mx / graph_s - graph_x;
var _gy = _my / graph_s - graph_y;
if(FILE_IS_DROPPING) {
// draw_sprite_stretched_ext(THEME.node_bg, 1, _mx, _my, 128 * graph_s, 128 * graph_s, COLORS._main_value_positive, 1);
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
}
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);
}
}
} #endregion

View file

@ -2064,11 +2064,26 @@ function Panel_Preview() : PanelContent() constructor {
],, getNodePreview());
}
if(pHOVER) {
if(FILE_IS_DROPPING)
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
////////////////////////////////// File drop //////////////////////////////////
if(FILE_DROPPED && !array_empty(FILE_DROPPING)) {}
if(pHOVER) {
var _node = getNodePreview();
if(_node && _node.dropPath != noone) {
if(DRAGGING && DRAGGING.type == "Asset") {
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
if(mouse_release(mb_left))
_node.dropPath(DRAGGING.data.path);
}
if(FILE_IS_DROPPING)
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
if(FILE_DROPPED && !array_empty(FILE_DROPPING))
_node.dropPath(FILE_DROPPING[0]);
}
}
} #endregion