Skip to content

Commit

Permalink
fix #896 #974 legendHoverLink
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Jan 29, 2015
1 parent 8e8f1f1 commit b98dc96
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/component/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ define(function (require) {
|| self.type == ecConfig.CHART_TYPE_FUNNEL
? ecData.get(self.shapeList[i], 'name')
: (ecData.get(self.shapeList[i], 'series') || {}).name;
if (name == targetName && !self.shapeList[i].invisible) {
if (name == targetName
&& !self.shapeList[i].invisible
&& !self.shapeList[i]._animating
) {
self.zr.addHoverShape(self.shapeList[i]);
}
}
Expand Down
56 changes: 56 additions & 0 deletions src/util/ecAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ define(function (require) {
}

zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
{ pointList: newPointList }
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand Down Expand Up @@ -133,6 +137,7 @@ define(function (require) {
.start(easing);
}

newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -143,6 +148,9 @@ define(function (require) {
height: newHeight
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -164,11 +172,15 @@ define(function (require) {
var newY = newShape.style.y;
newShape.style.y = oldShape.style.y;
zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
{ y: newY }
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -187,6 +199,8 @@ define(function (require) {
var r0 = newShape.style.r0;
var r = newShape.style.r;

newShape._animating = true;

if (newShape._animationAdd != 'r') {
newShape.style.r0 = 0;
newShape.style.r = 0;
Expand All @@ -201,6 +215,9 @@ define(function (require) {
r : r
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
zr.animate(newShape.id, '')
.when(
Expand All @@ -220,6 +237,9 @@ define(function (require) {
r0 : r0
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}
}
Expand Down Expand Up @@ -257,6 +277,7 @@ define(function (require) {
);

zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -265,6 +286,9 @@ define(function (require) {
endAngle : endAngle
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand Down Expand Up @@ -298,6 +322,7 @@ define(function (require) {
);

zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -306,6 +331,9 @@ define(function (require) {
y : y
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -325,13 +353,17 @@ define(function (require) {

newShape.scale = [0.1, 0.1, x, y];
zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, '')
.when(
duration,
{
scale : [1, 1, x, y]
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand Down Expand Up @@ -369,6 +401,7 @@ define(function (require) {
}

zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -379,6 +412,9 @@ define(function (require) {
target1 : target1
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -403,13 +439,17 @@ define(function (require) {
var angle = newShape.style.angle;
newShape.style.angle = oldShape.style.angle;
zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
{
angle : angle
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -434,12 +474,16 @@ define(function (require) {
var y = newShape._y || 0;
newShape.scale = [0.01, 0.01, x, y];
zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, '')
.delay(delay)
.when(
duration,
{scale : [1, 1, x, y]}
)
.done(function() {
newShape._animating = false;
})
.start(easing || 'QuinticOut');
}
else { // mod
Expand Down Expand Up @@ -479,6 +523,7 @@ define(function (require) {
);

zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -489,6 +534,9 @@ define(function (require) {
yEnd: yEnd
}
)
.done(function() {
newShape._animating = false;
})
.start(easing);
}

Expand All @@ -510,6 +558,7 @@ define(function (require) {
]
: oldShape.style.pointList;
zr.addShape(newShape);
newShape._animating = true;
zr.animate(newShape.id, 'style')
.when(
duration,
Expand All @@ -525,6 +574,9 @@ define(function (require) {
]
}
)
.done(function() {
newShape._animating = false;
})
.start(easing || 'QuinticOut');
}
else {
Expand All @@ -533,6 +585,7 @@ define(function (require) {
// 新增
newShape.style.pointListLength = 1;
zr.addShape(newShape);
newShape._animating = true;
newShape.style.pointList = newShape.style.pointList
|| newShape.getPointList(newShape.style);
zr.animate(newShape.id, 'style')
Expand All @@ -542,6 +595,9 @@ define(function (require) {
pointListLength : newShape.style.pointList.length
}
)
.done(function() {
newShape._animating = false;
})
.start(easing || 'QuinticOut');
}
else {
Expand Down

0 comments on commit b98dc96

Please sign in to comment.