You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2022/04/13 14:14:59 UTC

[echarts] branch master updated: fix(graph): user cursor has higher priority (#16867)

This is an automated email from the ASF dual-hosted git repository.

susiwen8 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/master by this push:
     new ee116a0f7 fix(graph): user cursor has higher priority (#16867)
ee116a0f7 is described below

commit ee116a0f79327b2e915dcb5767aaf07d59f35302
Author: susiwen8 <su...@gmail.com>
AuthorDate: Wed Apr 13 22:14:33 2022 +0800

    fix(graph): user cursor has higher priority (#16867)
    
    * fix(graph): user cursor has higher priority
    
    * fix(graph): simplify code
---
 src/chart/graph/GraphSeries.ts | 1 +
 src/chart/graph/GraphView.ts   | 2 +-
 src/chart/helper/Symbol.ts     | 4 ++--
 test/graph-symbol.html         | 2 ++
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/chart/graph/GraphSeries.ts b/src/chart/graph/GraphSeries.ts
index 51e34314b..d6c84687a 100644
--- a/src/chart/graph/GraphSeries.ts
+++ b/src/chart/graph/GraphSeries.ts
@@ -106,6 +106,7 @@ export interface GraphNodeItemOption extends SymbolOptionMixin, GraphNodeStateOp
     category?: number | string
 
     draggable?: boolean
+    cursor?: string
 }
 
 export interface GraphEdgeStateOption {
diff --git a/src/chart/graph/GraphView.ts b/src/chart/graph/GraphView.ts
index 3b2d0cf3c..37d008692 100644
--- a/src/chart/graph/GraphView.ts
+++ b/src/chart/graph/GraphView.ts
@@ -150,7 +150,7 @@ class GraphView extends ChartView {
                     }
                 });
             }
-            el.setDraggable(draggable && !!forceLayout);
+            el.setDraggable(draggable && !!forceLayout, !!itemModel.get('cursor'));
 
             const focus = itemModel.get(['emphasis', 'focus']);
 
diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index efb45428a..9295f306d 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -141,10 +141,10 @@ class Symbol extends graphic.Group {
         symbolPath.z = z;
     }
 
-    setDraggable(draggable: boolean) {
+    setDraggable(draggable: boolean, hasCursorOption?: boolean) {
         const symbolPath = this.childAt(0) as ECSymbol;
         symbolPath.draggable = draggable;
-        symbolPath.cursor = draggable ? 'move' : symbolPath.cursor;
+        symbolPath.cursor = !hasCursorOption && draggable ? 'move' : symbolPath.cursor;
     }
 
     /**
diff --git a/test/graph-symbol.html b/test/graph-symbol.html
index 61f9276fe..0c023aca0 100644
--- a/test/graph-symbol.html
+++ b/test/graph-symbol.html
@@ -81,6 +81,8 @@ under the License.
                                     },
                                 }
                             },
+                            draggable: true,
+                            cursor: 'help',
                             force: {
                                 repulsion: 1000
                             },


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