@pixldocs/canvas-renderer 0.5.42 → 0.5.43
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.cjs +43 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -221,7 +221,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
|
|
|
221
221
|
* Package version banner. Bump alongside package.json so we can confirm
|
|
222
222
|
* (via browser:log) that the deployed bundle matches the expected build.
|
|
223
223
|
*/
|
|
224
|
-
export declare const PACKAGE_VERSION = "0.5.
|
|
224
|
+
export declare const PACKAGE_VERSION = "0.5.43";
|
|
225
225
|
|
|
226
226
|
export declare interface PageSettings {
|
|
227
227
|
backgroundColor?: string;
|
package/dist/index.js
CHANGED
|
@@ -4785,9 +4785,17 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
4785
4785
|
const PD_BG_KEY = "__pdBg";
|
|
4786
4786
|
const PATCHED_KEY = "__pdBgPatched";
|
|
4787
4787
|
function extractTextBgConfig(element) {
|
|
4788
|
+
const legacy = Math.max(0, Number(element.textBgPadding ?? 0)) || 0;
|
|
4789
|
+
const pick = (v) => {
|
|
4790
|
+
const n = Number(v);
|
|
4791
|
+
return Number.isFinite(n) && n >= 0 ? n : void 0;
|
|
4792
|
+
};
|
|
4788
4793
|
return {
|
|
4789
4794
|
color: element.textBgColor,
|
|
4790
|
-
|
|
4795
|
+
padTop: pick(element.textBgPaddingTop) ?? legacy,
|
|
4796
|
+
padRight: pick(element.textBgPaddingRight) ?? legacy,
|
|
4797
|
+
padBottom: pick(element.textBgPaddingBottom) ?? legacy,
|
|
4798
|
+
padLeft: pick(element.textBgPaddingLeft) ?? legacy,
|
|
4791
4799
|
rxTL: Math.max(0, Number(element.textBgRxTL ?? 0)) || 0,
|
|
4792
4800
|
rxTR: Math.max(0, Number(element.textBgRxTR ?? 0)) || 0,
|
|
4793
4801
|
rxBR: Math.max(0, Number(element.textBgRxBR ?? 0)) || 0,
|
|
@@ -4805,9 +4813,8 @@ function buildTextShadow(element) {
|
|
|
4805
4813
|
const ox = Number(element.textShadowOffsetX ?? 0);
|
|
4806
4814
|
const oy = Number(element.textShadowOffsetY ?? 0);
|
|
4807
4815
|
if (!color || color === "transparent") return null;
|
|
4808
|
-
if (blur === 0 && ox === 0 && oy === 0) return null;
|
|
4809
4816
|
return new fabric.Shadow({
|
|
4810
|
-
color,
|
|
4817
|
+
color: String(color),
|
|
4811
4818
|
blur: blur || 0,
|
|
4812
4819
|
offsetX: ox || 0,
|
|
4813
4820
|
offsetY: oy || 0,
|
|
@@ -4844,11 +4851,14 @@ function applyTextBackground(obj, cfg) {
|
|
|
4844
4851
|
if (hasTextBackground(bg)) {
|
|
4845
4852
|
const w = this.width ?? 0;
|
|
4846
4853
|
const h = this.height ?? 0;
|
|
4847
|
-
const
|
|
4848
|
-
const
|
|
4849
|
-
const
|
|
4850
|
-
const
|
|
4851
|
-
const
|
|
4854
|
+
const pT = Math.max(0, Number(bg.padTop ?? 0));
|
|
4855
|
+
const pR = Math.max(0, Number(bg.padRight ?? 0));
|
|
4856
|
+
const pB = Math.max(0, Number(bg.padBottom ?? 0));
|
|
4857
|
+
const pL = Math.max(0, Number(bg.padLeft ?? 0));
|
|
4858
|
+
const x = -w / 2 - pL;
|
|
4859
|
+
const y = -h / 2 - pT;
|
|
4860
|
+
const bgW = w + pL + pR;
|
|
4861
|
+
const bgH = h + pT + pB;
|
|
4852
4862
|
ctx.save();
|
|
4853
4863
|
buildRoundedRectPath2D(
|
|
4854
4864
|
ctx,
|
|
@@ -4884,11 +4894,14 @@ function applyTextBackground(obj, cfg) {
|
|
|
4884
4894
|
if (!hasTextBackground(bg)) return svg;
|
|
4885
4895
|
const w = this.width ?? 0;
|
|
4886
4896
|
const h = this.height ?? 0;
|
|
4887
|
-
const
|
|
4888
|
-
const
|
|
4889
|
-
const
|
|
4890
|
-
const
|
|
4891
|
-
const
|
|
4897
|
+
const pT = Math.max(0, Number(bg.padTop ?? 0));
|
|
4898
|
+
const pR = Math.max(0, Number(bg.padRight ?? 0));
|
|
4899
|
+
const pB = Math.max(0, Number(bg.padBottom ?? 0));
|
|
4900
|
+
const pL = Math.max(0, Number(bg.padLeft ?? 0));
|
|
4901
|
+
const x = -w / 2 - pL;
|
|
4902
|
+
const y = -h / 2 - pT;
|
|
4903
|
+
const bgW = w + pL + pR;
|
|
4904
|
+
const bgH = h + pT + pB;
|
|
4892
4905
|
const d = buildRoundedRectPathD(
|
|
4893
4906
|
x,
|
|
4894
4907
|
y,
|
|
@@ -7852,6 +7865,10 @@ const PageCanvas = forwardRef(
|
|
|
7852
7865
|
JSON.stringify({
|
|
7853
7866
|
c: element.textBgColor ?? null,
|
|
7854
7867
|
p: element.textBgPadding ?? 0,
|
|
7868
|
+
pt: element.textBgPaddingTop ?? null,
|
|
7869
|
+
pr: element.textBgPaddingRight ?? null,
|
|
7870
|
+
pb: element.textBgPaddingBottom ?? null,
|
|
7871
|
+
pl: element.textBgPaddingLeft ?? null,
|
|
7855
7872
|
tl: element.textBgRxTL ?? 0,
|
|
7856
7873
|
tr: element.textBgRxTR ?? 0,
|
|
7857
7874
|
br: element.textBgRxBR ?? 0,
|
|
@@ -8295,7 +8312,7 @@ const PageCanvas = forwardRef(
|
|
|
8295
8312
|
});
|
|
8296
8313
|
}, [selectedIds, isActive, ready, elements]);
|
|
8297
8314
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
8298
|
-
var _a, _b;
|
|
8315
|
+
var _a, _b, _c;
|
|
8299
8316
|
const fc = fabricRef.current;
|
|
8300
8317
|
if (fc && isTransforming(fc)) {
|
|
8301
8318
|
return;
|
|
@@ -8759,9 +8776,20 @@ const PageCanvas = forwardRef(
|
|
|
8759
8776
|
applyTextBackground(obj, extractTextBgConfig(element));
|
|
8760
8777
|
const shadow = buildTextShadow(element);
|
|
8761
8778
|
obj.set("shadow", shadow ?? null);
|
|
8779
|
+
try {
|
|
8780
|
+
obj._cacheCanvas = null;
|
|
8781
|
+
obj._cacheContext = null;
|
|
8782
|
+
} catch {
|
|
8783
|
+
}
|
|
8784
|
+
obj.dirty = true;
|
|
8785
|
+
(_c = obj.setCoords) == null ? void 0 : _c.call(obj);
|
|
8762
8786
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
8763
8787
|
c: element.textBgColor ?? null,
|
|
8764
8788
|
p: element.textBgPadding ?? 0,
|
|
8789
|
+
pt: element.textBgPaddingTop ?? null,
|
|
8790
|
+
pr: element.textBgPaddingRight ?? null,
|
|
8791
|
+
pb: element.textBgPaddingBottom ?? null,
|
|
8792
|
+
pl: element.textBgPaddingLeft ?? null,
|
|
8765
8793
|
tl: element.textBgRxTL ?? 0,
|
|
8766
8794
|
tr: element.textBgRxTR ?? 0,
|
|
8767
8795
|
br: element.textBgRxBR ?? 0,
|
|
@@ -12239,7 +12267,7 @@ function PixldocsPreview(props) {
|
|
|
12239
12267
|
!canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12240
12268
|
] });
|
|
12241
12269
|
}
|
|
12242
|
-
const PACKAGE_VERSION = "0.5.
|
|
12270
|
+
const PACKAGE_VERSION = "0.5.43";
|
|
12243
12271
|
let __underlineFixInstalled = false;
|
|
12244
12272
|
function installUnderlineFix(fab) {
|
|
12245
12273
|
var _a;
|