From db3821488d9fde8f548ef4b92177bbce42b2089f Mon Sep 17 00:00:00 2001 From: Yueyu Date: Mon, 9 Nov 2020 21:25:27 +0800 Subject: [PATCH] disable drag & drop on images --- src/editor/engine/Sprite.js | 3 +++ src/editor/ui/Library.js | 3 +++ src/lobby/Home.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/editor/engine/Sprite.js b/src/editor/engine/Sprite.js index 7f03243..68198eb 100755 --- a/src/editor/engine/Sprite.js +++ b/src/editor/engine/Sprite.js @@ -107,6 +107,9 @@ export default class Sprite { setCostume (dataurl, fcn) { var img = document.createElement('img'); + img.ondragstart = function () { + return false; + } img.src = dataurl; this.img = img; // Make a copy that is not affected by zoom transformation diff --git a/src/editor/ui/Library.js b/src/editor/ui/Library.js index 76cde19..34ad766 100644 --- a/src/editor/ui/Library.js +++ b/src/editor/ui/Library.js @@ -198,6 +198,9 @@ export default class Library { img.style.top = (7 * scaleMultiplier) + 'px'; img.style.position = 'relative'; img.style.height = (data.height * scale) + 'px'; + img.ondragstart = function () { + return false; + } if (data.altmd5) { IO.getAsset(data.altmd5, drawMe); } diff --git a/src/lobby/Home.js b/src/lobby/Home.js index 6a78204..36b290e 100755 --- a/src/lobby/Home.js +++ b/src/lobby/Home.js @@ -300,6 +300,9 @@ export default class Home { if (md5) { IO.getAsset(md5, drawMe); } + img.ondragstart = function () { + return false; + } function drawMe (url) { img.src = url; }