You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2019/12/22 16:34:10 UTC

[GitHub] [incubator-echarts] pissang commented on a change in pull request #11893: fix-11739: apply continuity line trail for effectline

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_r360714998
 
 

 ##########
 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;
+            }
+        }
+        else {
+            symbol.attr('scale', [symbol.scale[0], symbol.scale[0]]);
 
 Review comment:
   Perhaps you should save the original `scale` and restore it here. Using scale[0] for both x and y scale will narrow the scenario.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org