Commit d3c45fb7 authored by campaign's avatar campaign

键盘性能优化

parent 6a8d86c2
...@@ -12,7 +12,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -12,7 +12,7 @@ KityMinder.registerModule('TextEditModule', function() {
//鼠标被点击,并未太抬起时为真 //鼠标被点击,并未太抬起时为真
var mouseDownStatus = false; var mouseDownStatus = false;
var mouseupTimer;
//当前是否有选区存在 //当前是否有选区存在
var selectionReadyShow = false; var selectionReadyShow = false;
...@@ -109,6 +109,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -109,6 +109,7 @@ KityMinder.registerModule('TextEditModule', function() {
textGroup.setStyle('cursor', 'text'); textGroup.setStyle('cursor', 'text');
sel.setShowStatus(); sel.setShowStatus();
setTimeout(function() { setTimeout(function() {
sel.collapse(true) sel.collapse(true)
.updatePosition(receiver.getOffsetByIndex()) .updatePosition(receiver.getOffsetByIndex())
.setShow(); .setShow();
...@@ -129,7 +130,10 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -129,7 +130,10 @@ KityMinder.registerModule('TextEditModule', function() {
}, },
'inputready.keyup':function(e){ 'inputready.keyup':function(e){
if(sel.isHide()){ if(sel.isHide()){
inputStatusReady(this.getSelectedNode()); var me = this;
setTimeout(function(){
inputStatusReady(me.getSelectedNode());
});
} }
}, },
...@@ -145,7 +149,10 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -145,7 +149,10 @@ KityMinder.registerModule('TextEditModule', function() {
!orgEvt.metaKey && !orgEvt.metaKey &&
!orgEvt.shiftKey && !orgEvt.shiftKey &&
!orgEvt.altKey) { !orgEvt.altKey) {
setTimeout(function(){
inputStatusReady(node); inputStatusReady(node);
})
} }
} }
} }
...@@ -173,7 +180,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -173,7 +180,7 @@ KityMinder.registerModule('TextEditModule', function() {
receiver.focus(); receiver.focus();
} }
setTimeout(function() { mouseupTimer = setTimeout(function() {
sel.collapse(true) sel.collapse(true)
.updatePosition(receiver.getOffsetByIndex()) .updatePosition(receiver.getOffsetByIndex())
.setShow(); .setShow();
...@@ -231,11 +238,15 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -231,11 +238,15 @@ KityMinder.registerModule('TextEditModule', function() {
var node = e.getTargetNode(); var node = e.getTargetNode();
if(node){ if(node){
//清理mouseup的timer
clearTimeout(mouseupTimer);
inputStatusReady(node); inputStatusReady(node);
km.setStatus('textedit'); km.setStatus('textedit');
receiver.updateSelection(); receiver.updateSelection();
} }
}, },
......
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