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 }
|
this.settings = { ...this.settings, ...patch }
|
||||||
const s = this.settings
|
const s = this.settings
|
||||||
if (this.paper) {
|
if (this.paper) {
|
||||||
// Some grid runtime methods are undeclared in the shipped d.ts.
|
// setGrid (not drawGrid) is the runtime API in JointJS 4; it is missing
|
||||||
const paper = this.paper as unknown as {
|
// from the shipped d.ts so we reach it through a narrow cast.
|
||||||
drawGrid: (opt: unknown) => void
|
const paper = this.paper as unknown as { setGrid: (opt: unknown) => void }
|
||||||
clearGrid: () => void
|
|
||||||
}
|
|
||||||
this.paper.options.gridSize = s.gridSize
|
|
||||||
this.paper.setGridSize(s.gridSize)
|
this.paper.setGridSize(s.gridSize)
|
||||||
if (s.showGrid) paper.drawGrid({ name: 'mesh', args: { color: '#2a2c36' } })
|
paper.setGrid(s.showGrid ? { name: 'mesh', args: { color: '#2a2c36' } } : false)
|
||||||
else paper.clearGrid()
|
|
||||||
this.paper.drawBackground({ color: s.theme === 'dark' ? '#181920' : '#f4f5f7' })
|
this.paper.drawBackground({ color: s.theme === 'dark' ? '#181920' : '#f4f5f7' })
|
||||||
this.paper.options.defaultRouter = routerConfig(s)
|
this.paper.options.defaultRouter = routerConfig(s)
|
||||||
this.paper.options.defaultConnector = connectorConfig(s)
|
this.paper.options.defaultConnector = connectorConfig(s)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user