Skip to content

Commit

Permalink
fix: fix invalid history on vertices tool
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector committed Jul 11, 2023
1 parent 3b8dfcf commit 367f588
Showing 1 changed file with 9 additions and 5 deletions.
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 367f588

Please sign in to comment.