@pixerate/editor 0.140.2 → 0.140.4
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/animation-editor/index.cjs +55 -55
- package/dist/animation-editor/index.js +2 -2
- package/dist/{chunk-XGOU44RJ.js → chunk-77SG47WT.js} +80 -9
- package/dist/{chunk-2SHFIVC3.js → chunk-DAS7M4RY.js} +1 -1
- package/dist/{chunk-VSR5A22L.cjs → chunk-H6FX45CP.cjs} +35 -35
- package/dist/{chunk-RCUX6CT2.cjs → chunk-HRI3ZMDM.cjs} +110 -39
- package/dist/{chunk-QKREDTPW.js → chunk-VM6JYWXQ.js} +7 -2
- package/dist/{chunk-V4GUQCDZ.cjs → chunk-XNZWATSB.cjs} +87 -82
- package/dist/image-editor/index.cjs +614 -614
- package/dist/image-editor/index.js +2 -2
- package/dist/image-editor/layers/text.d.cts +1 -1
- package/dist/image-editor/layers/text.d.ts +1 -1
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +945 -945
- package/dist/vector/index.js +2 -2
- package/package.json +1 -1
|
@@ -89,7 +89,7 @@ var _chunkONZJD2ODcjs = require('./chunk-ONZJD2OD.cjs');
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
var
|
|
92
|
+
var _chunkHRI3ZMDMcjs = require('./chunk-HRI3ZMDM.cjs');
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
|
|
@@ -3262,7 +3262,7 @@ function mapAnchor(a, f) {
|
|
|
3262
3262
|
return out;
|
|
3263
3263
|
}
|
|
3264
3264
|
function mapSubpaths(subpaths, f) {
|
|
3265
|
-
return
|
|
3265
|
+
return _chunkHRI3ZMDMcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
3266
3266
|
}
|
|
3267
3267
|
function liveShapeSubpaths(live) {
|
|
3268
3268
|
let out;
|
|
@@ -3270,19 +3270,19 @@ function liveShapeSubpaths(live) {
|
|
|
3270
3270
|
case "rect": {
|
|
3271
3271
|
const x = Math.min(live.x, live.x + live.width);
|
|
3272
3272
|
const y = Math.min(live.y, live.y + live.height);
|
|
3273
|
-
const sp =
|
|
3273
|
+
const sp = _chunkHRI3ZMDMcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
3274
3274
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
3275
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
3275
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkHRI3ZMDMcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
3276
3276
|
break;
|
|
3277
3277
|
}
|
|
3278
3278
|
case "ellipse":
|
|
3279
|
-
out = [
|
|
3279
|
+
out = [_chunkHRI3ZMDMcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
3280
3280
|
break;
|
|
3281
3281
|
case "polygon":
|
|
3282
|
-
out = [
|
|
3282
|
+
out = [_chunkHRI3ZMDMcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
3283
3283
|
break;
|
|
3284
3284
|
case "star":
|
|
3285
|
-
out = [
|
|
3285
|
+
out = [_chunkHRI3ZMDMcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
3286
3286
|
break;
|
|
3287
3287
|
case "line": {
|
|
3288
3288
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -3305,7 +3305,7 @@ function liveShapeSubpaths(live) {
|
|
|
3305
3305
|
}
|
|
3306
3306
|
}
|
|
3307
3307
|
const m = live.transform;
|
|
3308
|
-
return m && !
|
|
3308
|
+
return m && !_chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
3309
3309
|
}
|
|
3310
3310
|
function normBox(b) {
|
|
3311
3311
|
return { x: Math.min(b.x, b.x + b.width), y: Math.min(b.y, b.y + b.height), width: Math.abs(b.width), height: Math.abs(b.height) };
|
|
@@ -3317,7 +3317,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
3317
3317
|
function componentPath(c) {
|
|
3318
3318
|
let p = pathCache.get(c.subpaths);
|
|
3319
3319
|
if (!p) {
|
|
3320
|
-
p =
|
|
3320
|
+
p = _chunkHRI3ZMDMcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
3321
3321
|
pathCache.set(c.subpaths, p);
|
|
3322
3322
|
}
|
|
3323
3323
|
return p;
|
|
@@ -3640,7 +3640,7 @@ function matrixArg(v, path) {
|
|
|
3640
3640
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail2(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
3641
3641
|
const m = v;
|
|
3642
3642
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail2(`${path} is singular.`);
|
|
3643
|
-
return
|
|
3643
|
+
return _chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
3644
3644
|
}
|
|
3645
3645
|
function normalizeLiveShape(v, path = "shape") {
|
|
3646
3646
|
if (!v || typeof v !== "object") return fail2(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -3701,7 +3701,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
3701
3701
|
if (typeof v === "string") {
|
|
3702
3702
|
let subs;
|
|
3703
3703
|
try {
|
|
3704
|
-
subs =
|
|
3704
|
+
subs = _chunkHRI3ZMDMcjs.bezierToSubpaths.call(void 0, v);
|
|
3705
3705
|
} catch (e5) {
|
|
3706
3706
|
return fail2(`${path}: could not read the SVG path data.`);
|
|
3707
3707
|
}
|
|
@@ -3787,15 +3787,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3787
3787
|
function transformShapeComponents(components, f, affine) {
|
|
3788
3788
|
return components.map((c) => {
|
|
3789
3789
|
if (affine && c.live) {
|
|
3790
|
-
const live = { ...c.live, transform:
|
|
3791
|
-
if (
|
|
3790
|
+
const live = { ...c.live, transform: _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkHRI3ZMDMcjs.IDENTITY_MATRIX)), affine) };
|
|
3791
|
+
if (_chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
3792
3792
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
3793
3793
|
}
|
|
3794
3794
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
3795
3795
|
});
|
|
3796
3796
|
}
|
|
3797
3797
|
function offsetShape(layer, dx, dy, env) {
|
|
3798
|
-
const m =
|
|
3798
|
+
const m = _chunkHRI3ZMDMcjs.translateMatrix.call(void 0, dx, dy);
|
|
3799
3799
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
3800
3800
|
delete next.annotation;
|
|
3801
3801
|
return rerenderShape(next, env);
|
|
@@ -3803,7 +3803,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
3803
3803
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
3804
3804
|
if (components.length < 2) return [...components];
|
|
3805
3805
|
const path = shapeOutline(components, fillRule);
|
|
3806
|
-
const subpaths =
|
|
3806
|
+
const subpaths = _chunkHRI3ZMDMcjs.bezierToSubpaths.call(void 0, path);
|
|
3807
3807
|
if (!subpaths.length) fail2("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
3808
3808
|
return [{ op: "combine", subpaths }];
|
|
3809
3809
|
}
|
|
@@ -3820,7 +3820,7 @@ function annotationPaint(color, opacity) {
|
|
|
3820
3820
|
function shapeFromAnnotation(a) {
|
|
3821
3821
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
3822
3822
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
3823
|
-
const rotation = a.rotation ?
|
|
3823
|
+
const rotation = a.rotation ? _chunkHRI3ZMDMcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
3824
3824
|
const t = rotation ? { transform: rotation } : {};
|
|
3825
3825
|
const live = (l) => liveComponent(l);
|
|
3826
3826
|
switch (a.type) {
|
|
@@ -3863,7 +3863,7 @@ function shapeFromAnnotation(a) {
|
|
|
3863
3863
|
case "pen": {
|
|
3864
3864
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
3865
3865
|
if (!paint) return null;
|
|
3866
|
-
const pts = rotation ? a.points.map((p) =>
|
|
3866
|
+
const pts = rotation ? a.points.map((p) => _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
3867
3867
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
3868
3868
|
return {
|
|
3869
3869
|
components: [{ op: "combine", subpaths }],
|
|
@@ -3896,7 +3896,7 @@ var fail3 = (message) => {
|
|
|
3896
3896
|
};
|
|
3897
3897
|
var TEXT_RENDER_MARGIN = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH;
|
|
3898
3898
|
function textMatrix(layer) {
|
|
3899
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3899
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkHRI3ZMDMcjs.IDENTITY_MATRIX));
|
|
3900
3900
|
}
|
|
3901
3901
|
function rectCorners(r) {
|
|
3902
3902
|
return [
|
|
@@ -3907,7 +3907,7 @@ function rectCorners(r) {
|
|
|
3907
3907
|
];
|
|
3908
3908
|
}
|
|
3909
3909
|
function docRect(r, m) {
|
|
3910
|
-
const pts = rectCorners(r).map((p) =>
|
|
3910
|
+
const pts = rectCorners(r).map((p) => _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, p));
|
|
3911
3911
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3912
3912
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3913
3913
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3940,14 +3940,14 @@ function inkBounds(layout) {
|
|
|
3940
3940
|
}
|
|
3941
3941
|
function textOutlines(layer, shaper) {
|
|
3942
3942
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3943
|
-
const layout =
|
|
3943
|
+
const layout = _chunkHRI3ZMDMcjs.layoutText.call(void 0, layer, shaper);
|
|
3944
3944
|
const m = textMatrix(layer);
|
|
3945
3945
|
const out = [];
|
|
3946
3946
|
for (const l of layout.lines) {
|
|
3947
3947
|
for (const f of l.fragments) {
|
|
3948
|
-
let path =
|
|
3949
|
-
for (const r of
|
|
3950
|
-
out.push({ fragment: f, path:
|
|
3948
|
+
let path = _chunkHRI3ZMDMcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3949
|
+
for (const r of _chunkHRI3ZMDMcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkHRI3ZMDMcjs.textRectPath.call(void 0, r)];
|
|
3950
|
+
out.push({ fragment: f, path: _chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3951
3951
|
}
|
|
3952
3952
|
}
|
|
3953
3953
|
return out;
|
|
@@ -4003,7 +4003,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4003
4003
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4004
4004
|
const ctx = canvas.getContext("2d");
|
|
4005
4005
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4006
|
-
const layout =
|
|
4006
|
+
const layout = _chunkHRI3ZMDMcjs.layoutText.call(void 0, layer, shaper);
|
|
4007
4007
|
const m = textMatrix(layer);
|
|
4008
4008
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4009
4009
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4015,8 +4015,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4015
4015
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4016
4016
|
const s = layer.text.slice(f.start, f.end);
|
|
4017
4017
|
if (!f.spaced) shaper.draw(ctx, s, f.font, f.x, f.y);
|
|
4018
|
-
else for (let k = 0; k < s.length; k++) if (!
|
|
4019
|
-
for (const d of
|
|
4018
|
+
else for (let k = 0; k < s.length; k++) if (!_chunkHRI3ZMDMcjs.isTextSpace.call(void 0, s[k])) shaper.draw(ctx, s[k], f.font, f.x + f.carets[k], f.y);
|
|
4019
|
+
for (const d of _chunkHRI3ZMDMcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4020
4020
|
}
|
|
4021
4021
|
}
|
|
4022
4022
|
ctx.globalAlpha = 1;
|
|
@@ -4027,7 +4027,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4027
4027
|
function renderText(layer, env) {
|
|
4028
4028
|
const shaper = env.shaper;
|
|
4029
4029
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4030
|
-
const layout =
|
|
4030
|
+
const layout = _chunkHRI3ZMDMcjs.layoutText.call(void 0, layer, shaper);
|
|
4031
4031
|
const ink = inkBounds(layout);
|
|
4032
4032
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4033
4033
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4050,13 +4050,18 @@ function num(v, path, min, max) {
|
|
|
4050
4050
|
if (!isNum2(v) || v < min || v > max) fail3(`${path} must be a number from ${min} to ${max}, got ${JSON.stringify(v)}.`);
|
|
4051
4051
|
return v;
|
|
4052
4052
|
}
|
|
4053
|
-
var TEXT_STYLE_FIELDS = ["fontFamily", "fontWeight", "italic", "fontSize", "color", "opacity", "tracking", "leading", "baselineShift", "underline", "strikethrough"];
|
|
4053
|
+
var TEXT_STYLE_FIELDS = ["fontFamily", "fontWeight", "italic", "fontSize", "color", "opacity", "tracking", "leading", "baselineShift", "underline", "strikethrough", "postScriptName"];
|
|
4054
4054
|
function patchTextStyle(base, patch, path = "style") {
|
|
4055
4055
|
const out = { ...base };
|
|
4056
4056
|
const o = out;
|
|
4057
4057
|
for (const [k, v] of Object.entries(patch)) {
|
|
4058
4058
|
if (v === void 0) continue;
|
|
4059
4059
|
switch (k) {
|
|
4060
|
+
case "postScriptName":
|
|
4061
|
+
if (typeof v !== "string" && v !== null) fail3(`${path}.postScriptName must be a PostScript font name.`);
|
|
4062
|
+
if (v) out.postScriptName = v.trim();
|
|
4063
|
+
else delete out.postScriptName;
|
|
4064
|
+
break;
|
|
4060
4065
|
case "fontFamily":
|
|
4061
4066
|
if (typeof v !== "string" || !v.trim()) fail3(`${path}.fontFamily must be a font family name.`);
|
|
4062
4067
|
out.fontFamily = v.trim();
|
|
@@ -4122,7 +4127,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4122
4127
|
continue;
|
|
4123
4128
|
}
|
|
4124
4129
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4125
|
-
if (k === "autoLeading" && value ===
|
|
4130
|
+
if (k === "autoLeading" && value === _chunkHRI3ZMDMcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4126
4131
|
else o[k] = value;
|
|
4127
4132
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4128
4133
|
}
|
|
@@ -4159,14 +4164,14 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4159
4164
|
opacity: 1,
|
|
4160
4165
|
blend: "normal",
|
|
4161
4166
|
text: text3,
|
|
4162
|
-
runs:
|
|
4163
|
-
paragraphs:
|
|
4167
|
+
runs: _chunkHRI3ZMDMcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE),
|
|
4168
|
+
paragraphs: _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4164
4169
|
frame: init.frame,
|
|
4165
4170
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
4166
4171
|
offset: { x: 0, y: 0 }
|
|
4167
4172
|
};
|
|
4168
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _61 => _61.runs, 'access', _62 => _62[0], 'optionalAccess', _63 => _63.style]), () => (
|
|
4169
|
-
if (init.transform && !
|
|
4173
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _61 => _61.runs, 'access', _62 => _62[0], 'optionalAccess', _63 => _63.style]), () => ( _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE)) }];
|
|
4174
|
+
if (init.transform && !_chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4170
4175
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4171
4176
|
return rerenderText(layer, env);
|
|
4172
4177
|
}
|
|
@@ -4176,24 +4181,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4176
4181
|
const patch = change(current);
|
|
4177
4182
|
const next = { ...current, ...patch };
|
|
4178
4183
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4179
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4180
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4181
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4184
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkHRI3ZMDMcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _64 => _64.runs, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.style]), () => ( _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE)));
|
|
4185
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkHRI3ZMDMcjs.styleAt.call(void 0, current.runs, 0, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE) }];
|
|
4186
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4182
4187
|
const rendered = rerenderText(next, env);
|
|
4183
4188
|
return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4184
4189
|
}
|
|
4185
4190
|
function replaceTextRange(layer, start, end, insert) {
|
|
4186
4191
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4187
|
-
const style =
|
|
4188
|
-
const runs =
|
|
4189
|
-
const pstyle =
|
|
4190
|
-
const paragraphs =
|
|
4191
|
-
return { text: text3, runs, paragraphs:
|
|
4192
|
+
const style = _chunkHRI3ZMDMcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE);
|
|
4193
|
+
const runs = _chunkHRI3ZMDMcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4194
|
+
const pstyle = _chunkHRI3ZMDMcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4195
|
+
const paragraphs = _chunkHRI3ZMDMcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4196
|
+
return { text: text3, runs, paragraphs: _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4192
4197
|
}
|
|
4193
4198
|
function transformTypeLayer(layer, m) {
|
|
4194
|
-
const t =
|
|
4199
|
+
const t = _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4195
4200
|
const next = { ...layer };
|
|
4196
|
-
if (
|
|
4201
|
+
if (_chunkHRI3ZMDMcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4197
4202
|
else next.transform = t;
|
|
4198
4203
|
delete next.annotation;
|
|
4199
4204
|
return next;
|
|
@@ -4201,7 +4206,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4201
4206
|
function typeFrame(layer, shaper) {
|
|
4202
4207
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4203
4208
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4204
|
-
const b =
|
|
4209
|
+
const b = _chunkHRI3ZMDMcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4205
4210
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4206
4211
|
}
|
|
4207
4212
|
function typeAsPixelLayer(layer) {
|
|
@@ -4209,7 +4214,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4209
4214
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4210
4215
|
}
|
|
4211
4216
|
function toTextSpace(layer, p) {
|
|
4212
|
-
return
|
|
4217
|
+
return _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, _chunkHRI3ZMDMcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4213
4218
|
}
|
|
4214
4219
|
function typeFromAnnotation(a) {
|
|
4215
4220
|
if (a.type !== "text") return null;
|
|
@@ -4223,7 +4228,7 @@ function typeFromAnnotation(a) {
|
|
|
4223
4228
|
if (op !== 1) style.opacity = op;
|
|
4224
4229
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4225
4230
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4226
|
-
const transform = t.rotation ?
|
|
4231
|
+
const transform = t.rotation ? _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, translate, _chunkHRI3ZMDMcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4227
4232
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4228
4233
|
}
|
|
4229
4234
|
function annotationOfType(layer) {
|
|
@@ -4557,7 +4562,7 @@ function identityTransform(box2) {
|
|
|
4557
4562
|
}
|
|
4558
4563
|
function cornersFromMatrix(box2, m) {
|
|
4559
4564
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4560
|
-
return [
|
|
4565
|
+
return [_chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[0]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[1]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[2]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4561
4566
|
}
|
|
4562
4567
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4563
4568
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4574,7 +4579,7 @@ function transformHomography(geometry) {
|
|
|
4574
4579
|
function hasWarp(geometry) {
|
|
4575
4580
|
const w = geometry.warp;
|
|
4576
4581
|
if (!w) return false;
|
|
4577
|
-
const id =
|
|
4582
|
+
const id = _chunkHRI3ZMDMcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4578
4583
|
if (id.points.length !== w.points.length || id.us.some((u, i) => Math.abs(u - w.us[i]) > 1e-12) || id.vs.some((v, i) => Math.abs(v - w.vs[i]) > 1e-12)) return true;
|
|
4579
4584
|
return w.points.some((p, i) => Math.abs(p.x - id.points[i].x) > 1e-6 || Math.abs(p.y - id.points[i].y) > 1e-6);
|
|
4580
4585
|
}
|
|
@@ -4589,7 +4594,7 @@ function transformMap(geometry) {
|
|
|
4589
4594
|
const { box: box2 } = geometry;
|
|
4590
4595
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4591
4596
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4592
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4597
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkHRI3ZMDMcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4593
4598
|
}
|
|
4594
4599
|
function transformedPoint(geometry, fx, fy) {
|
|
4595
4600
|
const f = transformMap(geometry);
|
|
@@ -4633,8 +4638,8 @@ function matrixFromParams(box2, params) {
|
|
|
4633
4638
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4634
4639
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4635
4640
|
const ref = referencePoint(box2, params.reference);
|
|
4636
|
-
const linear =
|
|
4637
|
-
return
|
|
4641
|
+
const linear = _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkHRI3ZMDMcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4642
|
+
return _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, _chunkHRI3ZMDMcjs.matrixAbout.call(void 0, linear, ref), _chunkHRI3ZMDMcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4638
4643
|
}
|
|
4639
4644
|
function describeTransform(geometry, reference = "center") {
|
|
4640
4645
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4651,7 +4656,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4651
4656
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4652
4657
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4653
4658
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4654
|
-
const at =
|
|
4659
|
+
const at = _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, ref);
|
|
4655
4660
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4656
4661
|
return {
|
|
4657
4662
|
affine: true,
|
|
@@ -4669,24 +4674,24 @@ function applyParams(geometry, params) {
|
|
|
4669
4674
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4670
4675
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4671
4676
|
const c = geometry.corners;
|
|
4672
|
-
return [
|
|
4677
|
+
return [_chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, c[0]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, c[1]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, c[2]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4673
4678
|
}
|
|
4674
4679
|
function flipCorners(geometry, axis) {
|
|
4675
4680
|
const c = anchorPoint(geometry, "center");
|
|
4676
4681
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4677
4682
|
const q2 = geometry.corners;
|
|
4678
|
-
return [
|
|
4683
|
+
return [_chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[0]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[1]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[2]), _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4679
4684
|
}
|
|
4680
4685
|
function boxPointOf(geometry, p) {
|
|
4681
4686
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4682
|
-
if (m) return
|
|
4687
|
+
if (m) return _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, _chunkHRI3ZMDMcjs.invertMatrix.call(void 0, m), p);
|
|
4683
4688
|
return null;
|
|
4684
4689
|
}
|
|
4685
4690
|
function presetWarp(box2, preset) {
|
|
4686
|
-
return
|
|
4691
|
+
return _chunkHRI3ZMDMcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4687
4692
|
}
|
|
4688
4693
|
function isValidWarp(mesh) {
|
|
4689
|
-
return
|
|
4694
|
+
return _chunkHRI3ZMDMcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4690
4695
|
}
|
|
4691
4696
|
function geometryHomography(geometry) {
|
|
4692
4697
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4952,7 +4957,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4952
4957
|
}
|
|
4953
4958
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4954
4959
|
if (raw.warp) {
|
|
4955
|
-
if (!
|
|
4960
|
+
if (!_chunkHRI3ZMDMcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
|
|
4956
4961
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4957
4962
|
}
|
|
4958
4963
|
if (raw.interpolation !== void 0) {
|
|
@@ -5055,7 +5060,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5055
5060
|
case "shape": {
|
|
5056
5061
|
const next = {
|
|
5057
5062
|
...layer,
|
|
5058
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5063
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkHRI3ZMDMcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5059
5064
|
surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5060
5065
|
mask: moveMask(layer.mask)
|
|
5061
5066
|
};
|
|
@@ -5064,7 +5069,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5064
5069
|
return next;
|
|
5065
5070
|
}
|
|
5066
5071
|
case "type": {
|
|
5067
|
-
const next = { ...transformTypeLayer(layer,
|
|
5072
|
+
const next = { ...transformTypeLayer(layer, _chunkHRI3ZMDMcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5068
5073
|
if (!next.mask) delete next.mask;
|
|
5069
5074
|
return next;
|
|
5070
5075
|
}
|
|
@@ -5250,7 +5255,7 @@ function refitPlacement(layer, contents) {
|
|
|
5250
5255
|
});
|
|
5251
5256
|
const out = { corners: pts };
|
|
5252
5257
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5253
|
-
if (layer.placement.warp) out.warp =
|
|
5258
|
+
if (layer.placement.warp) out.warp = _chunkHRI3ZMDMcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5254
5259
|
return out;
|
|
5255
5260
|
}
|
|
5256
5261
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5564,7 +5569,7 @@ function readType(r, base, ctx) {
|
|
|
5564
5569
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5565
5570
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5566
5571
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _139 => _139.length]), 0, 1e9, 0))),
|
|
5567
|
-
style: patchTextStyle(
|
|
5572
|
+
style: patchTextStyle(_chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _140 => _140.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5568
5573
|
}));
|
|
5569
5574
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5570
5575
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _141 => _141.length]), 0, 1e9, 0))),
|
|
@@ -5577,13 +5582,13 @@ function readType(r, base, ctx) {
|
|
|
5577
5582
|
...base,
|
|
5578
5583
|
type: "type",
|
|
5579
5584
|
text: text3,
|
|
5580
|
-
runs:
|
|
5581
|
-
paragraphs:
|
|
5585
|
+
runs: _chunkHRI3ZMDMcjs.fitRuns.call(void 0, runs, text3.length, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE),
|
|
5586
|
+
paragraphs: _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5582
5587
|
frame,
|
|
5583
5588
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
5584
5589
|
offset: { x: 0, y: 0 }
|
|
5585
5590
|
};
|
|
5586
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _145 => _145[0], 'optionalAccess', _146 => _146.style]), () => (
|
|
5591
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _145 => _145[0], 'optionalAccess', _146 => _146.style]), () => ( _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5587
5592
|
if (m) layer.transform = m;
|
|
5588
5593
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
5589
5594
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
@@ -6036,7 +6041,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6036
6041
|
let placement;
|
|
6037
6042
|
try {
|
|
6038
6043
|
const raw = { corners: p.corners };
|
|
6039
|
-
if (p.warp &&
|
|
6044
|
+
if (p.warp && _chunkHRI3ZMDMcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6040
6045
|
if (_chunkHGTDMKNEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6041
6046
|
placement = normalizePlacement(raw, contents);
|
|
6042
6047
|
} catch (e) {
|
|
@@ -7019,7 +7024,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7019
7024
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7020
7025
|
const subpaths = [];
|
|
7021
7026
|
components.forEach((c, ci) => {
|
|
7022
|
-
|
|
7027
|
+
_chunkHRI3ZMDMcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7023
7028
|
if (!sp.anchors.length) return;
|
|
7024
7029
|
subpaths.push({
|
|
7025
7030
|
closed: sp.closed,
|
|
@@ -7741,7 +7746,7 @@ function merged(levels) {
|
|
|
7741
7746
|
function charStyle(d, fonts, notes) {
|
|
7742
7747
|
const n = (k) => eNum(eGet(d, k));
|
|
7743
7748
|
const flag = (k) => eBool(eGet(d, k));
|
|
7744
|
-
const s = { ...
|
|
7749
|
+
const s = { ..._chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE };
|
|
7745
7750
|
const fi = n("Font");
|
|
7746
7751
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
7747
7752
|
if (ps) {
|
|
@@ -7824,7 +7829,7 @@ function typeFromTySh(data, notes) {
|
|
|
7824
7829
|
}
|
|
7825
7830
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
7826
7831
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
7827
|
-
let runs = [{ length: text3.length, style: { ...
|
|
7832
|
+
let runs = [{ length: text3.length, style: { ..._chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE } }];
|
|
7828
7833
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
7829
7834
|
let frame = { kind: "point" };
|
|
7830
7835
|
let transform = t.transform;
|
|
@@ -7880,14 +7885,14 @@ function typeFromTySh(data, notes) {
|
|
|
7880
7885
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
7881
7886
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
7882
7887
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
7883
|
-
transform =
|
|
7888
|
+
transform = _chunkHRI3ZMDMcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
7884
7889
|
}
|
|
7885
7890
|
}
|
|
7886
7891
|
}
|
|
7887
7892
|
return {
|
|
7888
7893
|
text: text3,
|
|
7889
|
-
runs:
|
|
7890
|
-
paragraphs:
|
|
7894
|
+
runs: _chunkHRI3ZMDMcjs.fitRuns.call(void 0, runs, text3.length, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE),
|
|
7895
|
+
paragraphs: _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
7891
7896
|
frame,
|
|
7892
7897
|
transform,
|
|
7893
7898
|
antiAlias,
|
|
@@ -7961,7 +7966,7 @@ function buildEngineData(layer, template) {
|
|
|
7961
7966
|
fonts.push(ps);
|
|
7962
7967
|
return fonts.length - 1;
|
|
7963
7968
|
};
|
|
7964
|
-
const runs =
|
|
7969
|
+
const runs = _chunkHRI3ZMDMcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE);
|
|
7965
7970
|
const sruns = [];
|
|
7966
7971
|
const slens = [];
|
|
7967
7972
|
runs.forEach((r, i) => {
|
|
@@ -7969,10 +7974,10 @@ function buildEngineData(layer, template) {
|
|
|
7969
7974
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
7970
7975
|
});
|
|
7971
7976
|
if (!runs.length) {
|
|
7972
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
7977
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
7973
7978
|
slens.push(E.int(1));
|
|
7974
7979
|
}
|
|
7975
|
-
const paras =
|
|
7980
|
+
const paras = _chunkHRI3ZMDMcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
7976
7981
|
const pruns = [];
|
|
7977
7982
|
const plens = [];
|
|
7978
7983
|
paras.forEach((p, i) => {
|
|
@@ -8028,7 +8033,7 @@ function buildEngineData(layer, template) {
|
|
|
8028
8033
|
eSet(e, key, rd);
|
|
8029
8034
|
}
|
|
8030
8035
|
eSet(rd, "FontSet", fontSet);
|
|
8031
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _211 => _211[0], 'optionalAccess', _212 => _212.style]), () => (
|
|
8036
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _211 => _211[0], 'optionalAccess', _212 => _212.style]), () => ( _chunkHRI3ZMDMcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8032
8037
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8033
8038
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8034
8039
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8039,13 +8044,13 @@ function inkBounds2(layer) {
|
|
|
8039
8044
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8040
8045
|
const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
|
|
8041
8046
|
if (!b) return [0, 0, 0, 0];
|
|
8042
|
-
const inv =
|
|
8047
|
+
const inv = _chunkHRI3ZMDMcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8043
8048
|
const pts = [
|
|
8044
8049
|
{ x: b.x, y: b.y },
|
|
8045
8050
|
{ x: b.x + b.width, y: b.y },
|
|
8046
8051
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8047
8052
|
{ x: b.x, y: b.y + b.height }
|
|
8048
|
-
].map((p) =>
|
|
8053
|
+
].map((p) => _chunkHRI3ZMDMcjs.applyMatrix.call(void 0, inv, p));
|
|
8049
8054
|
return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
|
|
8050
8055
|
}
|
|
8051
8056
|
function tyShForLayer(layer) {
|
|
@@ -8512,7 +8517,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8512
8517
|
var warpStyleOf = (name) => {
|
|
8513
8518
|
if (!name.startsWith("warp")) return null;
|
|
8514
8519
|
const s = _optionalChain([name, 'access', _226 => _226[4], 'optionalAccess', _227 => _227.toLowerCase, 'call', _228 => _228()]) + name.slice(5);
|
|
8515
|
-
return
|
|
8520
|
+
return _chunkHRI3ZMDMcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8516
8521
|
};
|
|
8517
8522
|
function warpFromDescriptor(w, contents) {
|
|
8518
8523
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8542,7 +8547,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8542
8547
|
} else {
|
|
8543
8548
|
const style = warpStyleOf(styleName);
|
|
8544
8549
|
if (!style) return void 0;
|
|
8545
|
-
mesh =
|
|
8550
|
+
mesh = _chunkHRI3ZMDMcjs.warpPresetMesh.call(void 0,
|
|
8546
8551
|
{
|
|
8547
8552
|
style,
|
|
8548
8553
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8557,7 +8562,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8557
8562
|
const same = Math.abs(bounds.x) < 1e-6 && Math.abs(bounds.y) < 1e-6 && Math.abs(bounds.width - contents.width) < 1e-6 && Math.abs(bounds.height - contents.height) < 1e-6;
|
|
8558
8563
|
if (!same) {
|
|
8559
8564
|
const m = mesh;
|
|
8560
|
-
mesh =
|
|
8565
|
+
mesh = _chunkHRI3ZMDMcjs.fitWarpMesh.call(void 0, (s, t) => _chunkHRI3ZMDMcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8561
8566
|
}
|
|
8562
8567
|
return { mesh, frame };
|
|
8563
8568
|
}
|
|
@@ -10133,7 +10138,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10133
10138
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10134
10139
|
const kx = contents.width / size.width;
|
|
10135
10140
|
const ky = contents.height / size.height;
|
|
10136
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10141
|
+
if (placement.warp) placement = { ...placement, warp: _chunkHRI3ZMDMcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10137
10142
|
}
|
|
10138
10143
|
}
|
|
10139
10144
|
if (!contents || !placement) {
|