@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
|
@@ -330,11 +330,12 @@ function getCacheKey(element) {
|
|
|
330
330
|
scaleY: element.scaleY,
|
|
331
331
|
splitByGrapheme: element.splitByGrapheme,
|
|
332
332
|
overflowPolicy: element.overflowPolicy,
|
|
333
|
-
height: element.overflowPolicy === "auto-shrink" ? element.height : void 0
|
|
333
|
+
height: element.overflowPolicy === "auto-shrink" ? element.height : void 0,
|
|
334
|
+
minBoxHeight: element.minBoxHeight,
|
|
335
|
+
verticalAlign: element.verticalAlign
|
|
334
336
|
});
|
|
335
337
|
}
|
|
336
338
|
function measureTextHeight(element) {
|
|
337
|
-
var _a;
|
|
338
339
|
if (element.type !== "text") {
|
|
339
340
|
return element.height || 20;
|
|
340
341
|
}
|
|
@@ -350,8 +351,8 @@ function measureTextHeight(element) {
|
|
|
350
351
|
let fontSize = element.fontSize || 16;
|
|
351
352
|
const overflowPolicy = element.overflowPolicy || "grow-and-push";
|
|
352
353
|
if (overflowPolicy === "auto-shrink") {
|
|
353
|
-
const
|
|
354
|
-
const
|
|
354
|
+
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
355
|
+
const baseHeight = typeof element.height === "number" ? Math.max(element.height, minBoxH) : minBoxH > 0 ? minBoxH : element.height;
|
|
355
356
|
while (fontSize > 1) {
|
|
356
357
|
const testTb = new fabric.Textbox(textToMeasure, {
|
|
357
358
|
width: measureWidth,
|
|
@@ -365,11 +366,9 @@ function measureTextHeight(element) {
|
|
|
365
366
|
});
|
|
366
367
|
testTb.initDimensions();
|
|
367
368
|
const textHeight = testTb.height || 0;
|
|
368
|
-
const renderedLineCount = ((_a = testTb.textLines) == null ? void 0 : _a.length) || 1;
|
|
369
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
370
369
|
const fitsHeight = !baseHeight || textHeight <= baseHeight;
|
|
371
370
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTb, measureWidth);
|
|
372
|
-
if (
|
|
371
|
+
if (fitsHeight && fitsWidth) break;
|
|
373
372
|
fontSize--;
|
|
374
373
|
}
|
|
375
374
|
const finalTb = new fabric.Textbox(textToMeasure, {
|
|
@@ -384,7 +383,7 @@ function measureTextHeight(element) {
|
|
|
384
383
|
});
|
|
385
384
|
finalTb.initDimensions();
|
|
386
385
|
const measuredH = (finalTb.height || element.height || 20) * (element.scaleY || 1);
|
|
387
|
-
const cappedH = typeof baseHeight === "number" ? Math.
|
|
386
|
+
const cappedH = typeof baseHeight === "number" ? Math.max(baseHeight * (element.scaleY || 1), measuredH) : measuredH;
|
|
388
387
|
heightCache.set(cacheKey, { height: cappedH, timestamp: Date.now() });
|
|
389
388
|
return cappedH;
|
|
390
389
|
}
|
|
@@ -5532,6 +5531,54 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
5532
5531
|
return true;
|
|
5533
5532
|
});
|
|
5534
5533
|
}
|
|
5534
|
+
const TextboxProto = fabric.Textbox.prototype;
|
|
5535
|
+
if (!TextboxProto.__pixldocsOrigCalcTextHeight) {
|
|
5536
|
+
TextboxProto.__pixldocsOrigCalcTextHeight = TextboxProto.calcTextHeight;
|
|
5537
|
+
TextboxProto.calcTextHeight = function() {
|
|
5538
|
+
const orig = TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5539
|
+
this._contentHeight = orig;
|
|
5540
|
+
const min = this.minBoxHeight || 0;
|
|
5541
|
+
return min > orig ? min : orig;
|
|
5542
|
+
};
|
|
5543
|
+
}
|
|
5544
|
+
if (!TextboxProto.__pixldocsOrigGetTopOffset) {
|
|
5545
|
+
TextboxProto.__pixldocsOrigGetTopOffset = TextboxProto._getTopOffset;
|
|
5546
|
+
TextboxProto._getTopOffset = function() {
|
|
5547
|
+
const baseOffset = TextboxProto.__pixldocsOrigGetTopOffset.call(this);
|
|
5548
|
+
const valign = this.verticalAlign || "top";
|
|
5549
|
+
if (valign === "top") return baseOffset;
|
|
5550
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5551
|
+
const padding = (this.height || 0) - content;
|
|
5552
|
+
if (padding <= 0) return baseOffset;
|
|
5553
|
+
if (valign === "middle") return baseOffset + padding / 2;
|
|
5554
|
+
if (valign === "bottom") return baseOffset + padding;
|
|
5555
|
+
return baseOffset;
|
|
5556
|
+
};
|
|
5557
|
+
}
|
|
5558
|
+
if (TextboxProto._getSVGLeftTopOffsets && !TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets) {
|
|
5559
|
+
TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets = TextboxProto._getSVGLeftTopOffsets;
|
|
5560
|
+
TextboxProto._getSVGLeftTopOffsets = function() {
|
|
5561
|
+
const base = TextboxProto.__pixldocsOrigGetSVGLeftTopOffsets.call(this);
|
|
5562
|
+
const valign = this.verticalAlign || "top";
|
|
5563
|
+
if (valign === "top") return base;
|
|
5564
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto.__pixldocsOrigCalcTextHeight.call(this);
|
|
5565
|
+
const padding = (this.height || 0) - content;
|
|
5566
|
+
if (padding <= 0) return base;
|
|
5567
|
+
const extra = valign === "middle" ? padding / 2 : padding;
|
|
5568
|
+
return { ...base, textTop: base.textTop + extra };
|
|
5569
|
+
};
|
|
5570
|
+
}
|
|
5571
|
+
const stateProps = fabric.Textbox.prototype.stateProperties;
|
|
5572
|
+
if (Array.isArray(stateProps)) {
|
|
5573
|
+
if (!stateProps.includes("minBoxHeight")) stateProps.push("minBoxHeight");
|
|
5574
|
+
if (!stateProps.includes("verticalAlign")) stateProps.push("verticalAlign");
|
|
5575
|
+
}
|
|
5576
|
+
const cacheProps = fabric.Textbox.prototype.cacheProperties;
|
|
5577
|
+
if (Array.isArray(cacheProps)) {
|
|
5578
|
+
if (!cacheProps.includes("minBoxHeight")) cacheProps.push("minBoxHeight");
|
|
5579
|
+
if (!cacheProps.includes("verticalAlign")) cacheProps.push("verticalAlign");
|
|
5580
|
+
}
|
|
5581
|
+
TextboxProto.__pixldocsTextboxExtended = true;
|
|
5535
5582
|
const PD_BG_KEY = "__pdBg";
|
|
5536
5583
|
const PATCHED_KEY = "__pdBgPatched";
|
|
5537
5584
|
function extractTextBgConfig(element) {
|
|
@@ -6309,6 +6356,8 @@ function createText(element) {
|
|
|
6309
6356
|
const fixedWidth = Math.max(baseWidth, 1);
|
|
6310
6357
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
6311
6358
|
if (overflowPolicy === "auto-shrink") {
|
|
6359
|
+
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
6360
|
+
const heightBound = Math.max(baseHeight || 0, minBoxHForShrink);
|
|
6312
6361
|
const explicitLineCount = Math.max(1, text.split("\n").length);
|
|
6313
6362
|
const debugAutoShrink = typeof window !== "undefined" && window.__pixldocsDebugAutoShrink === true;
|
|
6314
6363
|
const startFontSize = fontSize;
|
|
@@ -6331,7 +6380,7 @@ function createText(element) {
|
|
|
6331
6380
|
const textHeight = testTextbox.height || 0;
|
|
6332
6381
|
const renderedLineCount = ((_a = testTextbox.textLines) == null ? void 0 : _a.length) || 1;
|
|
6333
6382
|
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
6334
|
-
const fitsHeight =
|
|
6383
|
+
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
6335
6384
|
const widthMetrics = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
6336
6385
|
const { maxLineWidth, widthDidGrow, fitsWidth } = widthMetrics;
|
|
6337
6386
|
if (debugAutoShrink) {
|
|
@@ -6351,7 +6400,7 @@ function createText(element) {
|
|
|
6351
6400
|
iterationSamples.push(lastIter);
|
|
6352
6401
|
}
|
|
6353
6402
|
}
|
|
6354
|
-
if (
|
|
6403
|
+
if (fitsHeight && fitsWidth) {
|
|
6355
6404
|
breakReason = "fits";
|
|
6356
6405
|
break;
|
|
6357
6406
|
}
|
|
@@ -6444,7 +6493,15 @@ function createText(element) {
|
|
|
6444
6493
|
// formatting tokens (**, __, [c=...], etc). Disable inline edit and steer
|
|
6445
6494
|
// users to the right-panel text field which exposes the raw markdown.
|
|
6446
6495
|
editable: !formattingEnabled,
|
|
6447
|
-
...formattingEnabled ? { styles: parsedStyles } : element.styles ? { styles: element.styles } : {}
|
|
6496
|
+
...formattingEnabled ? { styles: parsedStyles } : element.styles ? { styles: element.styles } : {},
|
|
6497
|
+
// Vertical sizing extensions (see fabricTextboxExtensions.ts). Apply for
|
|
6498
|
+
// every overflow policy — in auto-shrink mode `minBoxHeight` acts as a
|
|
6499
|
+
// visual floor so the box renders at the user's chosen height even after
|
|
6500
|
+
// the font shrinks to fit. PageCanvas's auto-shrink loop already uses the
|
|
6501
|
+
// same value as a fit-target, so the rendered box and the shrink target
|
|
6502
|
+
// stay in sync (parity with the Use page / EC2 renderer).
|
|
6503
|
+
...(element.minBoxHeight ?? 0) > 0 ? { minBoxHeight: element.minBoxHeight } : {},
|
|
6504
|
+
verticalAlign: element.verticalAlign || "top"
|
|
6448
6505
|
});
|
|
6449
6506
|
textbox.__formattingEnabled = formattingEnabled;
|
|
6450
6507
|
textbox.initDimensions();
|
|
@@ -8039,6 +8096,22 @@ const PageCanvas = forwardRef(
|
|
|
8039
8096
|
obj.dirty = true;
|
|
8040
8097
|
}
|
|
8041
8098
|
}
|
|
8099
|
+
if (obj instanceof fabric.Textbox) {
|
|
8100
|
+
const sy = obj.scaleY ?? 1;
|
|
8101
|
+
if (Math.abs(sy - 1) > 1e-3) {
|
|
8102
|
+
const center = obj.getCenterPoint();
|
|
8103
|
+
const newMinH = Math.max(0, (obj.height ?? 0) * Math.abs(sy));
|
|
8104
|
+
obj.minBoxHeight = newMinH;
|
|
8105
|
+
obj.scaleY = 1;
|
|
8106
|
+
try {
|
|
8107
|
+
obj.initDimensions();
|
|
8108
|
+
} catch {
|
|
8109
|
+
}
|
|
8110
|
+
obj.setPositionByOrigin(center, "center", "center");
|
|
8111
|
+
obj.setCoords();
|
|
8112
|
+
obj.dirty = true;
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8042
8115
|
if (obj.__lockScaleDuringCrop || obj.__cropDrag) {
|
|
8043
8116
|
obj.set({ scaleX: 1, scaleY: 1 });
|
|
8044
8117
|
obj.setCoords();
|
|
@@ -8615,6 +8688,12 @@ const PageCanvas = forwardRef(
|
|
|
8615
8688
|
scaleY: finalScaleY,
|
|
8616
8689
|
transformMatrix: finalAbsoluteMatrix
|
|
8617
8690
|
};
|
|
8691
|
+
if (obj instanceof fabric.Textbox) {
|
|
8692
|
+
const baked = obj.minBoxHeight;
|
|
8693
|
+
if (typeof baked === "number" && baked > 0) {
|
|
8694
|
+
elementUpdate.minBoxHeight = baked;
|
|
8695
|
+
}
|
|
8696
|
+
}
|
|
8618
8697
|
if (sourceElement && sourceElement.opacity !== void 0) {
|
|
8619
8698
|
elementUpdate.opacity = sourceElement.opacity;
|
|
8620
8699
|
}
|
|
@@ -9326,7 +9405,9 @@ const PageCanvas = forwardRef(
|
|
|
9326
9405
|
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 };
|
|
9327
9406
|
const fabricText = existingObj.text ?? "";
|
|
9328
9407
|
const storeText = element.text ?? "";
|
|
9329
|
-
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 ?? "") || //
|
|
9408
|
+
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
|
|
9409
|
+
// so _getTopOffset (verticalAlign) and calcTextHeight (minBoxHeight) repaint correctly.
|
|
9410
|
+
(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.
|
|
9330
9411
|
JSON.stringify({
|
|
9331
9412
|
c: element.textBgColor ?? null,
|
|
9332
9413
|
p: element.textBgPadding ?? 0,
|
|
@@ -9781,7 +9862,7 @@ const PageCanvas = forwardRef(
|
|
|
9781
9862
|
});
|
|
9782
9863
|
}, [selectedIds, isActive, ready, elements]);
|
|
9783
9864
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
9784
|
-
var _a, _b
|
|
9865
|
+
var _a, _b;
|
|
9785
9866
|
const fc = fabricRef.current;
|
|
9786
9867
|
if (fc && isTransforming(fc)) {
|
|
9787
9868
|
return;
|
|
@@ -10150,7 +10231,8 @@ const PageCanvas = forwardRef(
|
|
|
10150
10231
|
const fixedWidth = Math.max(storedWidth, 1);
|
|
10151
10232
|
const splitByGrapheme = overflowPolicy === "auto-shrink" ? false : element.splitByGrapheme ?? element.wordWrap === "break-word";
|
|
10152
10233
|
if (overflowPolicy === "auto-shrink") {
|
|
10153
|
-
const
|
|
10234
|
+
const minBoxHForShrink = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
10235
|
+
const heightBound = Math.max(rH || 0, minBoxHForShrink);
|
|
10154
10236
|
while (fontSize > 1) {
|
|
10155
10237
|
const testTextbox = new fabric.Textbox(text, {
|
|
10156
10238
|
width: fixedWidth,
|
|
@@ -10160,15 +10242,13 @@ const PageCanvas = forwardRef(
|
|
|
10160
10242
|
fontStyle: element.fontStyle || "normal",
|
|
10161
10243
|
lineHeight: element.lineHeight || 1.2,
|
|
10162
10244
|
charSpacing: element.charSpacing || 0,
|
|
10163
|
-
splitByGrapheme: false
|
|
10245
|
+
splitByGrapheme: element.splitByGrapheme ?? false
|
|
10164
10246
|
});
|
|
10165
10247
|
testTextbox.initDimensions();
|
|
10166
10248
|
const textHeight = testTextbox.height || 0;
|
|
10167
|
-
const
|
|
10168
|
-
const hasNoImplicitWrap = renderedLineCount <= explicitLineCount;
|
|
10169
|
-
const fitsHeight = rH <= 0 || textHeight <= rH;
|
|
10249
|
+
const fitsHeight = heightBound <= 0 || textHeight <= heightBound;
|
|
10170
10250
|
const { fitsWidth } = getTextboxWidthFitMetrics(testTextbox, fixedWidth);
|
|
10171
|
-
if (
|
|
10251
|
+
if (fitsHeight && fitsWidth) {
|
|
10172
10252
|
break;
|
|
10173
10253
|
}
|
|
10174
10254
|
fontSize--;
|
|
@@ -10239,6 +10319,10 @@ const PageCanvas = forwardRef(
|
|
|
10239
10319
|
splitByGrapheme,
|
|
10240
10320
|
text
|
|
10241
10321
|
});
|
|
10322
|
+
const valign = element.verticalAlign || "top";
|
|
10323
|
+
const minBoxH = Math.max(0, Number(element.minBoxHeight) || 0);
|
|
10324
|
+
obj.verticalAlign = valign;
|
|
10325
|
+
obj.minBoxHeight = minBoxH;
|
|
10242
10326
|
if (element.formattingEnabled === true) {
|
|
10243
10327
|
obj.styles = parsedStyles || {};
|
|
10244
10328
|
} else {
|
|
@@ -10261,7 +10345,7 @@ const PageCanvas = forwardRef(
|
|
|
10261
10345
|
} catch {
|
|
10262
10346
|
}
|
|
10263
10347
|
obj.dirty = true;
|
|
10264
|
-
(
|
|
10348
|
+
(_b = obj.setCoords) == null ? void 0 : _b.call(obj);
|
|
10265
10349
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
10266
10350
|
c: element.textBgColor ?? null,
|
|
10267
10351
|
p: element.textBgPadding ?? 0,
|
|
@@ -16018,9 +16102,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
16018
16102
|
}
|
|
16019
16103
|
return svgString;
|
|
16020
16104
|
}
|
|
16021
|
-
const resolvedPackageVersion = "0.5.
|
|
16105
|
+
const resolvedPackageVersion = "0.5.169";
|
|
16022
16106
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
16023
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
16107
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.169";
|
|
16024
16108
|
const roundParityValue = (value) => {
|
|
16025
16109
|
if (typeof value !== "number") return value;
|
|
16026
16110
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -16146,6 +16230,68 @@ function installUnderlineFix(fab) {
|
|
|
16146
16230
|
__underlineFixInstalled = true;
|
|
16147
16231
|
console.log(`[canvas-renderer] underline-fix monkey patch installed (v${PACKAGE_VERSION})`);
|
|
16148
16232
|
}
|
|
16233
|
+
let __textboxBoxExtensionsInstalled = false;
|
|
16234
|
+
function installTextboxBoxExtensions(fab) {
|
|
16235
|
+
var _a;
|
|
16236
|
+
if (__textboxBoxExtensionsInstalled) return;
|
|
16237
|
+
const TextboxProto2 = (_a = fab.Textbox) == null ? void 0 : _a.prototype;
|
|
16238
|
+
if (!TextboxProto2) return;
|
|
16239
|
+
if (TextboxProto2.__pixldocsTextboxExtended) {
|
|
16240
|
+
__textboxBoxExtensionsInstalled = true;
|
|
16241
|
+
return;
|
|
16242
|
+
}
|
|
16243
|
+
if (typeof TextboxProto2.calcTextHeight === "function") {
|
|
16244
|
+
const origCalc = TextboxProto2.calcTextHeight;
|
|
16245
|
+
TextboxProto2.__pixldocsOrigCalcTextHeight = origCalc;
|
|
16246
|
+
TextboxProto2.calcTextHeight = function() {
|
|
16247
|
+
const orig = origCalc.call(this);
|
|
16248
|
+
this._contentHeight = orig;
|
|
16249
|
+
const min = this.minBoxHeight || 0;
|
|
16250
|
+
return min > orig ? min : orig;
|
|
16251
|
+
};
|
|
16252
|
+
}
|
|
16253
|
+
if (typeof TextboxProto2._getTopOffset === "function") {
|
|
16254
|
+
const origTop = TextboxProto2._getTopOffset;
|
|
16255
|
+
TextboxProto2.__pixldocsOrigGetTopOffset = origTop;
|
|
16256
|
+
TextboxProto2._getTopOffset = function() {
|
|
16257
|
+
const baseOffset = origTop.call(this);
|
|
16258
|
+
const valign = this.verticalAlign || "top";
|
|
16259
|
+
if (valign === "top") return baseOffset;
|
|
16260
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto2.__pixldocsOrigCalcTextHeight ? TextboxProto2.__pixldocsOrigCalcTextHeight.call(this) : 0;
|
|
16261
|
+
const padding = (this.height || 0) - content;
|
|
16262
|
+
if (padding <= 0) return baseOffset;
|
|
16263
|
+
if (valign === "middle") return baseOffset + padding / 2;
|
|
16264
|
+
if (valign === "bottom") return baseOffset + padding;
|
|
16265
|
+
return baseOffset;
|
|
16266
|
+
};
|
|
16267
|
+
}
|
|
16268
|
+
if (typeof TextboxProto2._getSVGLeftTopOffsets === "function") {
|
|
16269
|
+
const origSvgOffsets = TextboxProto2._getSVGLeftTopOffsets;
|
|
16270
|
+
TextboxProto2.__pixldocsOrigGetSVGLeftTopOffsets = origSvgOffsets;
|
|
16271
|
+
TextboxProto2._getSVGLeftTopOffsets = function() {
|
|
16272
|
+
const base = origSvgOffsets.call(this);
|
|
16273
|
+
const valign = this.verticalAlign || "top";
|
|
16274
|
+
if (valign === "top") return base;
|
|
16275
|
+
const content = typeof this._contentHeight === "number" ? this._contentHeight : TextboxProto2.__pixldocsOrigCalcTextHeight ? TextboxProto2.__pixldocsOrigCalcTextHeight.call(this) : 0;
|
|
16276
|
+
const padding = (this.height || 0) - content;
|
|
16277
|
+
if (padding <= 0) return base;
|
|
16278
|
+
const extra = valign === "middle" ? padding / 2 : padding;
|
|
16279
|
+
return { ...base, textTop: base.textTop + extra };
|
|
16280
|
+
};
|
|
16281
|
+
}
|
|
16282
|
+
const stateProps2 = TextboxProto2.stateProperties;
|
|
16283
|
+
if (Array.isArray(stateProps2)) {
|
|
16284
|
+
if (!stateProps2.includes("minBoxHeight")) stateProps2.push("minBoxHeight");
|
|
16285
|
+
if (!stateProps2.includes("verticalAlign")) stateProps2.push("verticalAlign");
|
|
16286
|
+
}
|
|
16287
|
+
const cacheProps2 = TextboxProto2.cacheProperties;
|
|
16288
|
+
if (Array.isArray(cacheProps2)) {
|
|
16289
|
+
if (!cacheProps2.includes("minBoxHeight")) cacheProps2.push("minBoxHeight");
|
|
16290
|
+
if (!cacheProps2.includes("verticalAlign")) cacheProps2.push("verticalAlign");
|
|
16291
|
+
}
|
|
16292
|
+
TextboxProto2.__pixldocsTextboxExtended = true;
|
|
16293
|
+
__textboxBoxExtensionsInstalled = true;
|
|
16294
|
+
}
|
|
16149
16295
|
function configHasAutoShrinkText(config) {
|
|
16150
16296
|
var _a;
|
|
16151
16297
|
if (!((_a = config == null ? void 0 : config.pages) == null ? void 0 : _a.length)) return false;
|
|
@@ -16168,6 +16314,7 @@ class PixldocsRenderer {
|
|
|
16168
16314
|
this.config = config;
|
|
16169
16315
|
this.installRuntimeGlobals();
|
|
16170
16316
|
installUnderlineFix(fabric);
|
|
16317
|
+
installTextboxBoxExtensions(fabric);
|
|
16171
16318
|
try {
|
|
16172
16319
|
console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
|
|
16173
16320
|
} catch {
|
|
@@ -16455,7 +16602,7 @@ class PixldocsRenderer {
|
|
|
16455
16602
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16456
16603
|
}
|
|
16457
16604
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16458
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
16605
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C2jE125-.js");
|
|
16459
16606
|
const prepared = preparePagesForExport(
|
|
16460
16607
|
cloned.pages,
|
|
16461
16608
|
canvasWidth,
|
|
@@ -18557,7 +18704,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18557
18704
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18558
18705
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18559
18706
|
try {
|
|
18560
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
18707
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C2jE125-.js");
|
|
18561
18708
|
try {
|
|
18562
18709
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
18563
18710
|
} catch {
|
|
@@ -18959,4 +19106,4 @@ export {
|
|
|
18959
19106
|
collectFontDescriptorsFromConfig as y,
|
|
18960
19107
|
collectFontsFromConfig as z
|
|
18961
19108
|
};
|
|
18962
|
-
//# sourceMappingURL=index-
|
|
19109
|
+
//# sourceMappingURL=index-qJRuErt-.js.map
|