Skip to content

Commit 4a6a634

Browse files
authored
fix: trigger preventDefault by origin event (#3017)
1 parent 627368e commit 4a6a634

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/x6/src/graph/graph.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ export class Graph extends Basecoat<EventArgs> {
5858
this.grid = new Grid(this)
5959
this.background = new Background(this)
6060

61-
this.model = this.options.model ? this.options.model : new Model()
62-
this.model.graph = this
61+
if (this.options.model) {
62+
this.model = this.options.model
63+
} else {
64+
this.model = new Model()
65+
this.model.graph = this
66+
}
6367

6468
this.renderer = new ViewRenderer(this)
6569
this.panning = new Panning(this)

packages/x6/src/graph/view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class GraphView extends View {
201201
}
202202

203203
if (this.options.preventDefaultMouseDown) {
204-
e.preventDefault()
204+
evt.preventDefault()
205205
}
206206

207207
const localPoint = this.graph.snapToGrid(e.clientX, e.clientY)
@@ -213,7 +213,7 @@ export class GraphView extends View {
213213
this.options.preventDefaultBlankAction &&
214214
['touchstart'].includes(e.type)
215215
) {
216-
e.preventDefault()
216+
evt.preventDefault()
217217
}
218218

219219
this.graph.trigger('blank:mousedown', {

0 commit comments

Comments
 (0)