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