Commit 4aefee2f authored by techird's avatar techird

fix shift + tab issue

parent 431d53b6
...@@ -200,9 +200,14 @@ kity.extendClass(Minder, { ...@@ -200,9 +200,14 @@ kity.extendClass(Minder, {
applyLayoutResult: function(root, duration) { applyLayoutResult: function(root, duration) {
root = root || this.getRoot(); root = root || this.getRoot();
var me = this; var me = this;
var complex = root.getComplex();
function consume() {
if (!--complex) me.fire('layoutallfinish');
}
// 节点复杂度大于 100,关闭动画 // 节点复杂度大于 100,关闭动画
if (root.getComplex() > 300) duration = 0; if (complex > 300) duration = 0;
function applyMatrix(node, matrix) { function applyMatrix(node, matrix) {
node.getRenderContainer().setMatrix(node._lastLayoutTransform = matrix); node.getRenderContainer().setMatrix(node._lastLayoutTransform = matrix);
...@@ -242,6 +247,7 @@ kity.extendClass(Minder, { ...@@ -242,6 +247,7 @@ kity.extendClass(Minder, {
node: node, node: node,
matrix: matrix matrix: matrix
}); });
consume();
}); });
}); });
} }
...@@ -253,6 +259,7 @@ kity.extendClass(Minder, { ...@@ -253,6 +259,7 @@ kity.extendClass(Minder, {
node: node, node: node,
matrix: matrix matrix: matrix
}); });
consume();
} }
} else { } else {
// 可能位置没有改变,但是相关布局变量变了 // 可能位置没有改变,但是相关布局变量变了
...@@ -264,6 +271,7 @@ kity.extendClass(Minder, { ...@@ -264,6 +271,7 @@ kity.extendClass(Minder, {
node: node, node: node,
matrix: matrix matrix: matrix
}); });
consume();
} }
for (var i = 0; i < node.children.length; i++) { for (var i = 0; i < node.children.length; i++) {
......
...@@ -72,9 +72,7 @@ KityMinder.registerModule('Expand', function() { ...@@ -72,9 +72,7 @@ KityMinder.registerModule('Expand', function() {
function setExpandState(node, state, policy) { function setExpandState(node, state, policy) {
policy = policy || EXPAND_POLICY.KEEP_STATE; policy = policy || EXPAND_POLICY.KEEP_STATE;
policy(node, state, policy); policy(node, state, policy);
node.traverse(function(node) { node.renderTree();
node.render();
});
node.getMinder().layout(100); node.getMinder().layout(100);
} }
......
...@@ -130,7 +130,7 @@ KityMinder.registerModule('KeyboardModule', function() { ...@@ -130,7 +130,7 @@ KityMinder.registerModule('KeyboardModule', function() {
var lastFrame; var lastFrame;
return { return {
'events': { 'events': {
'layoutfinish': function() { 'layoutallfinish': function() {
var root = this.getRoot(); var root = this.getRoot();
function build() { function build() {
buildPositionNetwork(root); buildPositionNetwork(root);
...@@ -138,6 +138,10 @@ KityMinder.registerModule('KeyboardModule', function() { ...@@ -138,6 +138,10 @@ KityMinder.registerModule('KeyboardModule', function() {
kity.Timeline.releaseFrame(lastFrame); kity.Timeline.releaseFrame(lastFrame);
lastFrame = kity.Timeline.requestFrame(build); lastFrame = kity.Timeline.requestFrame(build);
}, },
'inputready.beforekeydown': function(e) {
var keyEvent = e.originEvent;
if (keyEvent.shiftKey && keyEvent.keyCode == KityMinder.keymap.Tab) e.preventDefault();
},
'normal.keydown': function(e) { 'normal.keydown': function(e) {
var keys = KityMinder.keymap; var keys = KityMinder.keymap;
...@@ -148,7 +152,10 @@ KityMinder.registerModule('KeyboardModule', function() { ...@@ -148,7 +152,10 @@ KityMinder.registerModule('KeyboardModule', function() {
var keyEvent = e.originEvent; var keyEvent = e.originEvent;
if (keyEvent.altKey || keyEvent.ctrlKey || keyEvent.metaKey || keyEvent.shiftKey) return; if (keyEvent.altKey || keyEvent.ctrlKey || keyEvent.metaKey || keyEvent.shiftKey) {
if ([keys.Tab].indexOf(keyEvent.keyCode)) e.preventDefault;
return;
}
switch (keyEvent.keyCode) { switch (keyEvent.keyCode) {
case keys.Enter: case keys.Enter:
......
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