Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added right click handler to tree nodes.

  • Loading branch information...
commit 7e27b3e586e4a3090822415abbe45f520af1639e 1 parent e3ac2e3
madcapnmckay authored
Showing with 16 additions and 2 deletions.
  1. +16 −2 js/ui-tree.js
View
18 js/ui-tree.js
@@ -239,10 +239,21 @@
});
}.bind(this);
- this.doubleClick = function () {
+ this.doubleClick = function (event) {
viewModel.handlers.doubleClick(this);
}.bind(this);
+ this.clicked = function(event) {
+ switch (event.which) {
+ case 1:
+ this.selectNode();
+ break;
+ case 3:
+ viewModel.handlers.rightClick(this);
+ break;
+ }
+ }.bind(this);
+
this.toggleFolder = function () {
this.isOpen(!this.isOpen());
viewModel.recalculateSizes();
@@ -300,6 +311,9 @@
doubleClick : function (node) {
logger('doubled clicked ' + node.name(), configuration.logTo);
},
+ rightClick : function (node) {
+ logger('right click ' + node.name(), configuration.logTo);
+ },
startDrag : function (node) {
logger('start drag', configuration.logTo);
},
@@ -394,7 +408,7 @@
{{else}}\
<li class=\"${cssClass}\" data-bind=\"css: { empty: !hasChildren(), open: isOpen, rename: isRenaming }\" data-id=\"${ id() }\">\
{{/if}}\
- <div class=\"node\" data-bind=\"nodeDrag : isDraggable(), nodeDrop: { active : isDropTarget(), onDropComplete: move }, css :{ selected: isSelected }, click: selectNode, hover : 'hover', event : { dblclick : doubleClick }\">\
+ <div class=\"node\" data-bind=\"nodeDrag : isDraggable(), nodeDrop: { active : isDropTarget(), onDropComplete: move }, css :{ selected: isSelected }, hover : 'hover', event : { dblclick : doubleClick, mousedown: clicked }\">\
{{if hasChildren() }}\
<span class=\"handle\" data-bind=\"click: toggleFolder, bubble : false, style: { marginLeft: indent() }, hover : 'hover'\"></span>{{else}}<span class=\"handle\" data-bind=\"style: { marginLeft: indent() }\"></span>{{/if}}<span class=\"icon\"></span><label data-bind=\"visible: !isRenaming()\" unselectable=\"on\">${ name }</label><input class=\"rename\" type=\"text\" data-bind=\"nodeRename: name, onRenameComplete : rename, nodeSelectVisible: isRenaming\"/>\
</div>\
Please sign in to comment.
Something went wrong with that request. Please try again.