@pixldocs/canvas-renderer 0.5.384 → 0.5.386
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.
- package/dist/{index-ZQVav-Zq.js → index-BBprK5c2.js} +88 -95
- package/dist/index-BBprK5c2.js.map +1 -0
- package/dist/{index-CIEk2Lju.cjs → index-DPK4VKN5.cjs} +88 -95
- package/dist/index-DPK4VKN5.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CwGVLCXD.cjs → vectorPdfExport-Ch4wgY_V.cjs} +4 -4
- package/dist/{vectorPdfExport-CwGVLCXD.cjs.map → vectorPdfExport-Ch4wgY_V.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BL8RuhWq.js → vectorPdfExport-CuXE8W_Q.js} +4 -4
- package/dist/{vectorPdfExport-BL8RuhWq.js.map → vectorPdfExport-CuXE8W_Q.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CIEk2Lju.cjs.map +0 -1
- package/dist/index-ZQVav-Zq.js.map +0 -1
|
@@ -14228,35 +14228,6 @@ const PageCanvas = forwardRef(
|
|
|
14228
14228
|
const asRect0 = obj.getBoundingRect();
|
|
14229
14229
|
let didReflowTextChild = false;
|
|
14230
14230
|
for (const child of obj.getObjects()) {
|
|
14231
|
-
if (child instanceof fabric.Textbox && !child.__asRotChildSnap) {
|
|
14232
|
-
const ang = ((child.angle ?? 0) % 360 + 360) % 360;
|
|
14233
|
-
const isRot = Math.min(ang, 360 - ang) > 0.5;
|
|
14234
|
-
if (isRot) {
|
|
14235
|
-
try {
|
|
14236
|
-
const wm = child.calcTransformMatrix();
|
|
14237
|
-
const decomp = fabric.util.qrDecompose(wm);
|
|
14238
|
-
const asMatrix = obj.calcTransformMatrix();
|
|
14239
|
-
const invAS = fabric.util.invertTransform(asMatrix);
|
|
14240
|
-
const localCenter = fabric.util.transformPoint(
|
|
14241
|
-
new fabric.Point(decomp.translateX, decomp.translateY),
|
|
14242
|
-
invAS
|
|
14243
|
-
);
|
|
14244
|
-
child.__asRotChildSnap = {
|
|
14245
|
-
cx0: decomp.translateX,
|
|
14246
|
-
cy0: decomp.translateY,
|
|
14247
|
-
theta0: child.angle ?? 0,
|
|
14248
|
-
w0: child.width ?? 0,
|
|
14249
|
-
h0: child.height ?? 0,
|
|
14250
|
-
localCx: localCenter.x,
|
|
14251
|
-
localCy: localCenter.y
|
|
14252
|
-
};
|
|
14253
|
-
} catch {
|
|
14254
|
-
}
|
|
14255
|
-
}
|
|
14256
|
-
}
|
|
14257
|
-
if (child instanceof fabric.Textbox && child.__asRotChildSnap) {
|
|
14258
|
-
continue;
|
|
14259
|
-
}
|
|
14260
14231
|
if (child instanceof fabric.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
|
|
14261
14232
|
const ct = child.__cropData;
|
|
14262
14233
|
if (!ct) continue;
|
|
@@ -14328,39 +14299,54 @@ const PageCanvas = forwardRef(
|
|
|
14328
14299
|
continue;
|
|
14329
14300
|
}
|
|
14330
14301
|
if (!(child instanceof fabric.Textbox)) continue;
|
|
14302
|
+
const childAngleDeg = child.angle ?? 0;
|
|
14303
|
+
const asSx = isXSide ? sAxis : 1;
|
|
14304
|
+
const asSy = isXSide ? 1 : sAxis;
|
|
14305
|
+
const theta = fabric.util.degreesToRadians(childAngleDeg);
|
|
14306
|
+
const cosT = Math.cos(theta);
|
|
14307
|
+
const sinT = Math.sin(theta);
|
|
14331
14308
|
if (isXSide) {
|
|
14332
14309
|
if (child.__asLiveOrigW == null) {
|
|
14333
14310
|
child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
|
|
14334
14311
|
}
|
|
14335
14312
|
const origW = child.__asLiveOrigW;
|
|
14336
|
-
const
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
child._set("scaleX", 1 / sAxis);
|
|
14340
|
-
try {
|
|
14341
|
-
child.initDimensions();
|
|
14342
|
-
} catch {
|
|
14343
|
-
}
|
|
14344
|
-
child.setCoords();
|
|
14345
|
-
child.dirty = true;
|
|
14346
|
-
didReflowTextChild = true;
|
|
14347
|
-
}
|
|
14313
|
+
const sLocalX = asSx * cosT * cosT + sinT * sinT;
|
|
14314
|
+
const newW = Math.max(20, origW * sLocalX);
|
|
14315
|
+
child._set("width", newW);
|
|
14348
14316
|
} else {
|
|
14349
14317
|
if (child.__asLiveOrigH == null) {
|
|
14350
14318
|
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
14351
14319
|
}
|
|
14352
14320
|
const origH = child.__asLiveOrigH;
|
|
14353
|
-
const
|
|
14321
|
+
const sLocalY = asSy * cosT * cosT + sinT * sinT;
|
|
14322
|
+
const newH = Math.max(20, origH * sLocalY);
|
|
14354
14323
|
child.minBoxHeight = newH;
|
|
14355
|
-
child._set("scaleY", 1 / sAxis);
|
|
14356
|
-
try {
|
|
14357
|
-
child.initDimensions();
|
|
14358
|
-
} catch {
|
|
14359
|
-
}
|
|
14360
|
-
child.setCoords();
|
|
14361
|
-
child.dirty = true;
|
|
14362
|
-
didReflowTextChild = true;
|
|
14363
14324
|
}
|
|
14325
|
+
try {
|
|
14326
|
+
const inv = [1 / asSx, 0, 0, 1 / asSy, 0, 0];
|
|
14327
|
+
const Rtheta = fabric.util.composeMatrix({
|
|
14328
|
+
angle: childAngleDeg,
|
|
14329
|
+
scaleX: 1,
|
|
14330
|
+
scaleY: 1,
|
|
14331
|
+
translateX: 0,
|
|
14332
|
+
translateY: 0
|
|
14333
|
+
});
|
|
14334
|
+
const M = fabric.util.multiplyTransformMatrices(inv, Rtheta);
|
|
14335
|
+
const dec = fabric.util.qrDecompose(M);
|
|
14336
|
+
child._set("angle", dec.angle);
|
|
14337
|
+
child._set("scaleX", dec.scaleX);
|
|
14338
|
+
child._set("scaleY", dec.scaleY);
|
|
14339
|
+
child._set("skewX", dec.skewX);
|
|
14340
|
+
child._set("skewY", dec.skewY);
|
|
14341
|
+
} catch {
|
|
14342
|
+
}
|
|
14343
|
+
try {
|
|
14344
|
+
child.initDimensions();
|
|
14345
|
+
} catch {
|
|
14346
|
+
}
|
|
14347
|
+
child.setCoords();
|
|
14348
|
+
child.dirty = true;
|
|
14349
|
+
didReflowTextChild = true;
|
|
14364
14350
|
}
|
|
14365
14351
|
if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
|
|
14366
14352
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
@@ -14745,7 +14731,6 @@ const PageCanvas = forwardRef(
|
|
|
14745
14731
|
delete child.__asLiveOrigW;
|
|
14746
14732
|
delete child.__asLiveOrigH;
|
|
14747
14733
|
delete child.__asLiveRotSnap;
|
|
14748
|
-
delete child.__asRotChildSnap;
|
|
14749
14734
|
}
|
|
14750
14735
|
}
|
|
14751
14736
|
} catch {
|
|
@@ -15431,6 +15416,14 @@ const PageCanvas = forwardRef(
|
|
|
15431
15416
|
finalHeight = 0;
|
|
15432
15417
|
finalScaleX = 1;
|
|
15433
15418
|
finalScaleY = 1;
|
|
15419
|
+
} else if (obj instanceof fabric.Textbox && isActiveSelection && (sourceElement == null ? void 0 : sourceElement.type) === "text" && (activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb") && Math.min(
|
|
15420
|
+
((sourceElement.angle ?? obj.angle ?? 0) % 360 + 360) % 360,
|
|
15421
|
+
360 - ((sourceElement.angle ?? obj.angle ?? 0) % 360 + 360) % 360
|
|
15422
|
+
) > 0.5) {
|
|
15423
|
+
finalWidth = Math.max(1, intrinsicWidth);
|
|
15424
|
+
finalHeight = Math.max(1, intrinsicHeight);
|
|
15425
|
+
finalScaleX = 1;
|
|
15426
|
+
finalScaleY = 1;
|
|
15434
15427
|
} else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
15435
15428
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
15436
15429
|
const sy = Math.abs(decomposed.scaleY || 1);
|
|
@@ -15630,6 +15623,45 @@ const PageCanvas = forwardRef(
|
|
|
15630
15623
|
if (sourceElement && sourceElement.opacity !== void 0) {
|
|
15631
15624
|
elementUpdate.opacity = sourceElement.opacity;
|
|
15632
15625
|
}
|
|
15626
|
+
const isActiveSelectionSideHandle = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
|
|
15627
|
+
if (isActiveSelection && isActiveSelectionSideHandle && obj instanceof fabric.Textbox && (sourceElement == null ? void 0 : sourceElement.type) === "text") {
|
|
15628
|
+
const cleanAngle = Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? decomposed.angle ?? 0;
|
|
15629
|
+
const normalizedTextAngle = (cleanAngle % 360 + 360) % 360;
|
|
15630
|
+
const isRotatedText = Math.min(normalizedTextAngle, 360 - normalizedTextAngle) > 0.5;
|
|
15631
|
+
if (isRotatedText) {
|
|
15632
|
+
try {
|
|
15633
|
+
const cleanW = Math.max(1, Number(obj.width ?? elementUpdate.width ?? finalWidth));
|
|
15634
|
+
const cleanH = Math.max(1, Number(elementUpdate.height ?? obj.height ?? finalHeight));
|
|
15635
|
+
const cx = decomposed.translateX ?? absoluteLeft + cleanW / 2;
|
|
15636
|
+
const cy = decomposed.translateY ?? absoluteTop + cleanH / 2;
|
|
15637
|
+
const theta = fabric.util.degreesToRadians(cleanAngle);
|
|
15638
|
+
const cos = Math.cos(theta);
|
|
15639
|
+
const sin = Math.sin(theta);
|
|
15640
|
+
const cleanAbsLeft = cx - (cos * cleanW / 2 - sin * cleanH / 2);
|
|
15641
|
+
const cleanAbsTop = cy - (sin * cleanW / 2 + cos * cleanH / 2);
|
|
15642
|
+
const cleanStorePos = absoluteToStorePosition(cleanAbsLeft, cleanAbsTop, objId, pageChildrenForSave);
|
|
15643
|
+
elementUpdate.left = cleanStorePos.left;
|
|
15644
|
+
elementUpdate.top = cleanStorePos.top;
|
|
15645
|
+
elementUpdate.width = cleanW;
|
|
15646
|
+
elementUpdate.height = cleanH;
|
|
15647
|
+
elementUpdate.angle = cleanAngle;
|
|
15648
|
+
elementUpdate.scaleX = 1;
|
|
15649
|
+
elementUpdate.scaleY = 1;
|
|
15650
|
+
elementUpdate.skewX = 0;
|
|
15651
|
+
elementUpdate.skewY = 0;
|
|
15652
|
+
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
15653
|
+
translateX: cx,
|
|
15654
|
+
translateY: cy,
|
|
15655
|
+
angle: cleanAngle,
|
|
15656
|
+
scaleX: 1,
|
|
15657
|
+
scaleY: 1,
|
|
15658
|
+
skewX: 0,
|
|
15659
|
+
skewY: 0
|
|
15660
|
+
});
|
|
15661
|
+
} catch {
|
|
15662
|
+
}
|
|
15663
|
+
}
|
|
15664
|
+
}
|
|
15633
15665
|
if (debugGroupTextCornerResize && obj instanceof fabric.Textbox) {
|
|
15634
15666
|
logGroupTextResizeDebug("store-update-text", {
|
|
15635
15667
|
time: Math.round(performance.now()),
|
|
@@ -15665,45 +15697,6 @@ const PageCanvas = forwardRef(
|
|
|
15665
15697
|
elementUpdate
|
|
15666
15698
|
});
|
|
15667
15699
|
}
|
|
15668
|
-
const rotSnap = obj.__asRotChildSnap;
|
|
15669
|
-
if (rotSnap && isActiveSelection && activeObj && obj instanceof fabric.Textbox) {
|
|
15670
|
-
try {
|
|
15671
|
-
const asFinal = activeObj.calcTransformMatrix();
|
|
15672
|
-
const newWorldCenter = fabric.util.transformPoint(
|
|
15673
|
-
new fabric.Point(rotSnap.localCx, rotSnap.localCy),
|
|
15674
|
-
asFinal
|
|
15675
|
-
);
|
|
15676
|
-
const theta = rotSnap.theta0;
|
|
15677
|
-
const w = rotSnap.w0;
|
|
15678
|
-
const h = rotSnap.h0;
|
|
15679
|
-
const rad = theta * Math.PI / 180;
|
|
15680
|
-
const cos = Math.cos(rad);
|
|
15681
|
-
const sin = Math.sin(rad);
|
|
15682
|
-
const ox = newWorldCenter.x - (cos * w / 2 - sin * h / 2);
|
|
15683
|
-
const oy = newWorldCenter.y - (sin * w / 2 + cos * h / 2);
|
|
15684
|
-
const rotStorePos = absoluteToStorePosition(ox, oy, objId, pageChildrenForSave);
|
|
15685
|
-
elementUpdate.left = rotStorePos.left;
|
|
15686
|
-
elementUpdate.top = rotStorePos.top;
|
|
15687
|
-
elementUpdate.width = w;
|
|
15688
|
-
elementUpdate.height = h;
|
|
15689
|
-
elementUpdate.angle = theta;
|
|
15690
|
-
elementUpdate.scaleX = 1;
|
|
15691
|
-
elementUpdate.scaleY = 1;
|
|
15692
|
-
elementUpdate.skewX = 0;
|
|
15693
|
-
elementUpdate.skewY = 0;
|
|
15694
|
-
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
15695
|
-
translateX: newWorldCenter.x,
|
|
15696
|
-
translateY: newWorldCenter.y,
|
|
15697
|
-
angle: theta,
|
|
15698
|
-
scaleX: 1,
|
|
15699
|
-
scaleY: 1,
|
|
15700
|
-
skewX: 0,
|
|
15701
|
-
skewY: 0
|
|
15702
|
-
});
|
|
15703
|
-
} catch {
|
|
15704
|
-
}
|
|
15705
|
-
delete obj.__asRotChildSnap;
|
|
15706
|
-
}
|
|
15707
15700
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
15708
15701
|
obj.setCoords();
|
|
15709
15702
|
}
|
|
@@ -24885,9 +24878,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24885
24878
|
}
|
|
24886
24879
|
return svgString;
|
|
24887
24880
|
}
|
|
24888
|
-
const resolvedPackageVersion = "0.5.
|
|
24881
|
+
const resolvedPackageVersion = "0.5.386";
|
|
24889
24882
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24890
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24883
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.386";
|
|
24891
24884
|
const roundParityValue = (value) => {
|
|
24892
24885
|
if (typeof value !== "number") return value;
|
|
24893
24886
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25701,7 +25694,7 @@ class PixldocsRenderer {
|
|
|
25701
25694
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25702
25695
|
}
|
|
25703
25696
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25704
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25697
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CuXE8W_Q.js");
|
|
25705
25698
|
const prepared = preparePagesForExport(
|
|
25706
25699
|
cloned.pages,
|
|
25707
25700
|
canvasWidth,
|
|
@@ -28021,7 +28014,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28021
28014
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28022
28015
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28023
28016
|
try {
|
|
28024
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28017
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CuXE8W_Q.js");
|
|
28025
28018
|
try {
|
|
28026
28019
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28027
28020
|
} catch {
|
|
@@ -28421,4 +28414,4 @@ export {
|
|
|
28421
28414
|
buildTeaserBlurFlatKeys as y,
|
|
28422
28415
|
collectFontDescriptorsFromConfig as z
|
|
28423
28416
|
};
|
|
28424
|
-
//# sourceMappingURL=index-
|
|
28417
|
+
//# sourceMappingURL=index-BBprK5c2.js.map
|