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/src/key_handler.coffee | |
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/src/key_handler.coffee')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/jqTree/src/key_handler.coffee | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/ecomp-portal-FE/client/bower_components/jqTree/src/key_handler.coffee b/ecomp-portal-FE/client/bower_components/jqTree/src/key_handler.coffee deleted file mode 100644 index c8c17e7c..00000000 --- a/ecomp-portal-FE/client/bower_components/jqTree/src/key_handler.coffee +++ /dev/null @@ -1,107 +0,0 @@ -$ = jQuery - - -class KeyHandler - LEFT = 37 - UP = 38 - RIGHT = 39 - DOWN = 40 - - constructor: (tree_widget) -> - @tree_widget = tree_widget - - if tree_widget.options.keyboardSupport - $(document).bind('keydown.jqtree', $.proxy(@handleKeyDown, this)) - - deinit: -> - $(document).unbind('keydown.jqtree') - - moveDown: -> - node = @tree_widget.getSelectedNode() - - if node - return @selectNode(node.getNextNode()) - else - return false - - moveUp: -> - node = @tree_widget.getSelectedNode() - - if node - return @selectNode(node.getPreviousNode()) - else - return false - - moveRight: -> - node = @tree_widget.getSelectedNode() - - if not node - return true - else if not node.isFolder() - return true - else - # folder node - if node.is_open - # Right moves to the first child of an open node - return @selectNode(node.getNextNode()) - else - # Right expands a closed node - @tree_widget.openNode(node) - return false - - moveLeft: -> - node = @tree_widget.getSelectedNode() - - if not node - return true - else if node.isFolder() and node.is_open - # Left on an open node closes the node - @tree_widget.closeNode(node) - return false - else - # Left on a closed or end node moves focus to the node's parent - return @selectNode(node.getParent()) - - handleKeyDown: (e) -> - if not @tree_widget.options.keyboardSupport - return true - - if $(document.activeElement).is('textarea,input,select') - return true - - if not @tree_widget.getSelectedNode() - return true - - key = e.which - - switch key - when DOWN - return @moveDown() - - when UP - return @moveUp() - - when RIGHT - return @moveRight() - - when LEFT - return @moveLeft() - - return true - - selectNode: (node) => - if not node - return true - else - @tree_widget.selectNode(node) - - if ( - @tree_widget.scroll_handler and - (not @tree_widget.scroll_handler.isScrolledIntoView($(node.element).find('.jqtree-element'))) - ) - @tree_widget.scrollToNode(node) - - return false - - -module.exports = KeyHandler |