ntk 8.21.0 → 8.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/widgets/svgview.js +16 -2
- package/package.json +1 -1
package/lib/widgets/svgview.js
CHANGED
|
@@ -684,7 +684,7 @@ function scanPaints(root, ids, languages) {
|
|
|
684
684
|
if (MARKABLE.has(name)) {
|
|
685
685
|
for (const id of markerIds(style)) {
|
|
686
686
|
const marker = ids.get(id);
|
|
687
|
-
if (marker && tag(marker) === 'marker' && !inMarker.has(marker)) {
|
|
687
|
+
if (marker && tag(marker) === 'marker' && !inMarker.has(marker) && !hiddenAbove(marker, root)) {
|
|
688
688
|
inMarker.add(marker);
|
|
689
689
|
kids(marker, styleWhereItStands(marker, root), depth);
|
|
690
690
|
inMarker.delete(marker);
|
|
@@ -1192,7 +1192,7 @@ export default class SvgView {
|
|
|
1192
1192
|
|
|
1193
1193
|
_renderMarker(id, vertex, first, ctx, style, alpha, depth) {
|
|
1194
1194
|
const marker = this._ids.get(id);
|
|
1195
|
-
if (!marker || tag(marker) !== 'marker' ||
|
|
1195
|
+
if (!marker || tag(marker) !== 'marker' || hiddenAbove(marker, this._root)) return;
|
|
1196
1196
|
if ((this._marking ??= new Set()).has(marker)) return;
|
|
1197
1197
|
const mw = viewportLength(marker, 'markerWidth', 0, 3);
|
|
1198
1198
|
const mh = viewportLength(marker, 'markerHeight', 0, 3);
|
|
@@ -1688,6 +1688,20 @@ function urlReference(raw) {
|
|
|
1688
1688
|
/** The shapes that take markers (SVG 2, 11.6): the ones with vertices. */
|
|
1689
1689
|
const MARKABLE = new Set(['path', 'line', 'polyline', 'polygon']);
|
|
1690
1690
|
|
|
1691
|
+
/**
|
|
1692
|
+
* Whether something around an element is `display: none`: a marker in such
|
|
1693
|
+
* a subtree is drawn nowhere, by Chrome, Firefox or WebKit alike. Its own
|
|
1694
|
+
* `display` is not asked: the property does not apply to a `<marker>`
|
|
1695
|
+
* (SVG 2, 11.6.2), and Chrome and WebKit draw one that says `none`.
|
|
1696
|
+
*/
|
|
1697
|
+
function hiddenAbove(node, root) {
|
|
1698
|
+
for (let at = node.parent; at && at.type === 'tag'; at = at.parent) {
|
|
1699
|
+
if (displayNone(at)) return true;
|
|
1700
|
+
if (at === root) break;
|
|
1701
|
+
}
|
|
1702
|
+
return false;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1691
1705
|
/** The ids of the markers a style names, each once. */
|
|
1692
1706
|
function markerIds(style) {
|
|
1693
1707
|
const ids = new Set([style.markerStart, style.markerMid, style.markerEnd]);
|