fix(engine): use Paper.setGrid runtime API instead of missing drawGrid
JointJS 4.2.5 has no drawGrid/clearGrid methods; calling them threw during seedSample and blanked the renderer. Switch grid toggling to setGrid, which also clears via setGrid(false). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e70ec822c9
commit
8779c88e66
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user