diff --git a/packages/x6/src/graph/graph.ts b/packages/x6/src/graph/graph.ts index 82254f5e42d..e557fd84769 100644 --- a/packages/x6/src/graph/graph.ts +++ b/packages/x6/src/graph/graph.ts @@ -58,8 +58,12 @@ export class Graph extends Basecoat { 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) diff --git a/packages/x6/src/graph/view.ts b/packages/x6/src/graph/view.ts index a24da7e5791..165e233fb0b 100644 --- a/packages/x6/src/graph/view.ts +++ b/packages/x6/src/graph/view.ts @@ -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) @@ -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', {