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 2021/09/29 04:35:44 UTC

[GitHub] [echarts] pissang commented on a change in pull request #15428: feat(graph): simple graph draggable. close #14510

pissang commented on a change in pull request #15428:
URL: https://github.com/apache/echarts/pull/15428#discussion_r718144246



##########
File path: src/chart/graph/circularLayoutHelper.ts
##########
@@ -77,6 +79,18 @@ export function circularLayout(
         return;
     }
 
+    if (draggingNode) {
+        const [tempX, tempY] = draggingNode.getLayout();
+        const v = [tempX - cx, tempY - cy];
+        vec2.normalize(v, v);
+        vec2.scale(v, v, r);
+        draggingNode.setLayout([cx + v[0], cy + v[1]]);
+
+        const circularRotateLabel = seriesModel.get('layout') === 'circular'

Review comment:
       Seems 
   ```ts
   seriesModel.get('layout') === 'circular'
   ```
   this logic is unnecessary?
   

##########
File path: src/component/helper/RoamController.ts
##########
@@ -179,6 +179,14 @@ class RoamController extends Eventful<{
             return;
         }
 
+        let el = e.target;
+        while (el) {
+            if (el.draggable) {
+                return;
+            }
+            el = el.__hostTarget ? el.__hostTarget : el.parent;

Review comment:
       It can be written as:
   ```ts
   el = el.__hostTarget || el.parent;
   ```
   
   Also, I'm not sure about what's the scene of this logic and if it's correct.  `e.target.draggable` has been checked and return earlier.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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