diff --git a/src/renderer/diagram/controller.ts b/src/renderer/diagram/controller.ts index 9ae3df0..33e0857 100644 --- a/src/renderer/diagram/controller.ts +++ b/src/renderer/diagram/controller.ts @@ -345,15 +345,11 @@ export class DiagramController { this.settings = { ...this.settings, ...patch } const s = this.settings if (this.paper) { - // Some grid runtime methods are undeclared in the shipped d.ts. - const paper = this.paper as unknown as { - drawGrid: (opt: unknown) => void - clearGrid: () => void - } - this.paper.options.gridSize = s.gridSize + // setGrid (not drawGrid) is the runtime API in JointJS 4; it is missing + // from the shipped d.ts so we reach it through a narrow cast. + const paper = this.paper as unknown as { setGrid: (opt: unknown) => void } this.paper.setGridSize(s.gridSize) - if (s.showGrid) paper.drawGrid({ name: 'mesh', args: { color: '#2a2c36' } }) - else paper.clearGrid() + paper.setGrid(s.showGrid ? { name: 'mesh', args: { color: '#2a2c36' } } : false) this.paper.drawBackground({ color: s.theme === 'dark' ? '#181920' : '#f4f5f7' }) this.paper.options.defaultRouter = routerConfig(s) this.paper.options.defaultConnector = connectorConfig(s)