diff options
author | 2017-05-04 07:48:42 -0400 | |
---|---|---|
committer | 2017-05-04 12:28:17 -0400 | |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js b/ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js deleted file mode 100644 index 9c050aca..00000000 --- a/ecomp-portal-FE/client/bower_components/jqTree/lib/key_handler.js +++ /dev/null @@ -1,120 +0,0 @@ -var $, KeyHandler, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - -$ = jQuery; - -KeyHandler = (function() { - var DOWN, LEFT, RIGHT, UP; - - LEFT = 37; - - UP = 38; - - RIGHT = 39; - - DOWN = 40; - - function KeyHandler(tree_widget) { - this.selectNode = bind(this.selectNode, this); - this.tree_widget = tree_widget; - if (tree_widget.options.keyboardSupport) { - $(document).bind('keydown.jqtree', $.proxy(this.handleKeyDown, this)); - } - } - - KeyHandler.prototype.deinit = function() { - return $(document).unbind('keydown.jqtree'); - }; - - KeyHandler.prototype.moveDown = function() { - var node; - node = this.tree_widget.getSelectedNode(); - if (node) { - return this.selectNode(node.getNextNode()); - } else { - return false; - } - }; - - KeyHandler.prototype.moveUp = function() { - var node; - node = this.tree_widget.getSelectedNode(); - if (node) { - return this.selectNode(node.getPreviousNode()); - } else { - return false; - } - }; - - KeyHandler.prototype.moveRight = function() { - var node; - node = this.tree_widget.getSelectedNode(); - if (!node) { - return true; - } else if (!node.isFolder()) { - return true; - } else { - if (node.is_open) { - return this.selectNode(node.getNextNode()); - } else { - this.tree_widget.openNode(node); - return false; - } - } - }; - - KeyHandler.prototype.moveLeft = function() { - var node; - node = this.tree_widget.getSelectedNode(); - if (!node) { - return true; - } else if (node.isFolder() && node.is_open) { - this.tree_widget.closeNode(node); - return false; - } else { - return this.selectNode(node.getParent()); - } - }; - - KeyHandler.prototype.handleKeyDown = function(e) { - var key; - if (!this.tree_widget.options.keyboardSupport) { - return true; - } - if ($(document.activeElement).is('textarea,input,select')) { - return true; - } - if (!this.tree_widget.getSelectedNode()) { - return true; - } - key = e.which; - switch (key) { - case DOWN: - return this.moveDown(); - case UP: - return this.moveUp(); - case RIGHT: - return this.moveRight(); - case LEFT: - return this.moveLeft(); - } - return true; - }; - - KeyHandler.prototype.selectNode = function(node) { - if (!node) { - return true; - } else { - this.tree_widget.selectNode(node); - if (this.tree_widget.scroll_handler && (!this.tree_widget.scroll_handler.isScrolledIntoView($(node.element).find('.jqtree-element')))) { - this.tree_widget.scrollToNode(node); - } - return false; - } - }; - - return KeyHandler; - -})(); - -module.exports = KeyHandler; |