@pixldocs/canvas-renderer 0.5.426 → 0.5.428

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.
@@ -11273,6 +11273,48 @@ try {
11273
11273
  ControlProto.__pixldocsCanvaCursorFallback = true;
11274
11274
  ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
11275
11275
  }
11276
+ if (ControlProto && ControlProto.__pixldocsCanvaFullEdgeActivateVersion !== 1) {
11277
+ const originalShouldActivate = ControlProto.__pixldocsOriginalShouldActivate ?? ControlProto.shouldActivate;
11278
+ ControlProto.__pixldocsOriginalShouldActivate = originalShouldActivate;
11279
+ const edgeSegments = {
11280
+ ml: ["tl", "bl"],
11281
+ mr: ["tr", "br"],
11282
+ mt: ["tl", "tr"],
11283
+ mb: ["bl", "br"]
11284
+ };
11285
+ const distanceToSegment = (p, a, b) => {
11286
+ const vx = b.x - a.x;
11287
+ const vy = b.y - a.y;
11288
+ const lenSq = vx * vx + vy * vy;
11289
+ if (lenSq <= 1e-4) return { distance: Number.POSITIVE_INFINITY, t: 0 };
11290
+ const rawT = ((p.x - a.x) * vx + (p.y - a.y) * vy) / lenSq;
11291
+ const t = Math.max(0, Math.min(1, rawT));
11292
+ const x = a.x + vx * t;
11293
+ const y = a.y + vy * t;
11294
+ const dx = p.x - x;
11295
+ const dy = p.y - y;
11296
+ return { distance: Math.hypot(dx, dy), t: rawT };
11297
+ };
11298
+ ControlProto.shouldActivate = function(controlKey, fabricObject, pointer, corners) {
11299
+ var _a2, _b2, _c2;
11300
+ if (typeof originalShouldActivate === "function" && originalShouldActivate.call(this, controlKey, fabricObject, pointer, corners)) {
11301
+ return true;
11302
+ }
11303
+ const segment = edgeSegments[controlKey];
11304
+ if (!segment || !(fabricObject == null ? void 0 : fabricObject.canvas) || ((_b2 = (_a2 = fabricObject.canvas).getActiveObject) == null ? void 0 : _b2.call(_a2)) !== fabricObject) return false;
11305
+ if (!((_c2 = fabricObject.isControlVisible) == null ? void 0 : _c2.call(fabricObject, controlKey)) || shouldCollapseHandles(fabricObject)) return false;
11306
+ const coords = fabricObject.oCoords;
11307
+ const a = coords == null ? void 0 : coords[segment[0]];
11308
+ const b = coords == null ? void 0 : coords[segment[1]];
11309
+ if (!a || !b || !pointer) return false;
11310
+ const len = Math.hypot((b.x ?? 0) - (a.x ?? 0), (b.y ?? 0) - (a.y ?? 0));
11311
+ if (len <= 1) return false;
11312
+ const alongPad = Math.min(24, len * 0.35);
11313
+ const { distance, t } = distanceToSegment(pointer, a, b);
11314
+ return t >= alongPad / len && t <= 1 - alongPad / len && distance <= EDGE_HIT_PERP / 2 + 3;
11315
+ };
11316
+ ControlProto.__pixldocsCanvaFullEdgeActivateVersion = 1;
11317
+ }
11276
11318
  ensureCanvaControlRenders = (obj) => {
11277
11319
  try {
11278
11320
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -11284,9 +11326,15 @@ try {
11284
11326
  } catch (e) {
11285
11327
  }
11286
11328
  };
11287
- const origObj = cu.createObjectDefaultControls.bind(cu);
11288
- cu.createObjectDefaultControls = () => installPillRenders(origObj());
11289
- if (typeof cu.createTextboxDefaultControls === "function") {
11329
+ const canPatchControlsUtils = (key) => {
11330
+ const desc = Object.getOwnPropertyDescriptor(cu, key);
11331
+ return !desc || desc.writable === true || typeof desc.set === "function";
11332
+ };
11333
+ if (canPatchControlsUtils("createObjectDefaultControls")) {
11334
+ const origObj = cu.createObjectDefaultControls.bind(cu);
11335
+ cu.createObjectDefaultControls = () => installPillRenders(origObj());
11336
+ }
11337
+ if (typeof cu.createTextboxDefaultControls === "function" && canPatchControlsUtils("createTextboxDefaultControls")) {
11290
11338
  const origTb = cu.createTextboxDefaultControls.bind(cu);
11291
11339
  cu.createTextboxDefaultControls = () => installPillRenders(origTb());
11292
11340
  }
@@ -25658,9 +25706,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25658
25706
  }
25659
25707
  return svgString;
25660
25708
  }
25661
- const resolvedPackageVersion = "0.5.426";
25709
+ const resolvedPackageVersion = "0.5.428";
25662
25710
  const PACKAGE_VERSION = resolvedPackageVersion;
25663
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.426";
25711
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.428";
25664
25712
  const roundParityValue = (value) => {
25665
25713
  if (typeof value !== "number") return value;
25666
25714
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26474,7 +26522,7 @@ class PixldocsRenderer {
26474
26522
  await this.waitForCanvasScene(container, cloned, i);
26475
26523
  }
26476
26524
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26477
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-onpGluLh.cjs"));
26525
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DrbrYFkJ.cjs"));
26478
26526
  const prepared = preparePagesForExport(
26479
26527
  cloned.pages,
26480
26528
  canvasWidth,
@@ -28794,7 +28842,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28794
28842
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28795
28843
  sanitizeSvgTreeForPdf(svgToDraw);
28796
28844
  try {
28797
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-onpGluLh.cjs"));
28845
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DrbrYFkJ.cjs"));
28798
28846
  try {
28799
28847
  await logTextMeasurementDiagnostic(svgToDraw);
28800
28848
  } catch {
@@ -29191,4 +29239,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29191
29239
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29192
29240
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29193
29241
  exports.warmTemplateFromForm = warmTemplateFromForm;
29194
- //# sourceMappingURL=index-ScUMI-6A.cjs.map
29242
+ //# sourceMappingURL=index-Dk0BUnsP.cjs.map