Commit 4aefee2f authored by techird's avatar techird

fix shift + tab issue

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