Browse Source

add a flag to disable drag and drop, if wanted

Raanan Weber 7 năm trước cách đây
mục cha
commit
0e77d0d773
2 tập tin đã thay đổi với 21 bổ sung11 xóa
  1. 4 1
      Viewer/src/configuration/types/default.ts
  2. 17 10
      Viewer/src/viewer/defaultViewer.ts

+ 4 - 1
Viewer/src/configuration/types/default.ts

@@ -28,7 +28,10 @@ export let defaultConfiguration: ViewerConfiguration = {
             }
         },
         viewer: {
-            html: require("../../../assets/templates/default/defaultViewer.html")
+            html: require("../../../assets/templates/default/defaultViewer.html"),
+            params: {
+                disableDragAndDrop: false
+            }
         },
         navBar: {
             html: require("../../../assets/templates/default/navbar.html"),

+ 17 - 10
Viewer/src/viewer/defaultViewer.ts

@@ -46,16 +46,23 @@ export class DefaultViewer extends AbstractViewer {
             });
         }
 
-        let filesInput = new FilesInput(this.engine, this.sceneManager.scene, () => {
-        }, () => {
-        }, () => {
-        }, () => {
-        }, function () {
-        }, (file: File) => {
-            this.loadModel(file);
-        }, () => {
-        });
-        filesInput.monitorElementForDragNDrop(this.templateManager.getCanvas()!);
+        if (this.configuration.templates && this.configuration.templates.viewer) {
+            if (this.configuration.templates.viewer.params && this.configuration.templates.viewer.params.disableDragAndDrop) {
+                // noop for now
+            } else {
+                let filesInput = new FilesInput(this.engine, this.sceneManager.scene, () => {
+                }, () => {
+                }, () => {
+                }, () => {
+                }, function () {
+                }, (file: File) => {
+                    this.loadModel(file);
+                }, () => {
+                });
+                filesInput.monitorElementForDragNDrop(this.templateManager.getCanvas()!);
+            }
+        }
+
 
         return super._onTemplatesLoaded();
     }