浏览代码

prevent drag and drop of file until local scripts are loaded

Gary Hsu 7 年之前
父节点
当前提交
7346496534
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      sandbox/index-local.html

+ 9 - 2
sandbox/index-local.html

@@ -27,11 +27,11 @@
             <div class="row">
                 <button id="playBtn" class="pause">
                     <img id="playImg" src="Assets/Icon_Play.svg">
-                    <img id="pauseImg" src="Assets/Icon_Pause.svg">    
+                    <img id="pauseImg" src="Assets/Icon_Pause.svg">
                 </button>
                 <input id="slider" type="range" min="0" max="100" value="0" step="any">
             </div>
-        </div>               
+        </div>
         <div class="footerRight">
             <a href="#" id="btnFullscreen" class="hidden"><img src="./Assets/Icon_Fullscreen.svg" alt="Switch the scene to full screen" title="Switch the scene to full screen" /></a> 
             <a href="#" id="btnInspector" class="hidden"><img src="./Assets/Icon_EditModel.svg" alt="Display inspector" title="Display inspector" /></a> 
@@ -44,6 +44,13 @@
     </div>
     <div id="errorZone"></div>
     <script>
+        // prevent drag and drop of file until local scripts are loaded
+        document.ondragover = function (e) {
+            e.dataTransfer.dropEffect = "none";
+            e.dataTransfer.effectAllowed = "none";
+            e.preventDefault();
+        };
+
         BABYLONDEVTOOLS.Loader
             .require('index.js')
             .load(function () {