@pixldocs/canvas-renderer 0.5.425 → 0.5.427

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);
@@ -12488,6 +12530,7 @@ const PageCanvas = forwardRef(
12488
12530
  installCanvaMaskControls(group);
12489
12531
  applyControlSizeForZoom(group.canvas ?? fabricRef.current, group);
12490
12532
  ensureCanvaControlRenders(group);
12533
+ ensureCanvaEdgeHitArea(group);
12491
12534
  }, [calculateScaleSnapGuidesCallback, canvasHeight, canvasWidth, getLogicalGroupSnapBoundsCallback, getResizeExcludeIdsCallback, snapDuringScaleCallback]);
12492
12535
  const isTransforming = useCallback((canvas2) => {
12493
12536
  if (!canvas2) return false;
@@ -14340,6 +14383,10 @@ const PageCanvas = forwardRef(
14340
14383
  if (activeObj.__cornerResizeStart) {
14341
14384
  delete activeObj.__cornerResizeStart;
14342
14385
  }
14386
+ installImageResizeControlsWithSnap(activeObj);
14387
+ ensureCanvaControlRenders(activeObj);
14388
+ ensureCanvaEdgeHitArea(activeObj);
14389
+ activeObj.setCoords();
14343
14390
  }
14344
14391
  if (!didTransformRef.current) {
14345
14392
  editLockRef.current = false;
@@ -25635,9 +25682,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25635
25682
  }
25636
25683
  return svgString;
25637
25684
  }
25638
- const resolvedPackageVersion = "0.5.425";
25685
+ const resolvedPackageVersion = "0.5.427";
25639
25686
  const PACKAGE_VERSION = resolvedPackageVersion;
25640
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.425";
25687
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.427";
25641
25688
  const roundParityValue = (value) => {
25642
25689
  if (typeof value !== "number") return value;
25643
25690
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26451,7 +26498,7 @@ class PixldocsRenderer {
26451
26498
  await this.waitForCanvasScene(container, cloned, i);
26452
26499
  }
26453
26500
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26454
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DR3TOj0C.js");
26501
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bc2upktw.js");
26455
26502
  const prepared = preparePagesForExport(
26456
26503
  cloned.pages,
26457
26504
  canvasWidth,
@@ -28771,7 +28818,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28771
28818
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28772
28819
  sanitizeSvgTreeForPdf(svgToDraw);
28773
28820
  try {
28774
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DR3TOj0C.js");
28821
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bc2upktw.js");
28775
28822
  try {
28776
28823
  await logTextMeasurementDiagnostic(svgToDraw);
28777
28824
  } catch {
@@ -29171,4 +29218,4 @@ export {
29171
29218
  buildTeaserBlurFlatKeys as y,
29172
29219
  collectFontDescriptorsFromConfig as z
29173
29220
  };
29174
- //# sourceMappingURL=index-C3izL-t6.js.map
29221
+ //# sourceMappingURL=index-BMuhbMdO.js.map