Skip to content

Grid "z-index", show above elements. #1718

Answered by kumilingus
BigPackie asked this question in Q&A
Discussion options

You must be logged in to vote
  1. You can bring the grid HTMLElement to front. It will draw the grid also above the tools though (e.g. linkTools, elementTools, ui.Halo, ui.Selection).
const gridEl = paper.el.querySelector('.joint-paper-grid');
gridEl.style.pointerEvents = 'none';
gridEl.style.zIndex = 1;
  1. For that reason It would be better to draw the grid with a single SVGPathElement (or SVGRectElement with SVGPatternElement) and append it to one of the paper layers (It is a similar approach used in Hexagonal Grid demo).
const pathEl = V('path', { fill: 'none', stroke: 'gray', d: myFunctionToDrawGrid(gridSize) }).node;
paper.getLayerNode(dia.Paper.Layers.BACK).appendChild(pathEl);

(Note that even though the layer API …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@BigPackie
Comment options

@kumilingus
Comment options

@BigPackie
Comment options

Answer selected by BigPackie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants