Commit ef6bcd56 authored by techird's avatar techird

体验优化

parent d81b8019
......@@ -35,8 +35,8 @@ KityMinder.LANG['zh-cn'] = {
'image': '插入图片',
'hyperlink': '插入链接',
'unhyperlink': '删除链接',
'expandnode': '展开节点',
'collapsenode': '收起节点',
'expandnode': '展开到叶子',
'collapsenode': '收起到一级节点',
'template': '模板',
'theme': '皮肤'
},
......
......@@ -38,6 +38,7 @@ var DropHinter = kity.createClass('DropHinter', {
target.getStyle('drop-hint-color') || 'yellow',
target.getStyle('drop-hint-width') || 2
);
this.bringTop();
}
}
});
......
......@@ -117,8 +117,7 @@ KityMinder.registerModule('Expand', function() {
var ExpandNodeCommand = kity.createClass('ExpandNodeCommand', {
base: Command,
execute: function(km) {
var nodes = km.getSelectedNodes();
if (!nodes.length) nodes.push(km.getRoot());
var nodes = km.getRoot().getChildren();
nodes.forEach(function(node) {
node.expand(EXPAND_POLICY.DEEP_TO_LEAF);
});
......@@ -218,10 +217,6 @@ KityMinder.registerModule('Expand', function() {
}
});
return {
addShortcutKeys: {
'ExpandNode': 'ctrl+/', //expand
'CollapseNode': 'ctrl+.' //collapse
},
commands: {
'ExpandNode': ExpandNodeCommand,
'CollapseNode': CollapseNodeCommand
......@@ -241,6 +236,17 @@ KityMinder.registerModule('Expand', function() {
var visible = !node.parent || node.parent.isExpanded();
node.getRenderContainer().setVisible(visible);
if (!visible) e.stopPropagation();
},
'beforekeydown': function(e) {
if (e.originEvent.keyCode == keymap['/']) {
var expanded = this.getSelectedNode().isExpanded();
this.getSelectedNodes().forEach(function(node) {
if (expanded) node.collapse();
else node.expand();
});
e.preventDefault();
e.stopPropagationImmediately();
}
}
},
renderers: {
......
......@@ -41,9 +41,7 @@ KityMinder.registerTheme('snow', {
'marquee-stroke': 'white',
'drop-hint-color': 'yellow',
'sub-drop-hint-width': 2,
'main-drop-hint-width': 4,
'root-drop-hint-width': 4,
'drop-hint-width': 4,
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment