@versatiles/svg-renderer 0.7.1 → 0.7.3
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/dist/index.cjs +17 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -14
- package/dist/index.js.map +1 -1
- package/dist/maplibre.cjs +17 -14
- package/dist/maplibre.cjs.map +1 -1
- package/dist/maplibre.js +17 -14
- package/dist/maplibre.js.map +1 -1
- package/dist/maplibre.umd.js +17 -14
- package/dist/maplibre.umd.js.map +1 -1
- package/package.json +17 -17
package/dist/maplibre.js
CHANGED
|
@@ -779,10 +779,11 @@ var layout_line = {
|
|
|
779
779
|
expression: {
|
|
780
780
|
interpolated: false,
|
|
781
781
|
parameters: [
|
|
782
|
-
"zoom"
|
|
782
|
+
"zoom",
|
|
783
|
+
"feature"
|
|
783
784
|
]
|
|
784
785
|
},
|
|
785
|
-
"property-type": "data-
|
|
786
|
+
"property-type": "data-driven"
|
|
786
787
|
},
|
|
787
788
|
"line-join": {
|
|
788
789
|
type: "enum",
|
|
@@ -815,10 +816,11 @@ var layout_line = {
|
|
|
815
816
|
expression: {
|
|
816
817
|
interpolated: true,
|
|
817
818
|
parameters: [
|
|
818
|
-
"zoom"
|
|
819
|
+
"zoom",
|
|
820
|
+
"feature"
|
|
819
821
|
]
|
|
820
822
|
},
|
|
821
|
-
"property-type": "data-
|
|
823
|
+
"property-type": "data-driven"
|
|
822
824
|
},
|
|
823
825
|
"line-round-limit": {
|
|
824
826
|
type: "number",
|
|
@@ -831,10 +833,11 @@ var layout_line = {
|
|
|
831
833
|
expression: {
|
|
832
834
|
interpolated: true,
|
|
833
835
|
parameters: [
|
|
834
|
-
"zoom"
|
|
836
|
+
"zoom",
|
|
837
|
+
"feature"
|
|
835
838
|
]
|
|
836
839
|
},
|
|
837
|
-
"property-type": "data-
|
|
840
|
+
"property-type": "data-driven"
|
|
838
841
|
},
|
|
839
842
|
"line-sort-key": {
|
|
840
843
|
type: "number",
|
|
@@ -8295,7 +8298,7 @@ CompoundExpression.register(expressions$1, {
|
|
|
8295
8298
|
join: [
|
|
8296
8299
|
StringType,
|
|
8297
8300
|
[array(StringType), StringType],
|
|
8298
|
-
(ctx, [arr, delim]) => arr.
|
|
8301
|
+
(ctx, [arr, delim]) => arr.evaluate(ctx).join(delim.evaluate(ctx))
|
|
8299
8302
|
],
|
|
8300
8303
|
'resolved-locale': [
|
|
8301
8304
|
StringType,
|
|
@@ -9737,12 +9740,12 @@ class SVGRenderer {
|
|
|
9737
9740
|
const [cx, cy] = roundXY(point.x + style.offset[0] * style.size, point.y + style.offset[1] * style.size);
|
|
9738
9741
|
elements.push(`<g transform="rotate(${String(style.rotate)},${formatNum(cx)},${formatNum(cy)})">` +
|
|
9739
9742
|
`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
|
|
9740
|
-
`<use href="#${escapeXml(symDef.symbolId)}" />` +
|
|
9743
|
+
`<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
|
|
9741
9744
|
`</g></g>`);
|
|
9742
9745
|
}
|
|
9743
9746
|
else {
|
|
9744
9747
|
elements.push(`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
|
|
9745
|
-
`<use href="#${escapeXml(symDef.symbolId)}" />` +
|
|
9748
|
+
`<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
|
|
9746
9749
|
`</g>`);
|
|
9747
9750
|
}
|
|
9748
9751
|
}
|
|
@@ -9775,7 +9778,7 @@ class SVGRenderer {
|
|
|
9775
9778
|
const pixelated = style.resampling === 'nearest';
|
|
9776
9779
|
for (const tile of tiles) {
|
|
9777
9780
|
const overlap = Math.min(tile.width, tile.height) / 10000; // slight overlap to prevent sub-pixel gaps between tiles
|
|
9778
|
-
let attrs = `x="${formatScaled(tile.x - overlap)}" y="${formatScaled(tile.y - overlap)}" width="${formatScaled(tile.width + overlap * 2)}" height="${formatScaled(tile.height + overlap * 2)}" href="${tile.dataUri}"`;
|
|
9781
|
+
let attrs = `x="${formatScaled(tile.x - overlap)}" y="${formatScaled(tile.y - overlap)}" width="${formatScaled(tile.width + overlap * 2)}" height="${formatScaled(tile.height + overlap * 2)}" xlink:href="${tile.dataUri}"`;
|
|
9779
9782
|
if (pixelated)
|
|
9780
9783
|
attrs += ' style="image-rendering:pixelated"';
|
|
9781
9784
|
this.#svg.push(`<image ${attrs} />`);
|
|
@@ -9788,19 +9791,19 @@ class SVGRenderer {
|
|
|
9788
9791
|
// Build defs content
|
|
9789
9792
|
const defsContent = [`<clipPath id="vb"><rect width="${w}" height="${h}"/></clipPath>`];
|
|
9790
9793
|
for (const sheet of this.#spriteSheetDefs.values()) {
|
|
9791
|
-
defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" href="${escapeXml(sheet.href)}" />`);
|
|
9794
|
+
defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" xlink:href="${escapeXml(sheet.href)}" />`);
|
|
9792
9795
|
}
|
|
9793
9796
|
for (const sym of this.#spriteSymbolDefs.values()) {
|
|
9794
9797
|
const clipId = `${sym.symbolId}-clip`;
|
|
9795
|
-
defsContent.push(`<clipPath id="${escapeXml(clipId)}"><rect width="${formatNum(sym.width)}" height="${formatNum(sym.height)}" /></clipPath>`, `<symbol id="${escapeXml(sym.symbolId)}"><g clip-path="url(#${escapeXml(clipId)})"><use href="#${escapeXml(sym.sheetDefId)}" x="${formatNum(-sym.x)}" y="${formatNum(-sym.y)}" /></g></symbol>`);
|
|
9798
|
+
defsContent.push(`<clipPath id="${escapeXml(clipId)}"><rect width="${formatNum(sym.width)}" height="${formatNum(sym.height)}" /></clipPath>`, `<symbol id="${escapeXml(sym.symbolId)}"><g clip-path="url(#${escapeXml(clipId)})"><use xlink:href="#${escapeXml(sym.sheetDefId)}" x="${formatNum(-sym.x)}" y="${formatNum(-sym.y)}" /></g></symbol>`);
|
|
9796
9799
|
}
|
|
9797
9800
|
for (const { content } of this.#sdfFilterDefs.values()) {
|
|
9798
9801
|
defsContent.push(content);
|
|
9799
9802
|
}
|
|
9800
9803
|
const parts = [
|
|
9801
|
-
`<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg">`,
|
|
9804
|
+
`<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`,
|
|
9802
9805
|
`<defs>\n ${defsContent.join('\n ')}\n</defs>`,
|
|
9803
|
-
`<g clip-path="url(#vb)">`,
|
|
9806
|
+
`<g id="map" clip-path="url(#vb)">`,
|
|
9804
9807
|
];
|
|
9805
9808
|
if (this.#backgroundColor.alpha > 0) {
|
|
9806
9809
|
parts.push(`<rect x="-1" y="-1" width="${(this.width + 2).toFixed(0)}" height="${(this.height + 2).toFixed(0)}" ${fillAttr(this.#backgroundColor)} />`);
|