Skip to content

Commit

Permalink
fix(graph): user cursor has higher priority (#16867)
Browse files Browse the repository at this point in the history
* fix(graph): user cursor has higher priority

* fix(graph): simplify code
  • Loading branch information
susiwen8 authored Apr 13, 2022
1 parent 2a67f86 commit ee116a0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/chart/graph/GraphSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export interface GraphNodeItemOption extends SymbolOptionMixin, GraphNodeStateOp
category?: number | string

draggable?: boolean
cursor?: string
}

export interface GraphEdgeStateOption {
Expand Down
2 changes: 1 addition & 1 deletion src/chart/graph/GraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
4 changes: 2 additions & 2 deletions src/chart/helper/Symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions test/graph-symbol.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee116a0

Please sign in to comment.