Преглед изворни кода

[editor] Only pan the results grid when the alt-key is down

This enables selection of the grid contents.
Johan Ahlen пре 10 година
родитељ
комит
0251fc6b4c
1 измењених фајлова са 27 додато и 1 уклоњено
  1. 27 1
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

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

@@ -1229,7 +1229,33 @@ ${ require.config() }
           clonedContainerPosition: "absolute"
         });
 
-        $('.dataTables_wrapper').kinetic();
+        var originialAttachListeners = $.Kinetic.prototype._attachListeners;
+        $.Kinetic.prototype._attachListeners = function($el, listeners) {
+          var kinetic = this;
+          var altDown = false;
+          $(window).bind("keydown", "alt", function (e) {
+            kinetic.$el.css('cursor', 'move');
+            altDown = true;
+          });
+          $(window).bind("keyup", "alt", function (e) {
+            altDown = false;
+            kinetic.$el.css('cursor', '');
+          });
+          var altDownListener = function (listener) {
+            return function(e) {
+              if (altDown) {
+                listener.apply(this, arguments);
+              }
+            }
+          }
+          listeners.events.inputDown = altDownListener(listeners.events.inputDown);
+          listeners.events.selectStart = altDownListener(listeners.events.selectStart);
+          originialAttachListeners.apply(this, arguments)
+        }
+
+        $('.dataTables_wrapper').kinetic({
+          cursor: ''
+        });
       },
       "aoColumnDefs": [
         {