@versatiles/svg-renderer 0.7.0 → 0.7.2

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.
@@ -9743,12 +9743,12 @@
9743
9743
  const [cx, cy] = roundXY(point.x + style.offset[0] * style.size, point.y + style.offset[1] * style.size);
9744
9744
  elements.push(`<g transform="rotate(${String(style.rotate)},${formatNum(cx)},${formatNum(cy)})">` +
9745
9745
  `<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9746
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9746
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9747
9747
  `</g></g>`);
9748
9748
  }
9749
9749
  else {
9750
9750
  elements.push(`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9751
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9751
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9752
9752
  `</g>`);
9753
9753
  }
9754
9754
  }
@@ -9781,7 +9781,7 @@
9781
9781
  const pixelated = style.resampling === 'nearest';
9782
9782
  for (const tile of tiles) {
9783
9783
  const overlap = Math.min(tile.width, tile.height) / 10000; // slight overlap to prevent sub-pixel gaps between tiles
9784
- 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}"`;
9784
+ 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}"`;
9785
9785
  if (pixelated)
9786
9786
  attrs += ' style="image-rendering:pixelated"';
9787
9787
  this.#svg.push(`<image ${attrs} />`);
@@ -9794,19 +9794,19 @@
9794
9794
  // Build defs content
9795
9795
  const defsContent = [`<clipPath id="vb"><rect width="${w}" height="${h}"/></clipPath>`];
9796
9796
  for (const sheet of this.#spriteSheetDefs.values()) {
9797
- defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" href="${escapeXml(sheet.href)}" />`);
9797
+ defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" xlink:href="${escapeXml(sheet.href)}" />`);
9798
9798
  }
9799
9799
  for (const sym of this.#spriteSymbolDefs.values()) {
9800
9800
  const clipId = `${sym.symbolId}-clip`;
9801
- 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>`);
9801
+ 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>`);
9802
9802
  }
9803
9803
  for (const { content } of this.#sdfFilterDefs.values()) {
9804
9804
  defsContent.push(content);
9805
9805
  }
9806
9806
  const parts = [
9807
- `<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg">`,
9807
+ `<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">`,
9808
9808
  `<defs>\n ${defsContent.join('\n ')}\n</defs>`,
9809
- `<g clip-path="url(#vb)">`,
9809
+ `<g id="map" clip-path="url(#vb)">`,
9810
9810
  ];
9811
9811
  if (this.#backgroundColor.alpha > 0) {
9812
9812
  parts.push(`<rect x="-1" y="-1" width="${(this.width + 2).toFixed(0)}" height="${(this.height + 2).toFixed(0)}" ${fillAttr(this.#backgroundColor)} />`);