@pixldocs/canvas-renderer 0.5.167 → 0.5.169
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-CQEAcApH.cjs → index-Bg1FRZ3d.cjs} +172 -25
- package/dist/index-Bg1FRZ3d.cjs.map +1 -0
- package/dist/{index-7Etfiz-e.js → index-qJRuErt-.js} +172 -25
- package/dist/index-qJRuErt-.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BayOs-9z.cjs → vectorPdfExport-BU855BbG.cjs} +4 -4
- package/dist/{vectorPdfExport-BayOs-9z.cjs.map → vectorPdfExport-BU855BbG.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Ce68BOFf.js → vectorPdfExport-C2jE125-.js} +4 -4
- package/dist/{vectorPdfExport-Ce68BOFf.js.map → vectorPdfExport-C2jE125-.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-7Etfiz-e.js.map +0 -1
- package/dist/index-CQEAcApH.cjs.map +0 -1
|
@@ -348,11 +348,12 @@ function getCacheKey(element) {
|
|
|
348
348
|
scaleY: element.scaleY,
|
|
349
349
|
splitByGrapheme: element.splitByGrapheme,
|
|
350
350
|
overflowPolicy: element.overflowPolicy,
|
|
351
|
-
height: element.overflowPolicy === "auto-shrink" ? element.height : void 0
|
|
351
|
+
height: element.overflowPolicy === "auto-shrink" ? element.height : void 0,
|
|
352
|
+
minBoxHeight: element.minBoxHeight,
|
|
353
|
+
verticalAlign: element.verticalAlign
|
|
352
354
|
});
|
|
353
355
|
}
|
|
354
356
|
function measureTextHeight(element) {
|
|
355
|
-
var _a;
|
|
356
357
|
if (element.type !== "text") {
|
|
357
358
|
return element.height || 20;
|
|
358
359
|
}
|
|
@@ -368,8 +369,8 @@ function measureTextHeight(element) {
|
|
|
368
369
|
let fontSize = element.fontSize || 16;
|
|
369
370
|
const overflowPolicy = element.overflowPolicy || "grow-and-push";
|
|
370
371
|
if (overflowPolicy === "auto-shrink") {
|
|
371
|
-
const
|
|
372
|
-
const
|
|
372
|
+
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
373
|
+
const baseHeight = typeof element.height === "number" ? Math.max(element.height, minBoxH) : minBoxH > 0 ? minBoxH : element.height;
|
|
373
374
|
while (fontSize > 1) {
|
|
374
375
|
const testTb = new fabric__namespace.Textbox(textToMeasure, {
|
|
375
376
|
width: measureWidth,
|
|
@@ -383,11 +384,9 @@ function measureTextHeight(element) {
|
|
|
383
384
|
});
|
|
384
385
|
testTb.initDimensions();
|
|
385
386
|
const textHeight = testTb.height || 0;
|
|
386
|
-
const renderedLineCount = ((_a = testTb.textLines) == null ? void 0 : _a.length) || 1;
|
|
387
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
388
387
|
const fitsHeight = !baseHeight || textHeight <= baseHeight;
|
|
389
388
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
|
|
390
|
-
if (
|
|
389
|
+
if (fitsHeight && fitsWidth) break;
|
|
391
390
|
fontSize--;
|
|
392
391
|
}
|
|
393
392
|
const finalTb = new fabric__namespace.Textbox(textToMeasure, {
|
|
@@ -402,7 +401,7 @@ function measureTextHeight(element) {
|
|
|
402
401
|
});
|
|
403
402
|
finalTb.initDimensions();
|
|
404
403
|
const measuredH = (finalTb.height || element.height || 20) * (element.scaleY || 1);
|
|
405
|
-
const cappedH = typeof baseHeight === "number" ? Math.
|
|
404
|
+
const cappedH = typeof baseHeight === "number" ? Math.max(baseHeight * (element.scaleY || 1), measuredH) : measuredH;
|
|
406
405
|
heightCache.set(cacheKey, { height: cappedH, timestamp: Date.now() });
|
|
407
406
|
return cappedH;
|
|
408
407
|
}
|
|
@@ -5550,6 +5549,54 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
5550
5549
|
return true;
|
|
5551
5550
|
});
|
|
5552
5551
|
}
|
|
5552
|
+
const TextboxProto = fabric__namespace.Textbox.prototype;
|
|
5553
|
+
if (!TextboxProto.__pixldocsOrigCalcTextHeight) {
|
|
5554
|
+
TextboxProto.__pixldocsOrigCalcTextHeight = TextboxProto.calcTextHeight;
|
|
5555
|
+
TextboxProto.calcTextHeight = function() {
|
|
5556
|
+
const orig = TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5557
|
+
this._contentHeight = orig;
|
|
5558
|
+
const min = this.minBoxHeight || 0;
|
|
5559
|
+
return min > orig ? min : orig;
|
|
5560
|
+
};
|
|
5561
|
+
}
|
|
5562
|
+
if (!TextboxProto.__pixldocsOrigGetTopOffset) {
|
|
5563
|
+
TextboxProto.__pixldocsOrigGetTopOffset = TextboxProto._getTopOffset;
|
|
5564
|
+
TextboxProto._getTopOffset = function() {
|
|
5565
|
+
const baseOffset = TextboxProto.__pixldocsOrigGetTopOffset.call(this);
|
|
5566
|
+
const valign = this.verticalAlign || "top";
|
|
5567
|
+
if (valign === "top") return baseOffset;
|
|
5568
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5569
|
+
const padding = (this.height || 0) - content;
|
|
5570
|
+
if (padding <= 0) return baseOffset;
|
|
5571
|
+
if (valign === "middle") return baseOffset + padding / 2;
|
|
5572
|
+
if (valign === "bottom") return baseOffset + padding;
|
|
5573
|
+
return baseOffset;
|
|
5574
|
+
};
|
|
5575
|
+
}
|
|
5576
|
+
if (TextboxProto._getSVGLeftTopOffsets && !TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets) {
|
|
5577
|
+
TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets = TextboxProto._getSVGLeftTopOffsets;
|
|
5578
|
+
TextboxProto._getSVGLeftTopOffsets = function() {
|
|
5579
|
+
const base = TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets.call(this);
|
|
5580
|
+
const valign = this.verticalAlign || "top";
|
|
5581
|
+
if (valign === "top") return base;
|
|
5582
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5583
|
+
const padding = (this.height || 0) - content;
|
|
5584
|
+
if (padding <= 0) return base;
|
|
5585
|
+
const extra = valign === "middle" ? padding / 2 : padding;
|
|
5586
|
+
return { ...base, textTop: base.textTop + extra };
|
|
5587
|
+
};
|
|
5588
|
+
}
|
|
5589
|
+
const stateProps = fabric__namespace.Textbox.prototype.stateProperties;
|
|
5590
|
+
if (Array.isArray(stateProps)) {
|
|
5591
|
+
if (!stateProps.includes("minBoxHeight")) stateProps.push("minBoxHeight");
|
|
5592
|
+
if (!stateProps.includes("verticalAlign")) stateProps.push("verticalAlign");
|
|
5593
|
+
}
|
|
5594
|
+
const cacheProps = fabric__namespace.Textbox.prototype.cacheProperties;
|
|
5595
|
+
if (Array.isArray(cacheProps)) {
|
|
5596
|
+
if (!cacheProps.includes("minBoxHeight")) cacheProps.push("minBoxHeight");
|
|
5597
|
+
if (!cacheProps.includes("verticalAlign")) cacheProps.push("verticalAlign");
|
|
5598
|
+
}
|
|
5599
|
+
TextboxProto.__pixldocsTextboxExtended = true;
|
|
5553
5600
|
const PD_BG_KEY = "__pdBg";
|
|
5554
5601
|
const PATCHED_KEY = "__pdBgPatched";
|
|
5555
5602
|
function extractTextBgConfig(element) {
|
|
@@ -6327,6 +6374,8 @@ function createText(element) {
|
|
|
6327
6374
|
const fixedWidth = Math.max(baseWidth, 1);
|
|
6328
6375
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
6329
6376
|
if (overflowPolicy === "auto-shrink") {
|
|
6377
|
+
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
6378
|
+
const heightBound = Math.max(baseHeight || 0, minBoxHForShrink);
|
|
6330
6379
|
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
6331
6380
|
const debugAutoShrink = typeof window !== "undefined" && window.__pixldocsDebugAutoShrink === true;
|
|
6332
6381
|
const startFontSize = fontSize;
|
|
@@ -6349,7 +6398,7 @@ function createText(element) {
|
|
|
6349
6398
|
const textHeight = testTextbox.height || 0;
|
|
6350
6399
|
const renderedLineCount = ((_a = testTextbox.textLines) == null ? void 0 : _a.length) || 1;
|
|
6351
6400
|
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
6352
|
-
const fitsHeight =
|
|
6401
|
+
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
6353
6402
|
const widthMetrics = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
6354
6403
|
const { maxLineWidth, widthDidGrow, fitsWidth } = widthMetrics;
|
|
6355
6404
|
if (debugAutoShrink) {
|
|
@@ -6369,7 +6418,7 @@ function createText(element) {
|
|
|
6369
6418
|
iterationSamples.push(lastIter);
|
|
6370
6419
|
}
|
|
6371
6420
|
}
|
|
6372
|
-
if (
|
|
6421
|
+
if (fitsHeight && fitsWidth) {
|
|
6373
6422
|
breakReason = "fits";
|
|
6374
6423
|
break;
|
|
6375
6424
|
}
|
|
@@ -6462,7 +6511,15 @@ function createText(element) {
|
|
|
6462
6511
|
// formatting tokens (**, __, [c=...], etc). Disable inline edit and steer
|
|
6463
6512
|
// users to the right-panel text field which exposes the raw markdown.
|
|
6464
6513
|
editable: !formattingEnabled,
|
|
6465
|
-
...formattingEnabled ? { styles: parsedStyles } : element.styles ? { styles: element.styles } : {}
|
|
6514
|
+
...formattingEnabled ? { styles: parsedStyles } : element.styles ? { styles: element.styles } : {},
|
|
6515
|
+
// Vertical sizing extensions (see fabricTextboxExtensions.ts). Apply for
|
|
6516
|
+
// every overflow policy — in auto-shrink mode `minBoxHeight` acts as a
|
|
6517
|
+
// visual floor so the box renders at the user's chosen height even after
|
|
6518
|
+
// the font shrinks to fit. PageCanvas's auto-shrink loop already uses the
|
|
6519
|
+
// same value as a fit-target, so the rendered box and the shrink target
|
|
6520
|
+
// stay in sync (parity with the Use page / EC2 renderer).
|
|
6521
|
+
...(element.minBoxHeight ?? 0) > 0 ? { minBoxHeight: element.minBoxHeight } : {},
|
|
6522
|
+
verticalAlign: element.verticalAlign || "top"
|
|
6466
6523
|
});
|
|
6467
6524
|
textbox.__formattingEnabled = formattingEnabled;
|
|
6468
6525
|
textbox.initDimensions();
|
|
@@ -8057,6 +8114,22 @@ const PageCanvas = react.forwardRef(
|
|
|
8057
8114
|
obj.dirty = true;
|
|
8058
8115
|
}
|
|
8059
8116
|
}
|
|
8117
|
+
if (obj instanceof fabric__namespace.Textbox) {
|
|
8118
|
+
const sy = obj.scaleY ?? 1;
|
|
8119
|
+
if (Math.abs(sy - 1) > 1e-3) {
|
|
8120
|
+
const center = obj.getCenterPoint();
|
|
8121
|
+
const newMinH = Math.max(0, (obj.height ?? 0) * Math.abs(sy));
|
|
8122
|
+
obj.minBoxHeight = newMinH;
|
|
8123
|
+
obj.scaleY = 1;
|
|
8124
|
+
try {
|
|
8125
|
+
obj.initDimensions();
|
|
8126
|
+
} catch {
|
|
8127
|
+
}
|
|
8128
|
+
obj.setPositionByOrigin(center, "center", "center");
|
|
8129
|
+
obj.setCoords();
|
|
8130
|
+
obj.dirty = true;
|
|
8131
|
+
}
|
|
8132
|
+
}
|
|
8060
8133
|
if (obj.__lockScaleDuringCrop || obj.__cropDrag) {
|
|
8061
8134
|
obj.set({ scaleX: 1, scaleY: 1 });
|
|
8062
8135
|
obj.setCoords();
|
|
@@ -8633,6 +8706,12 @@ const PageCanvas = react.forwardRef(
|
|
|
8633
8706
|
scaleY: finalScaleY,
|
|
8634
8707
|
transformMatrix: finalAbsoluteMatrix
|
|
8635
8708
|
};
|
|
8709
|
+
if (obj instanceof fabric__namespace.Textbox) {
|
|
8710
|
+
const baked = obj.minBoxHeight;
|
|
8711
|
+
if (typeof baked === "number" && baked > 0) {
|
|
8712
|
+
elementUpdate.minBoxHeight = baked;
|
|
8713
|
+
}
|
|
8714
|
+
}
|
|
8636
8715
|
if (sourceElement && sourceElement.opacity !== void 0) {
|
|
8637
8716
|
elementUpdate.opacity = sourceElement.opacity;
|
|
8638
8717
|
}
|
|
@@ -9344,7 +9423,9 @@ const PageCanvas = react.forwardRef(
|
|
|
9344
9423
|
const resolvedSizeForCompare = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
|
|
9345
9424
|
const fabricText = existingObj.text ?? "";
|
|
9346
9425
|
const storeText = element.text ?? "";
|
|
9347
|
-
const otherPropsChanged = Math.abs((existingObj.width ?? 0) - resolvedSizeForCompare.width) > 0.1 || Math.abs((existingObj.height ?? 0) - resolvedSizeForCompare.height) > 0.1 || Math.abs((existingObj.angle ?? 0) - (element.angle ?? 0)) > 0.1 || Math.abs((existingObj.scaleX ?? 1) - (element.scaleX ?? 1)) > 0.01 || Math.abs((existingObj.scaleY ?? 1) - (element.scaleY ?? 1)) > 0.01 || (existingObj.flipX ?? false) !== (element.flipX ?? false) || (existingObj.flipY ?? false) !== (element.flipY ?? false) || fabricText !== storeText || existingObj.fill !== (element.fill ?? "") || existingObj.stroke !== (element.stroke ?? "") || Math.abs((existingObj.strokeWidth ?? 0) - (element.strokeWidth ?? 0)) > 0.01 || Math.abs((existingObj.opacity ?? 1) - (element.opacity ?? 1)) > 0.01 || (existingObj.fontSize ?? 0) !== (element.fontSize ?? 0) || (existingObj.fontFamily ?? "") !== (element.fontFamily ?? "") || //
|
|
9426
|
+
const otherPropsChanged = Math.abs((existingObj.width ?? 0) - resolvedSizeForCompare.width) > 0.1 || Math.abs((existingObj.height ?? 0) - resolvedSizeForCompare.height) > 0.1 || Math.abs((existingObj.angle ?? 0) - (element.angle ?? 0)) > 0.1 || Math.abs((existingObj.scaleX ?? 1) - (element.scaleX ?? 1)) > 0.01 || Math.abs((existingObj.scaleY ?? 1) - (element.scaleY ?? 1)) > 0.01 || (existingObj.flipX ?? false) !== (element.flipX ?? false) || (existingObj.flipY ?? false) !== (element.flipY ?? false) || fabricText !== storeText || existingObj.fill !== (element.fill ?? "") || existingObj.stroke !== (element.stroke ?? "") || Math.abs((existingObj.strokeWidth ?? 0) - (element.strokeWidth ?? 0)) > 0.01 || Math.abs((existingObj.opacity ?? 1) - (element.opacity ?? 1)) > 0.01 || (existingObj.fontSize ?? 0) !== (element.fontSize ?? 0) || (existingObj.fontFamily ?? "") !== (element.fontFamily ?? "") || // Vertical alignment & min box height: panel-driven changes must trigger a re-apply
|
|
9427
|
+
// so _getTopOffset (verticalAlign) and calcTextHeight (minBoxHeight) repaint correctly.
|
|
9428
|
+
(existingObj.verticalAlign ?? "top") !== (element.verticalAlign ?? "top") || Math.abs((existingObj.minBoxHeight ?? 0) - (element.minBoxHeight ?? 0)) > 0.1 || // Detect text background + shadow changes so panel edits flow into Fabric.
|
|
9348
9429
|
JSON.stringify({
|
|
9349
9430
|
c: element.textBgColor ?? null,
|
|
9350
9431
|
p: element.textBgPadding ?? 0,
|
|
@@ -9799,7 +9880,7 @@ const PageCanvas = react.forwardRef(
|
|
|
9799
9880
|
});
|
|
9800
9881
|
}, [selectedIds, isActive, ready, elements]);
|
|
9801
9882
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
9802
|
-
var _a, _b
|
|
9883
|
+
var _a, _b;
|
|
9803
9884
|
const fc = fabricRef.current;
|
|
9804
9885
|
if (fc && isTransforming(fc)) {
|
|
9805
9886
|
return;
|
|
@@ -10168,7 +10249,8 @@ const PageCanvas = react.forwardRef(
|
|
|
10168
10249
|
const fixedWidth = Math.max(storedWidth, 1);
|
|
10169
10250
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
10170
10251
|
if (overflowPolicy === "auto-shrink") {
|
|
10171
|
-
const
|
|
10252
|
+
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
10253
|
+
const heightBound = Math.max(rH || 0, minBoxHForShrink);
|
|
10172
10254
|
while (fontSize > 1) {
|
|
10173
10255
|
const testTextbox = new fabric__namespace.Textbox(text, {
|
|
10174
10256
|
width: fixedWidth,
|
|
@@ -10178,15 +10260,13 @@ const PageCanvas = react.forwardRef(
|
|
|
10178
10260
|
fontStyle: element.fontStyle || "normal",
|
|
10179
10261
|
lineHeight: element.lineHeight || 1.2,
|
|
10180
10262
|
charSpacing: element.charSpacing || 0,
|
|
10181
|
-
splitByGrapheme: false
|
|
10263
|
+
splitByGrapheme: element.splitByGrapheme ?? false
|
|
10182
10264
|
});
|
|
10183
10265
|
testTextbox.initDimensions();
|
|
10184
10266
|
const textHeight = testTextbox.height || 0;
|
|
10185
|
-
const
|
|
10186
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
10187
|
-
const fitsHeight = rH <= 0 || textHeight <= rH;
|
|
10267
|
+
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
10188
10268
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
10189
|
-
if (
|
|
10269
|
+
if (fitsHeight && fitsWidth) {
|
|
10190
10270
|
break;
|
|
10191
10271
|
}
|
|
10192
10272
|
fontSize--;
|
|
@@ -10257,6 +10337,10 @@ const PageCanvas = react.forwardRef(
|
|
|
10257
10337
|
splitByGrapheme,
|
|
10258
10338
|
text
|
|
10259
10339
|
});
|
|
10340
|
+
const valign = element.verticalAlign || "top";
|
|
10341
|
+
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
10342
|
+
obj.verticalAlign = valign;
|
|
10343
|
+
obj.minBoxHeight = minBoxH;
|
|
10260
10344
|
if (element.formattingEnabled === true) {
|
|
10261
10345
|
obj.styles = parsedStyles || {};
|
|
10262
10346
|
} else {
|
|
@@ -10279,7 +10363,7 @@ const PageCanvas = react.forwardRef(
|
|
|
10279
10363
|
} catch {
|
|
10280
10364
|
}
|
|
10281
10365
|
obj.dirty = true;
|
|
10282
|
-
(
|
|
10366
|
+
(_b = obj.setCoords) == null ? void 0 : _b.call(obj);
|
|
10283
10367
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
10284
10368
|
c: element.textBgColor ?? null,
|
|
10285
10369
|
p: element.textBgPadding ?? 0,
|
|
@@ -16036,9 +16120,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
16036
16120
|
}
|
|
16037
16121
|
return svgString;
|
|
16038
16122
|
}
|
|
16039
|
-
const resolvedPackageVersion = "0.5.
|
|
16123
|
+
const resolvedPackageVersion = "0.5.169";
|
|
16040
16124
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
16041
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
16125
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.169";
|
|
16042
16126
|
const roundParityValue = (value) => {
|
|
16043
16127
|
if (typeof value !== "number") return value;
|
|
16044
16128
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -16164,6 +16248,68 @@ function installUnderlineFix(fab) {
|
|
|
16164
16248
|
__underlineFixInstalled = true;
|
|
16165
16249
|
console.log(`[canvas-renderer] underline-fix monkey patch installed (v${PACKAGE_VERSION})`);
|
|
16166
16250
|
}
|
|
16251
|
+
let __textboxBoxExtensionsInstalled = false;
|
|
16252
|
+
function installTextboxBoxExtensions(fab) {
|
|
16253
|
+
var _a;
|
|
16254
|
+
if (__textboxBoxExtensionsInstalled) return;
|
|
16255
|
+
const TextboxProto2 = (_a = fab.Textbox) == null ? void 0 : _a.prototype;
|
|
16256
|
+
if (!TextboxProto2) return;
|
|
16257
|
+
if (TextboxProto2.__pixldocsTextboxExtended) {
|
|
16258
|
+
__textboxBoxExtensionsInstalled = true;
|
|
16259
|
+
return;
|
|
16260
|
+
}
|
|
16261
|
+
if (typeof TextboxProto2.calcTextHeight === "function") {
|
|
16262
|
+
const origCalc = TextboxProto2.calcTextHeight;
|
|
16263
|
+
TextboxProto2.__pixldocsOrigCalcTextHeight = origCalc;
|
|
16264
|
+
TextboxProto2.calcTextHeight = function() {
|
|
16265
|
+
const orig = origCalc.call(this);
|
|
16266
|
+
this._contentHeight = orig;
|
|
16267
|
+
const min = this.minBoxHeight || 0;
|
|
16268
|
+
return min > orig ? min : orig;
|
|
16269
|
+
};
|
|
16270
|
+
}
|
|
16271
|
+
if (typeof TextboxProto2._getTopOffset === "function") {
|
|
16272
|
+
const origTop = TextboxProto2._getTopOffset;
|
|
16273
|
+
TextboxProto2.__pixldocsOrigGetTopOffset = origTop;
|
|
16274
|
+
TextboxProto2._getTopOffset = function() {
|
|
16275
|
+
const baseOffset = origTop.call(this);
|
|
16276
|
+
const valign = this.verticalAlign || "top";
|
|
16277
|
+
if (valign === "top") return baseOffset;
|
|
16278
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto2.__pixldocsOrigCalcTextHeight ? TextboxProto2.__pixldocsOrigCalcTextHeight.call(this) : 0;
|
|
16279
|
+
const padding = (this.height || 0) - content;
|
|
16280
|
+
if (padding <= 0) return baseOffset;
|
|
16281
|
+
if (valign === "middle") return baseOffset + padding / 2;
|
|
16282
|
+
if (valign === "bottom") return baseOffset + padding;
|
|
16283
|
+
return baseOffset;
|
|
16284
|
+
};
|
|
16285
|
+
}
|
|
16286
|
+
if (typeof TextboxProto2._getSVGLeftTopOffsets === "function") {
|
|
16287
|
+
const origSvgOffsets = TextboxProto2._getSVGLeftTopOffsets;
|
|
16288
|
+
TextboxProto2.__pixldocsOrigGetSVGLeftTopOffsets = origSvgOffsets;
|
|
16289
|
+
TextboxProto2._getSVGLeftTopOffsets = function() {
|
|
16290
|
+
const base = origSvgOffsets.call(this);
|
|
16291
|
+
const valign = this.verticalAlign || "top";
|
|
16292
|
+
if (valign === "top") return base;
|
|
16293
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto2.__pixldocsOrigCalcTextHeight ? TextboxProto2.__pixldocsOrigCalcTextHeight.call(this) : 0;
|
|
16294
|
+
const padding = (this.height || 0) - content;
|
|
16295
|
+
if (padding <= 0) return base;
|
|
16296
|
+
const extra = valign === "middle" ? padding / 2 : padding;
|
|
16297
|
+
return { ...base, textTop: base.textTop + extra };
|
|
16298
|
+
};
|
|
16299
|
+
}
|
|
16300
|
+
const stateProps2 = TextboxProto2.stateProperties;
|
|
16301
|
+
if (Array.isArray(stateProps2)) {
|
|
16302
|
+
if (!stateProps2.includes("minBoxHeight")) stateProps2.push("minBoxHeight");
|
|
16303
|
+
if (!stateProps2.includes("verticalAlign")) stateProps2.push("verticalAlign");
|
|
16304
|
+
}
|
|
16305
|
+
const cacheProps2 = TextboxProto2.cacheProperties;
|
|
16306
|
+
if (Array.isArray(cacheProps2)) {
|
|
16307
|
+
if (!cacheProps2.includes("minBoxHeight")) cacheProps2.push("minBoxHeight");
|
|
16308
|
+
if (!cacheProps2.includes("verticalAlign")) cacheProps2.push("verticalAlign");
|
|
16309
|
+
}
|
|
16310
|
+
TextboxProto2.__pixldocsTextboxExtended = true;
|
|
16311
|
+
__textboxBoxExtensionsInstalled = true;
|
|
16312
|
+
}
|
|
16167
16313
|
function configHasAutoShrinkText(config) {
|
|
16168
16314
|
var _a;
|
|
16169
16315
|
if (!((_a = config == null ? void 0 : config.pages) == null ? void 0 : _a.length)) return false;
|
|
@@ -16186,6 +16332,7 @@ class PixldocsRenderer {
|
|
|
16186
16332
|
this.config = config;
|
|
16187
16333
|
this.installRuntimeGlobals();
|
|
16188
16334
|
installUnderlineFix(fabric__namespace);
|
|
16335
|
+
installTextboxBoxExtensions(fabric__namespace);
|
|
16189
16336
|
try {
|
|
16190
16337
|
console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
|
|
16191
16338
|
} catch {
|
|
@@ -16473,7 +16620,7 @@ class PixldocsRenderer {
|
|
|
16473
16620
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16474
16621
|
}
|
|
16475
16622
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16476
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
16623
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BU855BbG.cjs"));
|
|
16477
16624
|
const prepared = preparePagesForExport(
|
|
16478
16625
|
cloned.pages,
|
|
16479
16626
|
canvasWidth,
|
|
@@ -18575,7 +18722,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18575
18722
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18576
18723
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18577
18724
|
try {
|
|
18578
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
18725
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BU855BbG.cjs"));
|
|
18579
18726
|
try {
|
|
18580
18727
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
18581
18728
|
} catch {
|
|
@@ -18974,4 +19121,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
18974
19121
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
18975
19122
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
18976
19123
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
18977
|
-
//# sourceMappingURL=index-
|
|
19124
|
+
//# sourceMappingURL=index-Bg1FRZ3d.cjs.map
|