Browse Source

HUE-4610 [editor] Avoid trembling of fixed headers on query editing

Enrico Berti 9 years ago
parent
commit
16195017fa

+ 3 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1467,6 +1467,9 @@
             $target.height(8 * 16);
             $target.height(8 * 16);
             resized = true;
             resized = true;
           }
           }
+          if (ace().session.getLength() == editorHeight) {
+            resized = false;
+          }
           if (resized) {
           if (resized) {
             ace().resize();
             ace().resize();
             editorHeight = Math.min(maxAutoLines, ace().session.getLength());
             editorHeight = Math.min(maxAutoLines, ace().session.getLength());

+ 3 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2836,6 +2836,7 @@ ${ hueIcons.symbols() }
 
 
     window.hideFixedHeaders = hideFixedHeaders;
     window.hideFixedHeaders = hideFixedHeaders;
 
 
+    var redrawTimeout = -1;
     var redrawFixedHeaders = function (timeout) {
     var redrawFixedHeaders = function (timeout) {
       var renderer = function() {
       var renderer = function() {
         if (! viewModel.selectedNotebook()) {
         if (! viewModel.selectedNotebook()) {
@@ -2867,7 +2868,8 @@ ${ hueIcons.symbols() }
         });
         });
       }
       }
       if (timeout){
       if (timeout){
-        window.setTimeout(renderer, timeout);
+        window.clearTimeout(redrawTimeout);
+        redrawTimeout = window.setTimeout(renderer, timeout);
       } else {
       } else {
         renderer();
         renderer();
       }
       }