mirror of
https://gitee.com/antv/g6.git
synced 2024-12-03 04:08:32 +08:00
feat(minimap): minimap won't render when graph is performing animate
This commit is contained in:
parent
e85878f33f
commit
43e08f100e
@ -26,11 +26,24 @@ class Minimap extends Base {
|
||||
delegateStyle: {
|
||||
fill: '#40a9ff',
|
||||
stroke: '#096dd9'
|
||||
}
|
||||
},
|
||||
refresh: true
|
||||
};
|
||||
}
|
||||
getEvents() {
|
||||
return { beforepaint: 'updateCanvas' };
|
||||
return {
|
||||
beforepaint: 'updateCanvas',
|
||||
beforeanimate: 'disableRefresh',
|
||||
afteranimate: 'enableRefresh'
|
||||
};
|
||||
}
|
||||
// 若是正在进行动画,不刷新缩略图
|
||||
disableRefresh() {
|
||||
this.set('refresh', false);
|
||||
}
|
||||
enableRefresh() {
|
||||
this.set('refresh', true);
|
||||
this.updateCanvas();
|
||||
}
|
||||
initContainer() {
|
||||
const self = this;
|
||||
@ -132,6 +145,9 @@ class Minimap extends Base {
|
||||
containerDOM.appendChild(viewport);
|
||||
}
|
||||
updateCanvas() {
|
||||
if (!this.get('refresh')) {
|
||||
return;
|
||||
}
|
||||
const size = this.get('size');
|
||||
const graph = this.get('graph');
|
||||
const canvas = this.get('canvas');
|
||||
|
Loading…
Reference in New Issue
Block a user