|
@ -1,8 +1,5 @@ |
|
|
import { fabric } from "fabric"; |
|
|
import { fabric } from "fabric"; |
|
|
|
|
|
|
|
|
fabric.perfLimitSizeTotal = 134217728; |
|
|
|
|
|
fabric.maxCacheSideLimit = 65536; |
|
|
|
|
|
|
|
|
|
|
|
export default class Board { |
|
|
export default class Board { |
|
|
constructor(id, {grid} = {grid: {}}) { |
|
|
constructor(id, {grid} = {grid: {}}) { |
|
|
this.id = id; |
|
|
this.id = id; |
|
@ -18,18 +15,21 @@ export default class Board { |
|
|
|
|
|
|
|
|
this.canvas = new fabric.Canvas(this.canvasElement, {backgroundColor: "#555"}); |
|
|
this.canvas = new fabric.Canvas(this.canvasElement, {backgroundColor: "#555"}); |
|
|
|
|
|
|
|
|
|
|
|
this.contentGroup = new fabric.Group(); |
|
|
this.gridGroup = new fabric.Group(); |
|
|
this.gridGroup = new fabric.Group(); |
|
|
this.canvas.add(this.gridGroup); |
|
|
|
|
|
|
|
|
this.cursorGroup = new fabric.Group(); |
|
|
|
|
|
this.canvas.add(this.contentGroup, this.gridGroup, this.cursorGroup); |
|
|
|
|
|
|
|
|
this.gridOptions = { |
|
|
this.gridOptions = { |
|
|
...(grid || {}), |
|
|
|
|
|
enabled: true, |
|
|
enabled: true, |
|
|
size: 64, |
|
|
size: 64, |
|
|
hightlightInterval: 8, |
|
|
hightlightInterval: 8, |
|
|
lineColor: "#444", |
|
|
lineColor: "#444", |
|
|
highlightColor: "#333", |
|
|
highlightColor: "#333", |
|
|
|
|
|
...(grid || {}), |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.redrawGrid(); |
|
|
this.setupPanning(); |
|
|
this.setupPanning(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|