@pixldocs/canvas-renderer 0.5.374 → 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.
@@ -10514,6 +10514,24 @@ try {
10514
10514
  const height = Math.max(0, ((size == null ? void 0 : size.y) ?? 0) - border);
10515
10515
  ctx.strokeRect(-width / 2, -height / 2, width, height);
10516
10516
  };
10517
+ if (typeof InteractiveBase.prototype.drawControlsConnectingLines === "function") {
10518
+ const originalDrawControlConnections = InteractiveBase.prototype.drawControlsConnectingLines;
10519
+ InteractiveBase.prototype.drawControlsConnectingLines = function(ctx, size) {
10520
+ var _a2;
10521
+ const disabledRotateConnections = [];
10522
+ try {
10523
+ (_a2 = this.forEachControl) == null ? void 0 : _a2.call(this, (control, key) => {
10524
+ if (key === "mtr" || String((control == null ? void 0 : control.actionName) ?? "") === "rotate") {
10525
+ disabledRotateConnections.push([control, control.withConnection]);
10526
+ control.withConnection = false;
10527
+ }
10528
+ });
10529
+ originalDrawControlConnections.call(this, ctx, size);
10530
+ } finally {
10531
+ for (const [control, wasConnected] of disabledRotateConnections) control.withConnection = wasConnected;
10532
+ }
10533
+ };
10534
+ }
10517
10535
  }
10518
10536
  if (InteractiveBase == null ? void 0 : InteractiveBase.ownDefaults) {
10519
10537
  Object.assign(InteractiveBase.ownDefaults, {
@@ -10658,6 +10676,53 @@ try {
10658
10676
  if (p < 1) ctx.stroke();
10659
10677
  ctx.restore();
10660
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
+ };
10661
10726
  const installPillRenders = (controls) => {
10662
10727
  var _a2;
10663
10728
  const CUR_SIZE = 22;
@@ -10722,14 +10787,6 @@ try {
10722
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"),
10723
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")
10724
10789
  ];
10725
- const ROTATE_PATHS_2D = [
10726
- new Path2D("M22 12l-3 3-3-3"),
10727
- new Path2D("M2 12l3-3 3 3"),
10728
- new Path2D("M19.016 14v-1.95A7.05 7.05 0 0 0 8 6.22"),
10729
- new Path2D("M16.016 17.845A7.05 7.05 0 0 1 5 12.015V10"),
10730
- new Path2D("M5 10V9"),
10731
- new Path2D("M19 15v-1")
10732
- ];
10733
10790
  const baseAngleFor = {
10734
10791
  ml: 0,
10735
10792
  mr: 0,
@@ -10810,48 +10867,7 @@ try {
10810
10867
  }
10811
10868
  return cursor;
10812
10869
  };
10813
- mtr.render = (ctx, left, top, _styleOverride, fabricObject) => {
10814
- var _a3, _b2;
10815
- const action = (_b2 = (_a3 = fabricObject.canvas) == null ? void 0 : _a3._currentTransform) == null ? void 0 : _b2.action;
10816
- if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10817
- const scale = getVisualScale(fabricObject);
10818
- const p = getHoverProgress(fabricObject, "mtr");
10819
- const r = 11 * scale;
10820
- ctx.save();
10821
- ctx.beginPath();
10822
- ctx.arc(left, top, r, 0, Math.PI * 2);
10823
- ctx.closePath();
10824
- ctx.fillStyle = lerpFill(p);
10825
- ctx.strokeStyle = `rgba(15, 23, 42, ${0.18 * (1 - p)})`;
10826
- ctx.lineWidth = 0.75 * (1 - p);
10827
- ctx.shadowColor = "rgba(15, 23, 42, 0.4)";
10828
- ctx.shadowBlur = 10;
10829
- ctx.shadowOffsetY = 2;
10830
- ctx.fill();
10831
- if (p < 1) ctx.stroke();
10832
- ctx.shadowColor = "transparent";
10833
- ctx.shadowBlur = 0;
10834
- ctx.shadowOffsetY = 0;
10835
- const iconColor = p > 0.5 ? "#ffffff" : "rgba(15, 23, 42, 0.85)";
10836
- ctx.strokeStyle = iconColor;
10837
- ctx.fillStyle = iconColor;
10838
- ctx.lineJoin = "miter";
10839
- ctx.miterLimit = 4;
10840
- {
10841
- const target = r * 1.55;
10842
- const s = target / 24;
10843
- ctx.translate(left, top);
10844
- ctx.scale(s, s);
10845
- ctx.translate(-12, -12);
10846
- ctx.strokeStyle = iconColor;
10847
- ctx.lineWidth = 1 / s;
10848
- ROTATE_PATHS_2D.forEach((p2d, index) => {
10849
- ctx.lineCap = index >= 4 ? "round" : "square";
10850
- ctx.stroke(p2d);
10851
- });
10852
- }
10853
- ctx.restore();
10854
- };
10870
+ mtr.render = renderRotateHandle;
10855
10871
  }
10856
10872
  const moveActionHandler = (eventData, transform, x, y) => {
10857
10873
  const target = transform.target;
@@ -10947,6 +10963,8 @@ try {
10947
10963
  const originalControlRender = ControlProto.render;
10948
10964
  ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
10949
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);
10950
10968
  if (actionName !== "rotate" && actionName !== "drag") {
10951
10969
  const x = Number(this.x ?? 0);
10952
10970
  const y = Number(this.y ?? 0);
@@ -24692,9 +24710,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24692
24710
  }
24693
24711
  return svgString;
24694
24712
  }
24695
- const resolvedPackageVersion = "0.5.374";
24713
+ const resolvedPackageVersion = "0.5.376";
24696
24714
  const PACKAGE_VERSION = resolvedPackageVersion;
24697
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.374";
24715
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.376";
24698
24716
  const roundParityValue = (value) => {
24699
24717
  if (typeof value !== "number") return value;
24700
24718
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25508,7 +25526,7 @@ class PixldocsRenderer {
25508
25526
  await this.waitForCanvasScene(container, cloned, i);
25509
25527
  }
25510
25528
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25511
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-HghwbAxV.js");
25529
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BUGumNZN.js");
25512
25530
  const prepared = preparePagesForExport(
25513
25531
  cloned.pages,
25514
25532
  canvasWidth,
@@ -27828,7 +27846,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27828
27846
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27829
27847
  sanitizeSvgTreeForPdf(svgToDraw);
27830
27848
  try {
27831
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-HghwbAxV.js");
27849
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BUGumNZN.js");
27832
27850
  try {
27833
27851
  await logTextMeasurementDiagnostic(svgToDraw);
27834
27852
  } catch {
@@ -28228,4 +28246,4 @@ export {
28228
28246
  buildTeaserBlurFlatKeys as y,
28229
28247
  collectFontDescriptorsFromConfig as z
28230
28248
  };
28231
- //# sourceMappingURL=index-DQyoK8Nv.js.map
28249
+ //# sourceMappingURL=index-CXbUNfGV.js.map