From bc81583e5d167d9830829d56f00efd3bbc0bf7fb Mon Sep 17 00:00:00 2001 From: vector Date: Wed, 12 Jul 2023 09:38:18 +0800 Subject: [PATCH] fix: fix invalid history on vertices tool (#3765) * fix: fix invalid history on vertices tool * chore: release @antv/x6@2.11.5 --- packages/x6-plugin-scroller/package.json | 2 +- packages/x6/package.json | 2 +- packages/x6/src/registry/tool/vertices.ts | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/x6-plugin-scroller/package.json b/packages/x6-plugin-scroller/package.json index 1c4dee63f0d..33dd1992730 100644 --- a/packages/x6-plugin-scroller/package.json +++ b/packages/x6-plugin-scroller/package.json @@ -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", diff --git a/packages/x6/package.json b/packages/x6/package.json index f0464adfcac..f38d23d310b 100644 --- a/packages/x6/package.json +++ b/packages/x6/package.json @@ -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", diff --git a/packages/x6/src/registry/tool/vertices.ts b/packages/x6/src/registry/tool/vertices.ts index 07e0d976736..5b4cea25a6f 100644 --- a/packages/x6/src/registry/tool/vertices.ts +++ b/packages/x6/src/registry/tool/vertices.ts @@ -165,6 +165,13 @@ export class Vertices extends ToolsView.ToolItem { } } + 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 @@ -174,6 +181,7 @@ export class Vertices extends ToolsView.ToolItem { } if (!options.removeRedundancies) { + this.stopBatch(this.eventData(e).vertexAdded) return } @@ -188,11 +196,7 @@ export class Vertices extends ToolsView.ToolItem { 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)