@pixldocs/canvas-renderer 0.5.375 → 0.5.376

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.
@@ -10676,6 +10676,53 @@ try {
10676
10676
  if (p < 1) ctx.stroke();
10677
10677
  ctx.restore();
10678
10678
  };
10679
+ const ROTATE_PATHS_2D = [
10680
+ new Path2D("M22 12l-3 3-3-3"),
10681
+ new Path2D("M2 12l3-3 3 3"),
10682
+ new Path2D("M19.016 14v-1.95A7.05 7.05 0 0 0 8 6.22"),
10683
+ new Path2D("M16.016 17.845A7.05 7.05 0 0 1 5 12.015V10"),
10684
+ new Path2D("M5 10V9"),
10685
+ new Path2D("M19 15v-1")
10686
+ ];
10687
+ const renderRotateHandle = (ctx, left, top, _styleOverride, fabricObject) => {
10688
+ var _a2, _b2;
10689
+ const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
10690
+ if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10691
+ const scale = getVisualScale(fabricObject);
10692
+ const p = getHoverProgress(fabricObject, "mtr");
10693
+ const r = 11 * scale;
10694
+ ctx.save();
10695
+ ctx.beginPath();
10696
+ ctx.arc(left, top, r, 0, Math.PI * 2);
10697
+ ctx.closePath();
10698
+ ctx.fillStyle = lerpFill(p);
10699
+ ctx.strokeStyle = `rgba(15, 23, 42, ${0.18 * (1 - p)})`;
10700
+ ctx.lineWidth = 0.75 * (1 - p);
10701
+ ctx.shadowColor = "rgba(15, 23, 42, 0.4)";
10702
+ ctx.shadowBlur = 10;
10703
+ ctx.shadowOffsetY = 2;
10704
+ ctx.fill();
10705
+ if (p < 1) ctx.stroke();
10706
+ ctx.shadowColor = "transparent";
10707
+ ctx.shadowBlur = 0;
10708
+ ctx.shadowOffsetY = 0;
10709
+ const iconColor = p > 0.5 ? "#ffffff" : "rgba(15, 23, 42, 0.85)";
10710
+ const target = r * 1.55;
10711
+ const s = target / 24;
10712
+ ctx.translate(left, top);
10713
+ ctx.scale(s, s);
10714
+ ctx.translate(-12, -12);
10715
+ ctx.strokeStyle = iconColor;
10716
+ ctx.fillStyle = iconColor;
10717
+ ctx.lineJoin = "miter";
10718
+ ctx.miterLimit = 4;
10719
+ ctx.lineWidth = 1 / s;
10720
+ ROTATE_PATHS_2D.forEach((p2d, index) => {
10721
+ ctx.lineCap = index >= 4 ? "round" : "square";
10722
+ ctx.stroke(p2d);
10723
+ });
10724
+ ctx.restore();
10725
+ };
10679
10726
  const installPillRenders = (controls) => {
10680
10727
  var _a2;
10681
10728
  const CUR_SIZE = 22;
@@ -10740,14 +10787,6 @@ try {
10740
10787
  new Path2D("M12 21L12.3648 21.342L12 21.7311L11.6352 21.342L12 21ZM11.5 15C11.5 14.7239 11.7239 14.5 12 14.5C12.2761 14.5 12.5 14.7239 12.5 15H11.5ZM15.3648 18.142L12.3648 21.342L11.6352 20.658L14.6352 17.458L15.3648 18.142ZM11.6352 21.342L8.63523 18.142L9.36477 17.458L12.3648 20.658L11.6352 21.342ZM11.5 21V15H12.5V21H11.5Z"),
10741
10788
  new Path2D("M3 12L2.65803 12.3648L2.26894 12L2.65803 11.6352L3 12ZM9 11.5C9.27614 11.5 9.5 11.7239 9.5 12C9.5 12.2761 9.27614 12.5 9 12.5L9 11.5ZM5.85803 15.3648L2.65803 12.3648L3.34197 11.6352L6.54197 14.6352L5.85803 15.3648ZM2.65803 11.6352L5.85803 8.63523L6.54197 9.36477L3.34197 12.3648L2.65803 11.6352ZM3 11.5L9 11.5L9 12.5L3 12.5L3 11.5Z")
10742
10789
  ];
10743
- const ROTATE_PATHS_2D = [
10744
- new Path2D("M22 12l-3 3-3-3"),
10745
- new Path2D("M2 12l3-3 3 3"),
10746
- new Path2D("M19.016 14v-1.95A7.05 7.05 0 0 0 8 6.22"),
10747
- new Path2D("M16.016 17.845A7.05 7.05 0 0 1 5 12.015V10"),
10748
- new Path2D("M5 10V9"),
10749
- new Path2D("M19 15v-1")
10750
- ];
10751
10790
  const baseAngleFor = {
10752
10791
  ml: 0,
10753
10792
  mr: 0,
@@ -10828,48 +10867,7 @@ try {
10828
10867
  }
10829
10868
  return cursor;
10830
10869
  };
10831
- mtr.render = (ctx, left, top, _styleOverride, fabricObject) => {
10832
- var _a3, _b2;
10833
- const action = (_b2 = (_a3 = fabricObject.canvas) == null ? void 0 : _a3._currentTransform) == null ? void 0 : _b2.action;
10834
- if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10835
- const scale = getVisualScale(fabricObject);
10836
- const p = getHoverProgress(fabricObject, "mtr");
10837
- const r = 11 * scale;
10838
- ctx.save();
10839
- ctx.beginPath();
10840
- ctx.arc(left, top, r, 0, Math.PI * 2);
10841
- ctx.closePath();
10842
- ctx.fillStyle = lerpFill(p);
10843
- ctx.strokeStyle = `rgba(15, 23, 42, ${0.18 * (1 - p)})`;
10844
- ctx.lineWidth = 0.75 * (1 - p);
10845
- ctx.shadowColor = "rgba(15, 23, 42, 0.4)";
10846
- ctx.shadowBlur = 10;
10847
- ctx.shadowOffsetY = 2;
10848
- ctx.fill();
10849
- if (p < 1) ctx.stroke();
10850
- ctx.shadowColor = "transparent";
10851
- ctx.shadowBlur = 0;
10852
- ctx.shadowOffsetY = 0;
10853
- const iconColor = p > 0.5 ? "#ffffff" : "rgba(15, 23, 42, 0.85)";
10854
- ctx.strokeStyle = iconColor;
10855
- ctx.fillStyle = iconColor;
10856
- ctx.lineJoin = "miter";
10857
- ctx.miterLimit = 4;
10858
- {
10859
- const target = r * 1.55;
10860
- const s = target / 24;
10861
- ctx.translate(left, top);
10862
- ctx.scale(s, s);
10863
- ctx.translate(-12, -12);
10864
- ctx.strokeStyle = iconColor;
10865
- ctx.lineWidth = 1 / s;
10866
- ROTATE_PATHS_2D.forEach((p2d, index) => {
10867
- ctx.lineCap = index >= 4 ? "round" : "square";
10868
- ctx.stroke(p2d);
10869
- });
10870
- }
10871
- ctx.restore();
10872
- };
10870
+ mtr.render = renderRotateHandle;
10873
10871
  }
