Skip to content

Commit

Permalink
fix: fix invalid history on vertices tool (#3765)
Browse files Browse the repository at this point in the history
* fix: fix invalid history on vertices tool

* chore: release @antv/[email protected]
  • Loading branch information
NewByVector authored Jul 12, 2023
1 parent 7eb9748 commit bc81583
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/x6-plugin-scroller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-scroller",
"version": "2.0.9",
"version": "2.0.10",
"description": "scroller plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/x6/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/x6",
"version": "2.11.3",
"version": "2.11.5",
"description": "JavaScript diagramming library that uses SVG and HTML for rendering",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
14 changes: 9 additions & 5 deletions packages/x6/src/registry/tool/vertices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ export class Vertices extends ToolsView.ToolItem<EdgeView, Vertices.Options> {
}
}

protected stopBatch(vertexAdded: boolean) {
this.cell.stopBatch('move-vertex', { ui: true, toolId: this.cid })
if (vertexAdded) {
this.cell.stopBatch('add-vertex', { ui: true, toolId: this.cid })
}
}

protected onHandleChanged({ e }: Vertices.Handle.EventArgs['changed']) {
const options = this.options
const edgeView = this.cellView
Expand All @@ -174,6 +181,7 @@ export class Vertices extends ToolsView.ToolItem<EdgeView, Vertices.Options> {
}

if (!options.removeRedundancies) {
this.stopBatch(this.eventData(e).vertexAdded)
return
}

Expand All @@ -188,11 +196,7 @@ export class Vertices extends ToolsView.ToolItem<EdgeView, Vertices.Options> {

this.blur()

edgeView.cell.stopBatch('move-vertex', { ui: true, toolId: this.cid })

if (this.eventData(e).vertexAdded) {
edgeView.cell.stopBatch('add-vertex', { ui: true, toolId: this.cid })
}
this.stopBatch(this.eventData(e).vertexAdded)

const { e: evt, x, y } = this.getMouseEventArgs(e)

Expand Down

0 comments on commit bc81583

Please sign in to comment.