Skip to content

Commit

Permalink
Fix debugLoacalScene with newLaoder enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
netpro2k authored and johnshaughnessy committed Jan 31, 2023
1 parent 2713a4d commit 9e56c84
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/load-media-on-paste-or-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,21 @@ async function onPaste(e: ClipboardEvent) {
spawnFromUrl(text);
}

let lastDebugScene: string;
function onDrop(e: DragEvent) {
if (!(AFRAME as any).scenes[0].is("entered")) {
return;
}

if (qsTruthy("debugLocalScene")) {
URL.revokeObjectURL(lastDebugScene);
if (!e.dataTransfer?.files.length) return;
const url = URL.createObjectURL(e.dataTransfer.files[0]);
APP.hubChannel!.updateScene(url);
lastDebugScene = url;
return;
}

const files = e.dataTransfer?.files;
if (files && files.length) {
e.preventDefault();
Expand Down

0 comments on commit 9e56c84

Please sign in to comment.