Comparing version 2.0.5-beta.2 to 2.0.5-beta.3
{ | ||
"name": "@antv/g", | ||
"version": "2.0.5-beta.2", | ||
"version": "2.0.5-beta.3", | ||
"description": "A canvas library which providing 2d draw for G2.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -125,3 +125,3 @@ # G | ||
* zIndex 层次索引值,决定分组在父容器中的位置 | ||
* visibile 是否可见 | ||
* visible 是否可见 | ||
* children 嵌套的图形元素,只读 | ||
@@ -171,3 +171,3 @@ | ||
* zIndex 层次索引值,决定分组在父容器中的位置 | ||
* visibile 是否可见 | ||
* visible 是否可见 | ||
* attrs 图形属性,通用的图形属性如下: | ||
@@ -174,0 +174,0 @@ + transform 进行几何变换的矩阵 |
@@ -205,6 +205,10 @@ const Util = require('../util/index'); | ||
const destroyed = this.get('destroyed'); | ||
if (destroyed) { | ||
return; | ||
} | ||
// 如果正在执行动画,清理动画 | ||
if (this.get('animating')) { | ||
const timer = this.get('animateTimer'); | ||
timer && timer.stop(); | ||
} | ||
this.__cfg = {}; | ||
@@ -211,0 +215,0 @@ this.__attrs = null; |
@@ -9,2 +9,25 @@ const MatrixUtil = require('../../util/matrix'); | ||
module.exports = { | ||
stopAnimate() { | ||
const self = this; | ||
const canvas = self.get('canvas'); | ||
if (self.get('destroyed')) { | ||
return; | ||
} | ||
if (self.get('animating')) { | ||
const timer = self.get('animateTimer'); | ||
timer && timer.stop(); | ||
const animateCfg = self.get('animateCfg'); | ||
self.attr(animateCfg.toAttrs); | ||
if (animateCfg.toM) { | ||
self.setMatrix(animateCfg.toM); | ||
} | ||
if (animateCfg.callback) { | ||
animateCfg.callback(); | ||
} | ||
self.setSilent('animating', false); // 动画停止 | ||
self.setSilent('animateCfg', null); | ||
self.setSilent('animateTimer', null); | ||
canvas.draw(); | ||
} | ||
}, | ||
/** | ||
@@ -26,5 +49,21 @@ * 执行动画 | ||
const fromM = Util.clone(self.getMatrix()); | ||
easing = easing ? easing : 'easeLinear'; | ||
// 可能不设置 easing | ||
if (Util.isNumber(callback)) { | ||
delay = callback; | ||
callback = null; | ||
} | ||
if (Util.isFunction(easing)) { | ||
callback = easing; | ||
easing = 'easeLinear'; | ||
} else { | ||
easing = easing ? easing : 'easeLinear'; | ||
} | ||
self.setSilent('animating', true); // 处于动画状态 | ||
self.setSilent('animateCfg', { | ||
toAttrs, | ||
toM, | ||
callback | ||
}); | ||
// 执行动画 | ||
@@ -40,2 +79,4 @@ const timer = d3Timer.timer(elapsed => { | ||
self.setSilent('animating', false); // 动画停止 | ||
self.setSilent('animateCfg', null); | ||
self.setSilent('animateTimer', null); | ||
timer.stop(); | ||
@@ -45,2 +86,4 @@ } | ||
self.setSilent('animateTimer', timer); | ||
function update(ratio) { | ||
@@ -47,0 +90,0 @@ const cProps = {}; // 此刻属性 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
878111
21270