Skip to content

Commit

Permalink
fix: trigger preventDefault by origin event (#3017)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector authored Dec 8, 2022
1 parent 627368e commit 4a6a634
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/x6/src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ export class Graph extends Basecoat<EventArgs> {
this.grid = new Grid(this)
this.background = new Background(this)

this.model = this.options.model ? this.options.model : new Model()
this.model.graph = this
if (this.options.model) {
this.model = this.options.model
} else {
this.model = new Model()
this.model.graph = this
}

this.renderer = new ViewRenderer(this)
this.panning = new Panning(this)
Expand Down
4 changes: 2 additions & 2 deletions packages/x6/src/graph/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class GraphView extends View {
}

if (this.options.preventDefaultMouseDown) {
e.preventDefault()
evt.preventDefault()
}

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

this.graph.trigger('blank:mousedown', {
Expand Down

0 comments on commit 4a6a634

Please sign in to comment.