diff --git a/src/chart/base.js b/src/chart/base.js index dda88dbda70038584af13adb839fed77dffc9f01..c66fcbba8123149fb6fa5bf1bf015bfc2e8a3af1 100644 --- a/src/chart/base.js +++ b/src/chart/base.js @@ -1477,6 +1477,7 @@ define(function (require) { case 'mark-line' : ecAnimation.markline(this.zr, oldShape, newShape, duration, easing); break; + case 'bezier-curve' : case 'line' : ecAnimation.line(this.zr, oldShape, newShape, duration, easing); break; diff --git a/src/util/ecAnimation.js b/src/util/ecAnimation.js index 0625a6c7728573095dfd849929ad224ce0397fdd..6e1e42106467a022e66b719708987ed651eed778 100644 --- a/src/util/ecAnimation.js +++ b/src/util/ecAnimation.js @@ -96,6 +96,7 @@ define(function (require) { var newShapeStyle = newShape.style; if (!oldShape) { // add oldShape = { + position : newShape.position, style : { x : newShapeStyle.x, y : newShape._orient == 'vertical' @@ -113,12 +114,25 @@ define(function (require) { var newY = newShapeStyle.y; var newWidth = newShapeStyle.width; var newHeight = newShapeStyle.height; + var newPosition = [newShape.position[0], newShape.position[1]]; cloneStyle( newShape, oldShape, 'x', 'y', 'width', 'height' ); + newShape.position = oldShape.position; zr.addShape(newShape); + if (newPosition[0] != oldShape.position[0] || newPosition[1] != oldShape.position[1]) { + zr.animate(newShape.id, '') + .when( + duration, + { + position: newPosition + } + ) + .start(easing); + } + zr.animate(newShape.id, 'style') .when( duration, @@ -445,6 +459,8 @@ define(function (require) { if (!oldShape) { oldShape = { style : { + xStart : newShape.style.xStart, + yStart : newShape.style.yStart, xEnd : newShape.style.xStart, yEnd : newShape.style.yStart }