Skip to content

Commit

Permalink
fix drop from external to internal folder
Browse files Browse the repository at this point in the history
  • Loading branch information
plojo committed Oct 18, 2024
1 parent 73fcba0 commit 60746e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Editor/Build/Fudge/Fudge.js

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion Editor/Source/Fudge/View/Project/ViewInternalFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ namespace Fudge {
if (!(viewSource instanceof ViewExternal || viewSource instanceof ViewHierarchy))
return;

_event.stopPropagation(); // stop the event during capture because we need to process async loading

let resources: ƒ.SerializableResource[] = [];
for (const source of <DirectoryEntry[] | ƒ.Node[]>ƒui.Clipboard.dragDrop.get()) {
if (source instanceof ƒ.Node) {
Expand Down Expand Up @@ -267,9 +269,15 @@ namespace Fudge {
}

ƒui.Clipboard.dragDrop.set(resources);

// redispatch event without capture
this.dom.removeEventListener(ƒui.EVENT.DROP, this.hndDropCapture, true);
_event.target.dispatchEvent(_event);
this.dom.addEventListener(ƒui.EVENT.DROP, this.hndDropCapture, true);

resources.forEach(_resource => {
History.save(HISTORY.ADD, ƒ.Project, _resource);
if (_resource instanceof ƒ.Graph)
if (_resource instanceof ƒ.Graph) // why is this necessary?
History.swap();
});
this.dispatchToParent(EVENT_EDITOR.CREATE, {});
Expand Down

0 comments on commit 60746e6

Please sign in to comment.