Commit 6eb7941b authored by techird's avatar techird

fix performance issue

parent edaec00e
......@@ -29,18 +29,24 @@ KM.registerToolbarUI('template theme', function(name) {
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
}
});
var lastState, lastValue;
//状态反射
me.on('interactchange', function() {
var state = this.queryCommandState(name),
value = this.queryCommandValue(name);
//设置按钮状态
if (lastState != state)
comboboxWidget.button().kmui().disabled(state == -1).active(state == 1);
if (value) {
if (value && value != lastValue) {
// 此处貌似性能很差,加入缓存
comboboxWidget.selectItemByValue(value);
}
lastState = state;
lastValue = value;
});
return comboboxWidget.button().addClass('kmui-combobox');
......
......@@ -29,17 +29,23 @@ KM.registerToolbarUI( 'zoom', function ( name ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
} );
var lastState, lastValue;
//状态反射
me.on( 'interactchange', function () {
var state = this.queryCommandState( name ),
value = this.queryCommandValue( name );
if (state != lastState) {
//设置按钮状态
comboboxWidget.button().kmui().disabled( state == -1 ).active( state == 1 );
if ( value ) {
}
if ( value && value != lastValue ) {
//设置label
comboboxWidget.selectItemByLabel( value + '%' );
}
lastState = state;
lastValue = value;
} );
//comboboxWidget.button().kmui().disabled(-1);
......
......@@ -209,7 +209,8 @@ kity.extendClass(Minder, {
.start(node, duration, 'ease')
.on('finish', function() {
// 可能性能低的时候会丢帧
setTimeout(function() {
clearTimeout(node._lastFixTimeout);
node._lastFixTimeout = setTimeout(function() {
applyMatrix(node, matrix);
me.fire('layoutfinish', {
node: node,
......
......@@ -52,7 +52,11 @@ Minder.Receiver = kity.createClass('Receiver', {
textShape = new kity.Text();
}
this.textShape = textShape;
// techird: add cache
if (textShape._lastContent != textShape.getContent()) {
this.container.innerHTML = utils.unhtml(textShape.getContent());
textShape._lastContent = textShape.getContent();
}
return this;
},
setTextShapeSize: function(size) {
......@@ -132,7 +136,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me.minderNode.getRenderContainer().bringTop();
me.minderNode.render();
//移动光标不做layout
if(!keymap.direction[keyCode]){
if(!keymap.direction[keyCode] && !orgEvt.shiftKey && !orgEvt.metaKey && orgEvt.ctrlKey){
clearTimeout(me.inputTextTimer);
me.inputTextTimer = setTimeout(function(){
......
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