improve code

This commit is contained in:
huangtong.ht 2018-08-03 22:04:33 +08:00
parent cacebdf633
commit 92ff7c1134
3 changed files with 5 additions and 6 deletions

View File

@ -128,6 +128,5 @@ G6.registerBehaviour('wheelZoom', graph => {
timeout = setTimeout(() => {
timeout = undefined;
}, 50);
graph.emit('afterzoom');
}
});

View File

@ -106,12 +106,16 @@ Mixin.AUGMENT = {
* @return {Graph} this
*/
updateMatrix(matrix) {
const originMatrix = this.getMatrix();
const ev = {
updateMatrix: matrix,
originMatrix: this.getMatrix()
originMatrix
};
const zoomBool = originMatrix[0] !== matrix[0];
this.emit('beforeviewportchange', ev);
zoomBool && this.emit('beforezoom', ev);
this.setMatrix(matrix);
zoomBool && this.emit('afterzoom', ev);
this.emit('afterviewportchange', ev);
this.draw();
return this;

View File

@ -66,10 +66,6 @@ Shape.registerNode('common', {
}
return group.addShape('text', {
class: 'label',
freezePoint: {
x: 0,
y: 0
},
attrs
});
},