GridLayerView
This is a standalone view which can be used without a model. It inherits from dia.LayerView and is responsible for rendering of the Paper grid. This layer is created by the Paper automatically. You can access it using the getLayerView() method.
const gridLayerView = paper.getLayerView(dia.Paper.Layers.GRID);
constructor
dia.GridLayerView inherits from dia.LayerView - see that class for information about the constructor.
In addition to dia.LayerView constructor options (e.g. id), it accepts one additional setting:
patterns
patterns: Record<string, dia.Paper.GridOptions[]>
[required] Default set of patterns used by the grid. The keys are pattern names which can be used later in setGrid() method.
Methods
removeGrid()
gridLayerView.removeGrid(): void;
Remove the grid.
renderGrid()
gridLayerView.renderGrid(): void;
Render the grid.
setGrid()
gridLayerView.setGrid(grid?: null | boolean | string | dia.Paper.GridOptions | dia.Paper.GridOptions[]): void;
Set the grid pattern.
nullorfalse— removes the grid.
updateGrid()
gridLayerView.updateGrid(): void;
Update the grid according to the current area of the Paper.
Properties
paper
gridLayerView.paper: dia.Paper;
A reference to the Paper instance this layer view belongs to.