10874
10872
  const moveActionHandler = (eventData, transform, x, y) => {
10875
10873
  const target = transform.target;
@@ -10965,6 +10963,8 @@ try {
10965
10963
  const originalControlRender = ControlProto.render;
10966
10964
  ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
10967
10965
  const actionName = String(this.actionName ?? "");
10966
+ const isRotateHandle = actionName === "rotate" || Math.abs(Number(this.x ?? 0)) < 1e-3 && Math.abs(Number(this.y ?? 0) + 0.5) < 1e-3 && Number(this.offsetY ?? 0) < 0;
10967
+ if (isRotateHandle) return renderRotateHandle(ctx, left, top, styleOverride, fabricObject);
10968
10968
  if (actionName !== "rotate" && actionName !== "drag") {
10969
10969
  const x = Number(this.x ?? 0);
10970
10970
  const y = Number(this.y ?? 0);
@@ -24710,9 +24710,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24710
24710
  }
24711
24711
  return svgString;
24712
24712
  }
24713
- const resolvedPackageVersion = "0.5.375";
24713
+ const resolvedPackageVersion = "0.5.376";
24714
24714
  const PACKAGE_VERSION = resolvedPackageVersion;
24715
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.375";
24715
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.376";
24716
24716
  const roundParityValue = (value) => {
24717
24717
  if (typeof value !== "number") return value;
24718
24718
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25526,7 +25526,7 @@ class PixldocsRenderer {
25526
25526
  await this.waitForCanvasScene(container, cloned, i);
25527
25527
  }
25528
25528
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25529
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BDdjWeve.js");
25529
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BUGumNZN.js");
25530
25530
  const prepared = preparePagesForExport(
25531
25531
  cloned.pages,
25532
25532
  canvasWidth,
@@ -27846,7 +27846,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27846
27846
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27847
27847
  sanitizeSvgTreeForPdf(svgToDraw);
27848
27848
  try {
27849
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BDdjWeve.js");
27849
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BUGumNZN.js");
27850
27850
  try {
27851
27851
  await logTextMeasurementDiagnostic(svgToDraw);
27852
27852
  } catch {
@@ -28246,4 +28246,4 @@ export {
28246
28246
  buildTeaserBlurFlatKeys as y,
28247
28247
  collectFontDescriptorsFromConfig as z
28248
28248
  };
28249
- //# sourceMappingURL=index-B0HRibrY.js.map
28249
+ //# sourceMappingURL=index-CXbUNfGV.js.map