@pixldocs/canvas-renderer 0.5.462 → 0.5.464

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-DjoKgogq.cjs");
3
+ const index = require("./index-BFIEinvR.cjs");
4
4
  exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
5
5
  exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
6
6
  exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6 } from "./index-DzpYcUNd.js";
1
+ import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6 } from "./index-TvXdi5B9.js";
2
2
  export {
3
3
  D as DEPLOYMENT_VERSION_MARKER,
4
4
  F as FONT_FALLBACK_DEVANAGARI,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jspdf = require("jspdf");
4
4
  const svg2pdf_js = require("svg2pdf.js");
5
5
  const fabric = require("fabric");
6
- const index = require("./index-DjoKgogq.cjs");
6
+ const index = require("./index-BFIEinvR.cjs");
7
7
  const pdfFonts = require("./pdfFonts-BTj2f465.cjs");
8
8
  function _interopNamespaceDefault(e) {
9
9
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -3271,7 +3271,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
3271
3271
  async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
3272
3272
  if (!colorMap || Object.keys(colorMap).length === 0) return null;
3273
3273
  try {
3274
- const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-DjoKgogq.cjs")).then((n) => n.canvasImageLoader);
3274
+ const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-BFIEinvR.cjs")).then((n) => n.canvasImageLoader);
3275
3275
  return await getNormalizedSvgUrl(imageUrl, colorMap);
3276
3276
  } catch {
3277
3277
  return null;
@@ -4080,7 +4080,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
4080
4080
  }
4081
4081
  let fetchUrl = imageUrl;
4082
4082
  if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
4083
- const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-DjoKgogq.cjs")).then((n) => n.canvasImageLoader);
4083
+ const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-BFIEinvR.cjs")).then((n) => n.canvasImageLoader);
4084
4084
  if (isPrivateUrl(imageUrl)) return null;
4085
4085
  const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
4086
4086
  proxyUrl.searchParams.set("url", imageUrl);
@@ -4792,9 +4792,10 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
4792
4792
  const fitContain = ((cropData == null ? void 0 : cropData.fit) ?? element.imageFit ?? "cover") === "contain";
4793
4793
  const alignH = element.imageAlignH ?? "center";
4794
4794
  const alignV = element.imageAlignV ?? "middle";
4795
+ const containScaleVal = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
4795
4796
  const cropSvgRect = (clipX, clipY, clipW, clipH) => {
4796
4797
  const baseScale = fitContain ? Math.min(clipW / naturalW, clipH / naturalH) : Math.max(clipW / naturalW, clipH / naturalH);
4797
- const finalScale = baseScale * (fitContain ? 1 : cropZoomVal);
4798
+ const finalScale = baseScale * (fitContain ? containScaleVal : cropZoomVal);
4798
4799
  const drawW = naturalW * finalScale;
4799
4800
  const drawH = naturalH * finalScale;
4800
4801
  const overflowX = Math.max(0, drawW - clipW);
@@ -4802,8 +4803,8 @@ async function drawElement(pdf, element, embeddedFonts, canvasWidth, canvasHeigh
4802
4803
  let offX = 0;
4803
4804
  let offY = 0;
4804
4805
  if (fitContain) {
4805
- const slackX = Math.max(0, clipW - drawW);
4806
- const slackY = Math.max(0, clipH - drawH);
4806
+ const slackX = clipW - drawW;
4807
+ const slackY = clipH - drawH;
4807
4808
  offX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
4808
4809
  offY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
4809
4810
  } else {
@@ -5475,8 +5476,9 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
5475
5476
  const naturalW = Math.max(1, Number(element.imageNaturalWidth ?? 0) || w);
5476
5477
  const naturalH = Math.max(1, Number(element.imageNaturalHeight ?? 0) || h);
5477
5478
  const fitContain = (element.imageFit ?? "cover") === "contain";
5479
+ const containScaleVal = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
5478
5480
  const baseScale = fitContain ? Math.min(w / naturalW, h / naturalH) : Math.max(w / naturalW, h / naturalH);
5479
- const finalScale = baseScale * (fitContain ? 1 : cropZoom);
5481
+ const finalScale = baseScale * (fitContain ? containScaleVal : cropZoom);
5480
5482
  const drawW = naturalW * finalScale;
5481
5483
  const drawH = naturalH * finalScale;
5482
5484
  const overflowX = Math.max(0, drawW - w);
@@ -5486,8 +5488,8 @@ async function drawElementContentCore(pdf, element, norm, x, y, w, h, embeddedFo
5486
5488
  let offsetX = 0;
5487
5489
  let offsetY = 0;
5488
5490
  if (fitContain) {
5489
- const slackX = Math.max(0, w - drawW);
5490
- const slackY = Math.max(0, h - drawH);
5491
+ const slackX = w - drawW;
5492
+ const slackY = h - drawH;
5491
5493
  offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
5492
5494
  offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
5493
5495
  } else {
@@ -6214,4 +6216,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
6214
6216
  exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
6215
6217
  exports.preparePagesForExport = preparePagesForExport;
6216
6218
  exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
6217
- //# sourceMappingURL=vectorPdfExport-IjuMSK-o.cjs.map
6219
+ //# sourceMappingURL=vectorPdfExport-BlaglUx4.cjs.map