@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.cjs
CHANGED
|
@@ -4804,9 +4804,17 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
4804
4804
|
const PD_BG_KEY = "__pdBg";
|
|
4805
4805
|
const PATCHED_KEY = "__pdBgPatched";
|
|
4806
4806
|
function extractTextBgConfig(element) {
|
|
4807
|
+
const legacy = Math.max(0, Number(element.textBgPadding ?? 0)) || 0;
|
|
4808
|
+
const pick = (v) => {
|
|
4809
|
+
const n = Number(v);
|
|
4810
|
+
return Number.isFinite(n) && n >= 0 ? n : void 0;
|
|
4811
|
+
};
|
|
4807
4812
|
return {
|
|
4808
4813
|
color: element.textBgColor,
|
|
4809
|
-
|
|
4814
|
+
padTop: pick(element.textBgPaddingTop) ?? legacy,
|
|
4815
|
+
padRight: pick(element.textBgPaddingRight) ?? legacy,
|
|
4816
|
+
padBottom: pick(element.textBgPaddingBottom) ?? legacy,
|
|
4817
|
+
padLeft: pick(element.textBgPaddingLeft) ?? legacy,
|
|
4810
4818
|
rxTL: Math.max(0, Number(element.textBgRxTL ?? 0)) || 0,
|
|
4811
4819
|
rxTR: Math.max(0, Number(element.textBgRxTR ?? 0)) || 0,
|
|
4812
4820
|
rxBR: Math.max(0, Number(element.textBgRxBR ?? 0)) || 0,
|
|
@@ -4824,9 +4832,8 @@ function buildTextShadow(element) {
|
|
|
4824
4832
|
const ox = Number(element.textShadowOffsetX ?? 0);
|
|
4825
4833
|
const oy = Number(element.textShadowOffsetY ?? 0);
|
|
4826
4834
|
if (!color || color === "transparent") return null;
|
|
4827
|
-
if (blur === 0 && ox === 0 && oy === 0) return null;
|
|
4828
4835
|
return new fabric__namespace.Shadow({
|
|
4829
|
-
color,
|
|
4836
|
+
color: String(color),
|
|
4830
4837
|
blur: blur || 0,
|
|
4831
4838
|
offsetX: ox || 0,
|
|
4832
4839
|
offsetY: oy || 0,
|
|
@@ -4863,11 +4870,14 @@ function applyTextBackground(obj, cfg) {
|
|
|
4863
4870
|
if (hasTextBackground(bg)) {
|
|
4864
4871
|
const w = this.width ?? 0;
|
|
4865
4872
|
const h = this.height ?? 0;
|
|
4866
|
-
const
|
|
4867
|
-
const
|
|
4868
|
-
const
|
|
4869
|
-
const
|
|
4870
|
-
const
|
|
4873
|
+
const pT = Math.max(0, Number(bg.padTop ?? 0));
|
|
4874
|
+
const pR = Math.max(0, Number(bg.padRight ?? 0));
|
|
4875
|
+
const pB = Math.max(0, Number(bg.padBottom ?? 0));
|
|
4876
|
+
const pL = Math.max(0, Number(bg.padLeft ?? 0));
|
|
4877
|
+
const x = -w / 2 - pL;
|
|
4878
|
+
const y = -h / 2 - pT;
|
|
4879
|
+
const bgW = w + pL + pR;
|
|
4880
|
+
const bgH = h + pT + pB;
|
|
4871
4881
|
ctx.save();
|
|
4872
4882
|
buildRoundedRectPath2D(
|
|
4873
4883
|
ctx,
|
|
@@ -4903,11 +4913,14 @@ function applyTextBackground(obj, cfg) {
|
|
|
4903
4913
|
if (!hasTextBackground(bg)) return svg;
|
|
4904
4914
|
const w = this.width ?? 0;
|
|
4905
4915
|
const h = this.height ?? 0;
|
|
4906
|
-
const
|
|
4907
|
-
const
|
|
4908
|
-
const
|
|
4909
|
-
const
|
|
4910
|
-
const
|
|
4916
|
+
const pT = Math.max(0, Number(bg.padTop ?? 0));
|
|
4917
|
+
const pR = Math.max(0, Number(bg.padRight ?? 0));
|
|
4918
|
+
const pB = Math.max(0, Number(bg.padBottom ?? 0));
|
|
4919
|
+
const pL = Math.max(0, Number(bg.padLeft ?? 0));
|
|
4920
|
+
const x = -w / 2 - pL;
|
|
4921
|
+
const y = -h / 2 - pT;
|
|
4922
|
+
const bgW = w + pL + pR;
|
|
4923
|
+
const bgH = h + pT + pB;
|
|
4911
4924
|
const d = buildRoundedRectPathD(
|
|
4912
4925
|
x,
|
|
4913
4926
|
y,
|
|
@@ -7871,6 +7884,10 @@ const PageCanvas = react.forwardRef(
|
|
|
7871
7884
|
JSON.stringify({
|
|
7872
7885
|
c: element.textBgColor ?? null,
|
|
7873
7886
|
p: element.textBgPadding ?? 0,
|
|
7887
|
+
pt: element.textBgPaddingTop ?? null,
|
|
7888
|
+
pr: element.textBgPaddingRight ?? null,
|
|
7889
|
+
pb: element.textBgPaddingBottom ?? null,
|
|
7890
|
+
pl: element.textBgPaddingLeft ?? null,
|
|
7874
7891
|
tl: element.textBgRxTL ?? 0,
|
|
7875
7892
|
tr: element.textBgRxTR ?? 0,
|
|
7876
7893
|
br: element.textBgRxBR ?? 0,
|
|
@@ -8314,7 +8331,7 @@ const PageCanvas = react.forwardRef(
|
|
|
8314
8331
|
});
|
|
8315
8332
|
}, [selectedIds, isActive, ready, elements]);
|
|
8316
8333
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
8317
|
-
var _a, _b;
|
|
8334
|
+
var _a, _b, _c;
|
|
8318
8335
|
const fc = fabricRef.current;
|
|
8319
8336
|
if (fc && isTransforming(fc)) {
|
|
8320
8337
|
return;
|
|
@@ -8778,9 +8795,20 @@ const PageCanvas = react.forwardRef(
|
|
|
8778
8795
|
applyTextBackground(obj, extractTextBgConfig(element));
|
|
8779
8796
|
const shadow = buildTextShadow(element);
|
|
8780
8797
|
obj.set("shadow", shadow ?? null);
|
|
8798
|
+
try {
|
|
8799
|
+
obj._cacheCanvas = null;
|
|
8800
|
+
obj._cacheContext = null;
|
|
8801
|
+
} catch {
|
|
8802
|
+
}
|
|
8803
|
+
obj.dirty = true;
|
|
8804
|
+
(_c = obj.setCoords) == null ? void 0 : _c.call(obj);
|
|
8781
8805
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
8782
8806
|
c: element.textBgColor ?? null,
|
|
8783
8807
|
p: element.textBgPadding ?? 0,
|
|
8808
|
+
pt: element.textBgPaddingTop ?? null,
|
|
8809
|
+
pr: element.textBgPaddingRight ?? null,
|
|
8810
|
+
pb: element.textBgPaddingBottom ?? null,
|
|
8811
|
+
pl: element.textBgPaddingLeft ?? null,
|
|
8784
8812
|
tl: element.textBgRxTL ?? 0,
|
|
8785
8813
|
tr: element.textBgRxTR ?? 0,
|
|
8786
8814
|
br: element.textBgRxBR ?? 0,
|
|
@@ -12258,7 +12286,7 @@ function PixldocsPreview(props) {
|
|
|
12258
12286
|
!canvasSettled && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12259
12287
|
] });
|
|
12260
12288
|
}
|
|
12261
|
-
const PACKAGE_VERSION = "0.5.
|
|
12289
|
+
const PACKAGE_VERSION = "0.5.43";
|
|
12262
12290
|
let __underlineFixInstalled = false;
|
|
12263
12291
|
function installUnderlineFix(fab) {
|
|
12264
12292
|
var _a;
|