pissang commented on a change in pull request #11893: fix-11739: apply 
continuity line trail for effectline
URL: 
https://github.com/apache/incubator-echarts/pull/11893#discussion_r360715473
 
 

 ##########
 File path: src/chart/helper/EffectLine.js
 ##########
 @@ -187,7 +188,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
     var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t);
 
     symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
-
+    // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
+    if (this._symbolType === 'line' || this._symbolType === 'rect' || 
this._symbolType === 'roundRect') {
+        if (
+            lastPos[0] !== 0 && lastPos[1] !== 0
+            && lastPos[0] !== p2[0] && lastPos[1] !== p2[1]
+            ) {
+            var scaleY = vec2.dist(lastPos, pos);
+            // Enhance ME: currently fix incorrect line segment when zooming 
or first segment of trail by this way
+            if (scaleY < this.getLineLength(symbol) / ((this._period / 1000) * 
30)) {
+                symbol.attr('scale', [symbol.scale[0], scaleY * 1.05 ]);
+            }
+            // make sure the last segment render within endPoint, this may 
cause (lastPos[0] !== p2[0] && lastPos[1] !== p2[1]) failed
+            if (t === 1) {
+                pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
+                pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
+            }
 
 Review comment:
   This should only be optimized when `trailLength` is larger than 0

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to