UNPKG

jointjs

Version:

JavaScript diagramming library

18 lines (14 loc) 1.16 kB
<p>Designate another subelement of the cell as a proxy target for the cell's magnet, whenever this subelement (the one on which this attribute is defined) becomes the source/target of a link. (Usually, this attribute needs to be defined on the `'root'` subelement of the cell, since that is the default target for the cell's magnet.) Expects a selector.</p> <p>A change in the cell's magnet affects the following characteristics of the cell view: <ul> <li>magnet highlight</li> </ul> </p> <p>It has no effect on the connection validation and link model attributes.</p> <pre><code>// `standard.Rectangle` has `root`, `body` and `label` subelements const rect = new joint.shapes.standard.Rectangle(); // we want to have the `label` on the outside and under the `body` of the rectangle: rect.attr(['label'], { refY: '100%', textVerticalAnchor: 'top' }); // normally, highlighters would appear around the `root` subelement (the wrapper of `body` and `label`) // however, we want highlighters to highlight only to the `body` subelement, so we need to specify it as a proxy for `root`: rect.attr(['root','highlighterSelector'], 'body');</code></pre>