瀏覽代碼

show and hide functionality for the viewer

Raanan Weber 7 年之前
父節點
當前提交
729765b738
共有 1 個文件被更改,包括 24 次插入0 次删除
  1. 24 0
      Viewer/src/viewer/defaultViewer.ts

+ 24 - 0
Viewer/src/viewer/defaultViewer.ts

@@ -241,6 +241,30 @@ export class DefaultViewer extends AbstractViewer {
     }
 
     /**
+     * show the viewer (in case it was hidden)
+     * 
+     * @param visibilityFunction an optional function to execute in order to show the container
+     */
+    public show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template> {
+        let template = this.templateManager.getTemplate('main');
+        //not possible, but yet:
+        if (!template) return Promise.reject('Main template not found');
+        return template.show(visibilityFunction);
+    }
+
+    /**
+     * hide the viewer (in case it is visible)
+     * 
+     * @param visibilityFunction an optional function to execute in order to hide the container
+     */
+    public hide(visibilityFunction?: ((template: Template) => Promise<Template>)) {
+        let template = this.templateManager.getTemplate('main');
+        //not possible, but yet:
+        if (!template) return Promise.reject('Main template not found');
+        return template.hide(visibilityFunction);
+    }
+
+    /**
      * Show the loading screen.
      * The loading screen can be configured using the configuration object
      */