@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.
@@ -11255,6 +11255,48 @@ try {
11255
11255
  ControlProto.__pixldocsCanvaCursorFallback = true;
11256
11256
  ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
11257
11257
  }
11258
+ if (ControlProto && ControlProto.__pixldocsCanvaFullEdgeActivateVersion !== 1) {
11259
+ const originalShouldActivate = ControlProto.__pixldocsOriginalShouldActivate ?? ControlProto.shouldActivate;
11260
+ ControlProto.__pixldocsOriginalShouldActivate = originalShouldActivate;
11261
+ const edgeSegments = {
11262
+ ml: ["tl", "bl"],
11263
+ mr: ["tr", "br"],
11264
+ mt: ["tl", "tr"],
11265
+ mb: ["bl", "br"]
11266
+ };
11267
+ const distanceToSegment = (p, a, b) => {
11268
+ const vx = b.x - a.x;
11269
+ const vy = b.y - a.y;
11270
+ const lenSq = vx * vx + vy * vy;
11271
+ if (lenSq <= 1e-4) return { distance: Number.POSITIVE_INFINITY, t: 0 };
11272
+ const rawT = ((p.x - a.x) * vx + (p.y - a.y) * vy) / lenSq;
11273
+ const t = Math.max(0, Math.min(1, rawT));
11274
+ const x = a.x + vx * t;
11275
+ const y = a.y + vy * t;
11276
+ const dx = p.x - x;
11277
+ const dy = p.y - y;
11278
+ return { distance: Math.hypot(dx, dy), t: rawT };
11279
+ };
11280
+ ControlProto.shouldActivate = function(controlKey, fabricObject, pointer, corners) {
11281
+ var _a2, _b2, _c2;
11282
+ if (typeof originalShouldActivate === "function" && originalShouldActivate.call(this, controlKey, fabricObject, pointer, corners)) {
11283
+ return true;
11284
+ }
11285
+ const segment = edgeSegments[controlKey];
11286
+ if (!segment || !(fabricObject == null ? void 0 : fabricObject.canvas) || ((_b2 = (_a2 = fabricObject.canvas).getActiveObject) == null ? void 0 : _b2.call(_a2)) !== fabricObject) return false;
11287
+ if (!((_c2 = fabricObject.isControlVisible) == null ? void 0 : _c2.call(fabricObject, controlKey)) || shouldCollapseHandles(fabricObject)) return false;
11288
+ const coords = fabricObject.oCoords;
11289
+ const a = coords == null ? void 0 : coords[segment[0]];
11290
+ const b = coords == null ? void 0 : coords[segment[1]];
11291
+ if (!a || !b || !pointer) return false;
11292
+ const len = Math.hypot((b.x ?? 0) - (a.x ?? 0), (b.y ?? 0) - (a.y ?? 0));
11293
+ if (len <= 1) return false;
11294
+ const alongPad = Math.min(24, len * 0.35);
11295
+ const { distance, t } = distanceToSegment(pointer, a, b);
11296
+ return t >= alongPad / len && t <= 1 - alongPad / len && distance <= EDGE_HIT_PERP / 2 + 3;
11297
+ };
11298
+ ControlProto.__pixldocsCanvaFullEdgeActivateVersion = 1;
11299
+ }
11258
11300
  ensureCanvaControlRenders = (obj) => {
11259
11301
  try {
11260
11302
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -11266,9 +11308,15 @@ try {
11266
11308
  } catch (e) {
11267
11309
  }
11268
11310
  };
11269
- const origObj = cu.createObjectDefaultControls.bind(cu);
11270
- cu.createObjectDefaultControls = () => installPillRenders(origObj());
11271
- if (typeof cu.createTextboxDefaultControls === "function") {
11311
+ const canPatchControlsUtils = (key) => {
11312
+ const desc = Object.getOwnPropertyDescriptor(cu, key);
11313
+ return !desc || desc.writable === true || typeof desc.set === "function";
11314
+ };
11315
+ if (canPatchControlsUtils("createObjectDefaultControls")) {
11316
+ const origObj = cu.createObjectDefaultControls.bind(cu);
11317
+ cu.createObjectDefaultControls = () => installPillRenders(origObj());
11318
+ }
11319
+ if (typeof cu.createTextboxDefaultControls === "function" && canPatchControlsUtils("createTextboxDefaultControls")) {
11272
11320
  const origTb = cu.createTextboxDefaultControls.bind(cu);
11273
11321
  cu.createTextboxDefaultControls = () => installPillRenders(origTb());
11274
11322
  }
@@ -25640,9 +25688,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25640
25688
  }
25641
25689
  return svgString;
25642
25690
  }
25643
- const resolvedPackageVersion = "0.5.426";
25691
+ const resolvedPackageVersion = "0.5.428";
25644
25692
  const PACKAGE_VERSION = resolvedPackageVersion;
25645
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.426";
25693
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.428";
25646
25694
  const roundParityValue = (value) => {
25647
25695
  if (typeof value !== "number") return value;
25648
25696
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26456,7 +26504,7 @@ class PixldocsRenderer {
26456
26504
  await this.waitForCanvasScene(container, cloned, i);
26457
26505
  }
26458
26506
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26459
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bu0JJXZS.js");
26507
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CsSQj8-v.js");
26460
26508
  const prepared = preparePagesForExport(
26461
26509
  cloned.pages,
26462
26510
  canvasWidth,
@@ -28776,7 +28824,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28776
28824
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28777
28825
  sanitizeSvgTreeForPdf(svgToDraw);
28778
28826
  try {
28779
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bu0JJXZS.js");
28827
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CsSQj8-v.js");
28780
28828
  try {
28781
28829
  await logTextMeasurementDiagnostic(svgToDraw);
28782
28830
  } catch {
@@ -29176,4 +29224,4 @@ export {
29176
29224
  buildTeaserBlurFlatKeys as y,
29177
29225
  collectFontDescriptorsFromConfig as z
29178
29226
  };
29179
- //# sourceMappingURL=index--hMXhxT-.js.map
29227
+ //# sourceMappingURL=index-lHxjPVDE.js.map