改变树点击,双击,右击事件

This commit is contained in:
Van 2014-10-09 15:48:27 +08:00
parent 88d598aef5
commit f0f275133c
3 changed files with 16 additions and 4 deletions

View File

@ -76,7 +76,7 @@ var hotkeys = {
}
// 模拟点击:打开文件
tree._onClick(wide.curNode);
tree.openFile(wide.curNode);
break;
case 38: // 上

View File

@ -70,7 +70,7 @@ var session = {
for (var m = 0, mm = files.length; m < mm; m++) {
for (var n = 0, nn = nodesToOpen.length; n < nn; n++) {
if (nodesToOpen[n].path === files[m]) {
tree._onClick(nodesToOpen[n]);
tree.openFile(nodesToOpen[n]);
break;
}
}

View File

@ -103,9 +103,16 @@ var tree = {
selectedMulti: false
},
callback: {
onDblClick: function (event, treeId, treeNode) {
if (treeNode) {
tree._openFile(treeNode);
}
},
onRightClick: function (event, treeId, treeNode) {
if (treeNode) {
wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode);
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果右击了文件
$("#fileRMenu ul").show();
fileRMenu.css({
@ -121,10 +128,15 @@ var tree = {
"display": "block"
});
}
$("#files").focus();
}
},
onClick: function (event, treeId, treeNode, clickFlag) {
tree._onClick(treeNode);
if (treeNode) {
wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode);
$("#files").focus();
}
}
}
};
@ -135,7 +147,7 @@ var tree = {
}
});
},
_onClick: function (treeNode) {
openFile: function (treeNode) {
wide.curNode = treeNode;
for (var i = 0, ii = editors.data.length; i < ii; i++) {