浏览代码

[assist] Maintain the ratio of the inner assist panels on window resize

Johan Ahlen 10 年之前
父节点
当前提交
160afdaae4
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 11 - 2
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -878,7 +878,9 @@
 
 
       $resizer.parent().height();
       $resizer.parent().height();
 
 
-      var aboveInitialHeight = ($resizer.parent().height() - $resizer.height()) / 2;
+      var aboveRatio = 0.5;
+
+      var aboveInitialHeight = ($resizer.parent().height() - $resizer.height()) * aboveRatio;
       var belowInitialHeight = aboveInitialHeight;
       var belowInitialHeight = aboveInitialHeight;
 
 
       $above.css("height", aboveInitialHeight + 'px');
       $above.css("height", aboveInitialHeight + 'px');
@@ -888,8 +890,9 @@
         axis: "y",
         axis: "y",
         drag: function (event, ui) {
         drag: function (event, ui) {
           var currentHeight = ui.offset.top - 81;
           var currentHeight = ui.offset.top - 81;
+          aboveRatio = currentHeight / ($resizer.parent().height() - $resizer.height());
           $above.css("height", currentHeight + 'px');
           $above.css("height", currentHeight + 'px');
-          $below.css("height", ($resizer.parent().height() - currentHeight - $resizer.height()))
+          $below.css("height", ($resizer.parent().height() - currentHeight - $resizer.height() - 30));
           ui.offset.top = 0;
           ui.offset.top = 0;
           ui.position.top = 0;
           ui.position.top = 0;
         },
         },
@@ -898,6 +901,12 @@
           ui.position.top = 0;
           ui.position.top = 0;
         }
         }
       });
       });
+
+      $(window).resize(function () {
+        var aboveHeight = ($resizer.parent().height() - $resizer.height()) * aboveRatio;
+        $above.css("height", aboveHeight + 'px');
+        $below.css("height", ($resizer.parent().height() - aboveHeight - $resizer.height() - 30));
+      });
     }
     }
   };
   };