Browse Source

Fixed 'Maximise output' button functionality

n1474335 6 years ago
parent
commit
cb9ab7a2c9
2 changed files with 12 additions and 3 deletions
  1. 10 3
      src/web/App.mjs
  2. 2 0
      src/web/OutputWaiter.mjs

+ 10 - 3
src/web/App.mjs

@@ -238,12 +238,18 @@ class App {
 
     /**
      * Sets up the adjustable splitter to allow the user to resize areas of the page.
+     *
+     * @param {boolean} [minimise=false] - Set this flag if attempting to minimuse frames to 0 width
      */
-    initialiseSplitter() {
+    initialiseSplitter(minimise=false) {
+        if (this.columnSplitter) this.columnSplitter.destroy();
+        if (this.ioSplitter) this.ioSplitter.destroy();
+
         this.columnSplitter = Split(["#operations", "#recipe", "#IO"], {
             sizes: [20, 30, 50],
-            minSize: [240, 370, 450],
+            minSize: minimise ? [0, 0, 0] : [240, 370, 450],
             gutterSize: 4,
+            expandToMin: false,
             onDrag: function() {
                 this.manager.recipe.adjustWidth();
             }.bind(this)
@@ -251,7 +257,8 @@ class App {
 
         this.ioSplitter = Split(["#input", "#output"], {
             direction: "vertical",
-            gutterSize: 4
+            gutterSize: 4,
+            minSize: minimise ? [0, 0] : [100, 100]
         });
 
         this.resetLayout();

+ 2 - 0
src/web/OutputWaiter.mjs

@@ -319,6 +319,7 @@ class OutputWaiter {
         const el = e.target.id === "maximise-output" ? e.target : e.target.parentNode;
 
         if (el.getAttribute("data-original-title").indexOf("Maximise") === 0) {
+            this.app.initialiseSplitter(true);
             this.app.columnSplitter.collapse(0);
             this.app.columnSplitter.collapse(1);
             this.app.ioSplitter.collapse(0);
@@ -328,6 +329,7 @@ class OutputWaiter {
         } else {
             $(el).attr("data-original-title", "Maximise output pane");
             el.querySelector("i").innerHTML = "fullscreen";
+            this.app.initialiseSplitter(false);
             this.app.resetLayout();
         }
     }