@pixerate/editor 0.238.0 → 0.240.0
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/chunk-KMPM5JM5.js +936 -0
- package/dist/chunk-S6OT6CTS.cjs +936 -0
- package/dist/gradient/index.cjs +102 -812
- package/dist/gradient/index.d.cts +1 -0
- package/dist/gradient/index.d.ts +1 -0
- package/dist/gradient/index.js +85 -795
- package/dist/gradient/sample.d.cts +69 -0
- package/dist/gradient/sample.d.ts +69 -0
- package/dist/image-editor/index.cjs +48 -1
- package/dist/image-editor/index.js +48 -1
- package/dist/paint-editor/controller.d.cts +91 -1
- package/dist/paint-editor/controller.d.ts +91 -1
- package/dist/paint-editor/document.d.cts +7 -2
- package/dist/paint-editor/document.d.ts +7 -2
- package/dist/paint-editor/index.cjs +743 -173
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +608 -38
- package/dist/paint-editor/live-strokes.d.cts +24 -0
- package/dist/paint-editor/live-strokes.d.ts +24 -0
- package/dist/paint-editor/ui.d.cts +24 -4
- package/dist/paint-editor/ui.d.ts +24 -4
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +30 -15
|
@@ -1519,7 +1519,8 @@ function variationAffine(v, origin) {
|
|
|
1519
1519
|
return composeAffine(back, composeAffine(linear, toOrigin));
|
|
1520
1520
|
}
|
|
1521
1521
|
function varyStroke(stroke, m, v) {
|
|
1522
|
-
const
|
|
1522
|
+
const det = Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));
|
|
1523
|
+
const s = Math.abs(det - 1) < 1e-9 ? 1 : det;
|
|
1523
1524
|
const ps = _nullishCoalesce(v.pressureScale, () => ( 1));
|
|
1524
1525
|
const points = stroke.points.map((p) => {
|
|
1525
1526
|
const q = mapPenPoint(m, p);
|
|
@@ -3085,6 +3086,43 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
3085
3086
|
}
|
|
3086
3087
|
}, _class8);
|
|
3087
3088
|
|
|
3089
|
+
// src/paint-editor/live-strokes.ts
|
|
3090
|
+
var LIVE_STROKE_ENGINES = ["dab", "particle", "bristle", "mixer"];
|
|
3091
|
+
function liveStrokeRefusal(brush) {
|
|
3092
|
+
switch (brush.engine) {
|
|
3093
|
+
case "wet":
|
|
3094
|
+
return `The ${brush.name} brush paints wet media, which a stroke layer can't redraw (the paint depends on the simulation's history); paint it on a pixel layer (add_layer).`;
|
|
3095
|
+
case "impasto":
|
|
3096
|
+
return `The ${brush.name} brush paints thick paint with relief, which a stroke layer doesn't keep; paint it on a pixel layer (add_layer).`;
|
|
3097
|
+
case "sticker":
|
|
3098
|
+
return `The ${brush.name} brush sprays stickers, which are their own objects; spray them on an empty pixel layer (add_layer).`;
|
|
3099
|
+
case "eraser":
|
|
3100
|
+
return `Erasers don't paint on a stroke layer; delete strokes instead (remove_strokes), or rasterize the layer first (rasterize_stroke_layer).`;
|
|
3101
|
+
case "blender":
|
|
3102
|
+
case "smudge":
|
|
3103
|
+
return `The ${brush.name} brush moves the paint under it, so it can't be redrawn on its own; rasterize the layer first (rasterize_stroke_layer) or blend on a pixel layer.`;
|
|
3104
|
+
}
|
|
3105
|
+
if (brush.behavior.pickup > 0) return `The ${brush.name} brush picks up the paint under it (pickup ${brush.behavior.pickup}), so it can't be redrawn on its own; set behavior.pickup to 0 (set_brush) or paint on a pixel layer.`;
|
|
3106
|
+
return null;
|
|
3107
|
+
}
|
|
3108
|
+
function liveStrokeBounds(stroke) {
|
|
3109
|
+
let x0 = Infinity;
|
|
3110
|
+
let y0 = Infinity;
|
|
3111
|
+
let x1 = -Infinity;
|
|
3112
|
+
let y1 = -Infinity;
|
|
3113
|
+
for (const m of [null, ..._nullishCoalesce(stroke.copies, () => ( []))]) {
|
|
3114
|
+
for (const p of stroke.points) {
|
|
3115
|
+
const q = m ? applyAffine(m, p.x, p.y) : p;
|
|
3116
|
+
if (q.x < x0) x0 = q.x;
|
|
3117
|
+
if (q.y < y0) y0 = q.y;
|
|
3118
|
+
if (q.x > x1) x1 = q.x;
|
|
3119
|
+
if (q.y > y1) y1 = q.y;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
const pad = stroke.brush.tip.size * (stroke.brush.engine === "particle" ? 2 : 1) + 2;
|
|
3123
|
+
return { x: Math.floor(x0 - pad), y: Math.floor(y0 - pad), width: Math.ceil(x1 - x0 + 2 * pad), height: Math.ceil(y1 - y0 + 2 * pad) };
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3088
3126
|
// src/paint-editor/replay.ts
|
|
3089
3127
|
function replayItems(doc) {
|
|
3090
3128
|
const items = [];
|
|
@@ -3126,8 +3164,16 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3126
3164
|
if (!target.getLayer(e.layerId)) continue;
|
|
3127
3165
|
if (e.kind === "fill") target.fillLayer({ layerId: e.layerId, ...e.data });
|
|
3128
3166
|
else if (e.kind === "clear") target.clearLayer(e.layerId);
|
|
3129
|
-
else if (e.kind === "
|
|
3130
|
-
const
|
|
3167
|
+
else if (e.kind === "live-strokes") {
|
|
3168
|
+
const d = e.data;
|
|
3169
|
+
if (_optionalChain([d, 'optionalAccess', _160 => _160.rasterized])) target.replaceLiveStrokes(e.layerId, null);
|
|
3170
|
+
else {
|
|
3171
|
+
const list = (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _161 => _161.strokes]), () => ( []))).map((st2) => s === 1 ? st2 : { ...varyStroke(st2, scaleM, { scale: s }), ...st2.stencils ? { stencils: st2.stencils.map((x) => scaleStencil(x, s)) } : {} });
|
|
3172
|
+
await target.prepareEffectPaints(list.flatMap((st2) => _optionalChain([st2, 'access', _162 => _162.paint, 'optionalAccess', _163 => _163.type]) === "effect" ? [st2.paint] : []));
|
|
3173
|
+
target.replaceLiveStrokes(e.layerId, list);
|
|
3174
|
+
}
|
|
3175
|
+
} else if (e.kind === "stickers") {
|
|
3176
|
+
const list = (_nullishCoalesce(_optionalChain([e, 'access', _164 => _164.data, 'optionalAccess', _165 => _165.stickers]), () => ( []))).map((x) => s === 1 ? x : { ...x, x: x.x * s, y: x.y * s, size: x.size * s });
|
|
3131
3177
|
target.replaceStickers(e.layerId, list);
|
|
3132
3178
|
} else target.flattenRelief(e.layerId);
|
|
3133
3179
|
continue;
|
|
@@ -3140,8 +3186,8 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3140
3186
|
switch (e.kind) {
|
|
3141
3187
|
case "dry": {
|
|
3142
3188
|
const rect = e.data;
|
|
3143
|
-
const ids = _optionalChain([e, 'access',
|
|
3144
|
-
if (_optionalChain([ids, 'optionalAccess',
|
|
3189
|
+
const ids = _optionalChain([e, 'access', _166 => _166.layerId, 'optionalAccess', _167 => _167.split, 'call', _168 => _168(","), 'access', _169 => _169.filter, 'call', _170 => _170(Boolean)]);
|
|
3190
|
+
if (_optionalChain([ids, 'optionalAccess', _171 => _171.length])) for (const id of ids) target.dryPaint({ layerId: id, rect: rect ? sr(rect) : void 0 });
|
|
3145
3191
|
else target.dryPaint({ rect: rect ? sr(rect) : void 0 });
|
|
3146
3192
|
break;
|
|
3147
3193
|
}
|
|
@@ -3172,7 +3218,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3172
3218
|
strokes++;
|
|
3173
3219
|
if (!target.getLayer(st.layerId)) continue;
|
|
3174
3220
|
const init = { layerId: st.layerId, color: st.color, brush: st.brush, seed: st.seed, copies: _nullishCoalesce(st.copies, () => ( [])), ...st.load ? { load: st.load } : {}, ...st.paint ? { paint: st.paint } : {}, snapToPerspective: false, stencils: false, maskStencils: (_nullishCoalesce(st.stencils, () => ( []))).map((x) => s === 1 ? x : scaleStencil(x, s)) };
|
|
3175
|
-
if (st.brush.engine === "wet" && _optionalChain([st, 'access',
|
|
3221
|
+
if (st.brush.engine === "wet" && _optionalChain([st, 'access', _172 => _172.steps, 'optionalAccess', _173 => _173.length]) === st.points.length) {
|
|
3176
3222
|
await target.wetIdle();
|
|
3177
3223
|
await advanceTo(st.steps[0]);
|
|
3178
3224
|
const session = target.beginStroke({ ...init, start: st.points[0] });
|
|
@@ -3192,7 +3238,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3192
3238
|
await target.wetIdle();
|
|
3193
3239
|
target.paintStroke({ ...init, points: st.points });
|
|
3194
3240
|
}
|
|
3195
|
-
await _optionalChain([options, 'access',
|
|
3241
|
+
await _optionalChain([options, 'access', _174 => _174.onStroke, 'optionalCall', _175 => _175(strokes)]);
|
|
3196
3242
|
}
|
|
3197
3243
|
void IDENTITY_AFFINE;
|
|
3198
3244
|
}
|
|
@@ -3237,7 +3283,7 @@ async function buildTimeLapse(source, target, options = {}) {
|
|
|
3237
3283
|
wetChunk: wetEvery > 0 ? wetEvery : 0,
|
|
3238
3284
|
onStroke: (i) => {
|
|
3239
3285
|
if (i % perFrame === 0 || i === total) shoot(i);
|
|
3240
|
-
_optionalChain([options, 'access',
|
|
3286
|
+
_optionalChain([options, 'access', _176 => _176.onProgress, 'optionalCall', _177 => _177(total ? i / total : 1)]);
|
|
3241
3287
|
},
|
|
3242
3288
|
onWetSteps: wetEvery > 0 ? () => shoot(-1) : void 0
|
|
3243
3289
|
});
|
|
@@ -3425,7 +3471,7 @@ function unionRect(a, b) {
|
|
|
3425
3471
|
const y = Math.min(a.y, b.y);
|
|
3426
3472
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
3427
3473
|
}
|
|
3428
|
-
var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess',
|
|
3474
|
+
var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess', _178 => _178.type]) === "pixel";
|
|
3429
3475
|
var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
3430
3476
|
|
|
3431
3477
|
__init72() {this.extensions = {}}
|
|
@@ -3450,45 +3496,48 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3450
3496
|
__init82() {this.mixerLoad = _chunkPQ3H2AANcjs.EMPTY_MIXER_LOAD}
|
|
3451
3497
|
__init83() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
|
|
3452
3498
|
|
|
3453
|
-
__init84() {this.
|
|
3499
|
+
__init84() {this.selectedStroke = null}
|
|
3500
|
+
__init85() {this.selectedSticker = null}
|
|
3454
3501
|
/** A sticker drag in progress (`previewSticker`): the document before it, so the drop undoes in one step, and the one it showed last. */
|
|
3455
|
-
|
|
3502
|
+
__init86() {this.stickerPreview = null}
|
|
3456
3503
|
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3504
|
+
__init87() {this.listeners = /* @__PURE__ */ new Set()}
|
|
3505
|
+
__init88() {this.version = 0}
|
|
3506
|
+
__init89() {this.cached = null}
|
|
3507
|
+
__init90() {this.session = null}
|
|
3508
|
+
__init91() {this.live = null}
|
|
3509
|
+
__init92() {this.liveLayers = null}
|
|
3510
|
+
__init93() {this.dirty = "all"}
|
|
3511
|
+
__init94() {this.seedCounter = 1}
|
|
3512
|
+
__init95() {this.strokeCounter = 1}
|
|
3513
|
+
/** The area each stroke painted (document pixels; `null`: nothing), learnt as it is painted or drawn, so a stroke layer edit redraws only where it changes (see `drawLiveStrokes`). */
|
|
3514
|
+
__init96() {this.paintedBounds = /* @__PURE__ */ new WeakMap()}
|
|
3466
3515
|
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3516
|
+
__init97() {this.swatches = DEFAULT_SWATCHES.map((s) => ({ ...s }))}
|
|
3517
|
+
__init98() {this.pad = new MixingPad()}
|
|
3518
|
+
__init99() {this.savedPads = []}
|
|
3519
|
+
__init100() {this.nextPadId = 1}
|
|
3520
|
+
__init101() {this.tracingVersion = 1}
|
|
3521
|
+
__init102() {this.tracingCache = null}
|
|
3522
|
+
__init103() {this.imagePixels = /* @__PURE__ */ new Map()}
|
|
3523
|
+
__init104() {this.nextReferenceId = 1}
|
|
3524
|
+
__init105() {this.viewCompositor = createPaintCompositor()}
|
|
3525
|
+
__init106() {this.exportCompositor = createPaintCompositor()}
|
|
3477
3526
|
/** Wet media: the simulation, its settings and time. */
|
|
3478
3527
|
|
|
3479
3528
|
|
|
3480
3529
|
/** Where the light comes from for thick paint (saved with the document, not undo steps). */
|
|
3481
|
-
|
|
3482
|
-
|
|
3530
|
+
__init107() {this.lighting = { ...DEFAULT_LIGHTING }}
|
|
3531
|
+
__init108() {this.litCaches = /* @__PURE__ */ new Map()}
|
|
3483
3532
|
/** The live impasto stroke's channels. */
|
|
3484
|
-
|
|
3533
|
+
__init109() {this.liveThick = null}
|
|
3485
3534
|
/** Set while an operation that changes wet paint runs: the simulation before it (for undo). */
|
|
3486
|
-
|
|
3535
|
+
__init110() {this.wetOp = null}
|
|
3487
3536
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);_class10.prototype.__init109.call(this);_class10.prototype.__init110.call(this);_class10.prototype.__init111.call(this);_class10.prototype.__init112.call(this);_class10.prototype.__init113.call(this);_class10.prototype.__init114.call(this);_class10.prototype.__init115.call(this);
|
|
3537
|
+
__init111() {this.effects = new (0, _chunkJAOSL334cjs.EffectsSlot)()}
|
|
3538
|
+
__init112() {this.effectsRenderer = new PaintEffectsRenderer()}
|
|
3539
|
+
__init113() {this.paperEffectNodeCache = null}
|
|
3540
|
+
constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);_class10.prototype.__init109.call(this);_class10.prototype.__init110.call(this);_class10.prototype.__init111.call(this);_class10.prototype.__init112.call(this);_class10.prototype.__init113.call(this);_class10.prototype.__init114.call(this);_class10.prototype.__init115.call(this);_class10.prototype.__init116.call(this);_class10.prototype.__init117.call(this);
|
|
3492
3541
|
this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
|
|
3493
3542
|
this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
|
|
3494
3543
|
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkNKTNLJUJcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
|
|
@@ -3504,7 +3553,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3504
3553
|
canvas: () => this.doc.canvas,
|
|
3505
3554
|
paper: () => this.doc.paper,
|
|
3506
3555
|
layerSurface: (id) => {
|
|
3507
|
-
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess',
|
|
3556
|
+
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _179 => _179.layer]);
|
|
3508
3557
|
return isPixelLayer(l) ? l.surface : null;
|
|
3509
3558
|
},
|
|
3510
3559
|
updateSurfaces: (surfaces, rects) => {
|
|
@@ -3518,7 +3567,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3518
3567
|
},
|
|
3519
3568
|
options.wet
|
|
3520
3569
|
);
|
|
3521
|
-
this.wet.onDriverDone = () => _optionalChain([this, 'access',
|
|
3570
|
+
this.wet.onDriverDone = () => _optionalChain([this, 'access', _180 => _180.session, 'optionalAccess', _181 => _181.completeWetEnd, 'call', _182 => _182()]);
|
|
3522
3571
|
}
|
|
3523
3572
|
// --- State and events ----------------------------------------------------------
|
|
3524
3573
|
subscribe(listener) {
|
|
@@ -3549,11 +3598,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3549
3598
|
mixerLoad: this.mixerLoad,
|
|
3550
3599
|
view: this.view,
|
|
3551
3600
|
hand: this.hand,
|
|
3601
|
+
selectedStroke: this.selectedStroke,
|
|
3552
3602
|
selectedSticker: this.selectedSticker,
|
|
3553
3603
|
canUndo: this.undoStack.length > 0 && !this.session,
|
|
3554
3604
|
canRedo: this.redoStack.length > 0 && !this.session,
|
|
3555
|
-
undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess',
|
|
3556
|
-
redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
3605
|
+
undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess', _183 => _183.label]), () => ( null)),
|
|
3606
|
+
redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess', _184 => _184.label]), () => ( null)),
|
|
3557
3607
|
guides: this.guides,
|
|
3558
3608
|
swatches: this.swatches,
|
|
3559
3609
|
mixingPadVersion: this.pad.version,
|
|
@@ -3566,10 +3616,10 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3566
3616
|
overlay: this.wet.overlay,
|
|
3567
3617
|
instantDry: this.wet.instantDry,
|
|
3568
3618
|
speed: this.wet.speed,
|
|
3569
|
-
clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
3619
|
+
clock: _nullishCoalesce(_optionalChain([this, 'access', _185 => _185.wet, 'access', _186 => _186.world, 'optionalAccess', _187 => _187.clock]), () => ( 0)),
|
|
3570
3620
|
tilt: { ...this.wet.tilt },
|
|
3571
3621
|
gpu: this.wet.gpuMode,
|
|
3572
|
-
gpuActive: Boolean(_optionalChain([this, 'access',
|
|
3622
|
+
gpuActive: Boolean(_optionalChain([this, 'access', _188 => _188.wet, 'access', _189 => _189.world, 'optionalAccess', _190 => _190.gpuActive]))
|
|
3573
3623
|
},
|
|
3574
3624
|
version: this.version
|
|
3575
3625
|
};
|
|
@@ -3588,7 +3638,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3588
3638
|
return d;
|
|
3589
3639
|
}
|
|
3590
3640
|
// --- History -------------------------------------------------------------------
|
|
3591
|
-
|
|
3641
|
+
__init114() {this.docRevision = 0}
|
|
3592
3642
|
/**
|
|
3593
3643
|
* Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
|
|
3594
3644
|
* document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
|
|
@@ -3671,9 +3721,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3671
3721
|
return wetIds;
|
|
3672
3722
|
}
|
|
3673
3723
|
/** Records a wet event (for replays) in the document being built. */
|
|
3674
|
-
|
|
3724
|
+
__init115() {this.pendingWetEvents = []}
|
|
3675
3725
|
logWet(e) {
|
|
3676
|
-
this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
3726
|
+
this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access', _191 => _191.wet, 'access', _192 => _192.world, 'optionalAccess', _193 => _193.clock]), () => ( 0)), at: this.doc.strokes.length, ...e });
|
|
3677
3727
|
}
|
|
3678
3728
|
/** The document with a paint event appended (for replays). */
|
|
3679
3729
|
withPaintEvent(doc, e) {
|
|
@@ -3817,7 +3867,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3817
3867
|
}
|
|
3818
3868
|
let next = { ...shiftDocument(this.withWetEvents(this.doc), left, top), canvas: { ...was, width, height } };
|
|
3819
3869
|
for (const id of keptWet) {
|
|
3820
|
-
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, next.layers, id), 'optionalAccess',
|
|
3870
|
+
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, next.layers, id), 'optionalAccess', _194 => _194.layer]);
|
|
3821
3871
|
if (isPixelLayer(l)) next = { ...next, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, next.layers, id, () => ({ ...l, surface: _chunk474IQG74cjs.translateSurface.call(void 0, l.surface, l.offset.x, l.offset.y), offset: { x: 0, y: 0 } })) };
|
|
3822
3872
|
}
|
|
3823
3873
|
if (this.wet.world) {
|
|
@@ -3861,7 +3911,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3861
3911
|
}
|
|
3862
3912
|
// --- Layers --------------------------------------------------------------------
|
|
3863
3913
|
getLayer(id) {
|
|
3864
|
-
return _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess',
|
|
3914
|
+
return _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _195 => _195.layer]);
|
|
3865
3915
|
}
|
|
3866
3916
|
/** The active pixel layer (or `undefined`). */
|
|
3867
3917
|
getActiveLayer() {
|
|
@@ -3880,7 +3930,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3880
3930
|
walk(this.doc.layers, null, 0);
|
|
3881
3931
|
return out;
|
|
3882
3932
|
}
|
|
3883
|
-
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess',
|
|
3933
|
+
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _196 => _196.parent, 'optionalAccess', _197 => _197.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _198 => _198.path, 'access', _199 => _199.length]), () => ( 0))) {
|
|
3884
3934
|
let bounds = null;
|
|
3885
3935
|
if (l.type === "pixel") {
|
|
3886
3936
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, l.surface);
|
|
@@ -3897,6 +3947,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3897
3947
|
locks: { ..._nullishCoalesce(l.locks, () => ( {})) },
|
|
3898
3948
|
active: l.id === this.doc.activeLayerId,
|
|
3899
3949
|
bounds,
|
|
3950
|
+
..._optionalChain([this, 'access', _200 => _200.doc, 'access', _201 => _201.liveStrokes, 'optionalAccess', _202 => _202[l.id]]) ? { liveStrokes: this.doc.liveStrokes[l.id].length } : {},
|
|
3900
3951
|
parentId,
|
|
3901
3952
|
depth
|
|
3902
3953
|
};
|
|
@@ -3923,11 +3974,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3923
3974
|
this.emit();
|
|
3924
3975
|
}
|
|
3925
3976
|
/** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
|
|
3977
|
+
/** Adds a layer above the active one: `pixel` (default), `group`, or `strokes`, a live stroke layer whose strokes stay editable. */
|
|
3926
3978
|
addLayer(options = {}) {
|
|
3927
3979
|
this.requireIdle("adding a layer");
|
|
3928
3980
|
const count = _chunkHB4ICNNAcjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
3929
3981
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
3930
|
-
const name = _optionalChain([options, 'access',
|
|
3982
|
+
const name = _optionalChain([options, 'access', _203 => _203.name, 'optionalAccess', _204 => _204.trim, 'call', _205 => _205()]) || (type === "group" ? `Group ${count + 1}` : type === "strokes" ? `Strokes ${count + 1}` : `Layer ${count + 1}`);
|
|
3931
3983
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
3932
3984
|
let parentId = null;
|
|
3933
3985
|
let index;
|
|
@@ -3939,11 +3991,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3939
3991
|
} else if (above) {
|
|
3940
3992
|
const loc = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, above);
|
|
3941
3993
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
3942
|
-
parentId = _nullishCoalesce(_optionalChain([loc, 'access',
|
|
3994
|
+
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _206 => _206.parent, 'optionalAccess', _207 => _207.id]), () => ( null));
|
|
3943
3995
|
index = loc.index + 1;
|
|
3944
3996
|
}
|
|
3945
3997
|
const layers = _chunkHB4ICNNAcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
3946
|
-
|
|
3998
|
+
const live = type === "strokes" ? { liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [layer.id]: [] } } : {};
|
|
3999
|
+
this.commit(type === "group" ? "Add group" : type === "strokes" ? "Add stroke layer" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id, ...live });
|
|
3947
4000
|
return this.describeLayer(layer);
|
|
3948
4001
|
}
|
|
3949
4002
|
updateLayer(id, update) {
|
|
@@ -3979,8 +4032,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3979
4032
|
}
|
|
3980
4033
|
const layers = _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3981
4034
|
let active = this.doc.activeLayerId;
|
|
3982
|
-
if (active && !_chunkHB4ICNNAcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers), 'access',
|
|
3983
|
-
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkHB4ICNNAcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkHB4ICNNAcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
4035
|
+
if (active && !_chunkHB4ICNNAcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers), 'access', _208 => _208.filter, 'call', _209 => _209((x) => x.type === "pixel"), 'access', _210 => _210.pop, 'call', _211 => _211(), 'optionalAccess', _212 => _212.id]), () => ( null));
|
|
4036
|
+
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkHB4ICNNAcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkHB4ICNNAcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.liveStrokesWithout(_chunkHB4ICNNAcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
3984
4037
|
return { removed: id, activeLayerId: active };
|
|
3985
4038
|
}
|
|
3986
4039
|
duplicateLayer(id) {
|
|
@@ -3993,15 +4046,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3993
4046
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3994
4047
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
3995
4048
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
4049
|
+
const liveStrokes = { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})) };
|
|
3996
4050
|
const copy = (l) => {
|
|
3997
4051
|
const id2 = newPaintLayerId();
|
|
3998
4052
|
if (thick[l.id]) thick[id2] = thick[l.id];
|
|
3999
4053
|
if (stickers[l.id]) stickers[id2] = stickers[l.id].map((x) => ({ ...x }));
|
|
4054
|
+
if (liveStrokes[l.id]) liveStrokes[id2] = liveStrokes[l.id].map((x) => ({ ...x, id: `s${this.strokeCounter++}`, layerId: id2 }));
|
|
4000
4055
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
4001
4056
|
};
|
|
4002
4057
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
4003
|
-
const layers = _chunkHB4ICNNAcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access',
|
|
4004
|
-
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {} }));
|
|
4058
|
+
const layers = _chunkHB4ICNNAcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _213 => _213.parent, 'optionalAccess', _214 => _214.id]), () => ( null)), loc.index + 1);
|
|
4059
|
+
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {}, ...this.doc.liveStrokes ? { liveStrokes } : {} }));
|
|
4005
4060
|
return this.describeLayer(dup);
|
|
4006
4061
|
}
|
|
4007
4062
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
@@ -4009,7 +4064,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4009
4064
|
this.requireIdle("moving a layer");
|
|
4010
4065
|
const loc = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4011
4066
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4012
|
-
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access',
|
|
4067
|
+
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _215 => _215.parent, 'optionalAccess', _216 => _216.id]), () => ( null)) : parentId;
|
|
4013
4068
|
if (target) {
|
|
4014
4069
|
const g = this.requireLayer(target);
|
|
4015
4070
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
@@ -4028,7 +4083,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4028
4083
|
const pre = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4029
4084
|
if (pre) {
|
|
4030
4085
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
4031
|
-
this.dryLayersFirst([id, _optionalChain([sib, 'access',
|
|
4086
|
+
this.dryLayersFirst([id, _optionalChain([sib, 'access', _217 => _217[pre.index - 1], 'optionalAccess', _218 => _218.id])].filter((x) => Boolean(x)));
|
|
4032
4087
|
}
|
|
4033
4088
|
const loc = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4034
4089
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
@@ -4047,7 +4102,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4047
4102
|
}
|
|
4048
4103
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
4049
4104
|
const layers = _chunkHB4ICNNAcjs.mapLayer.call(void 0, _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
4050
|
-
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]) }));
|
|
4105
|
+
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]), ...this.liveStrokesWithout([upper.id, below.id]) }));
|
|
4051
4106
|
return this.describeLayer(merged);
|
|
4052
4107
|
}
|
|
4053
4108
|
/** Removes every pixel of a layer. */
|
|
@@ -4059,7 +4114,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4059
4114
|
this.wet.world.removeLane(l.id);
|
|
4060
4115
|
}
|
|
4061
4116
|
const bounds = this.describeLayer(l).bounds;
|
|
4062
|
-
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]) }, { kind: "clear", layerId: l.id }));
|
|
4117
|
+
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]), ..._optionalChain([this, 'access', _219 => _219.doc, 'access', _220 => _220.liveStrokes, 'optionalAccess', _221 => _221[l.id]]) ? { liveStrokes: { ...this.doc.liveStrokes, [l.id]: [] } } : {} }, { kind: "clear", layerId: l.id }));
|
|
4063
4118
|
return { layerId: l.id, bounds };
|
|
4064
4119
|
}
|
|
4065
4120
|
/**
|
|
@@ -4069,7 +4124,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4069
4124
|
fillLayer(options = {}) {
|
|
4070
4125
|
this.requireIdle("filling");
|
|
4071
4126
|
const fillTarget = this.paintTarget(options.layerId, "fill");
|
|
4072
|
-
if (_optionalChain([this, 'access',
|
|
4127
|
+
if (_optionalChain([this, 'access', _222 => _222.doc, 'access', _223 => _223.stickers, 'optionalAccess', _224 => _224[fillTarget.id], 'optionalAccess', _225 => _225.length])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a sticker layer; fill another layer (add_layer).`);
|
|
4128
|
+
if (_optionalChain([this, 'access', _226 => _226.doc, 'access', _227 => _227.liveStrokes, 'optionalAccess', _228 => _228[fillTarget.id]])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a stroke layer (its pixels are drawn from its strokes); fill another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
|
|
4073
4129
|
this.dryLayersFirst([_nullishCoalesce(_nullishCoalesce(options.layerId, () => ( this.doc.activeLayerId)), () => ( ""))]);
|
|
4074
4130
|
const l = this.paintTarget(options.layerId, "fill");
|
|
4075
4131
|
const color = options.color === void 0 ? this.color : parseColor(options.color);
|
|
@@ -4110,7 +4166,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4110
4166
|
const tiles = new Map(base.tiles);
|
|
4111
4167
|
for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
|
|
4112
4168
|
const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
4113
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access',
|
|
4169
|
+
const src = _nullishCoalesce(_optionalChain([base, 'access', _229 => _229.tiles, 'access', _230 => _230.get, 'call', _231 => _231(key), 'optionalAccess', _232 => _232.data]), () => ( new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4)));
|
|
4114
4170
|
const tile = _chunk474IQG74cjs.finishTile.call(void 0, _chunkPQ3H2AANcjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
|
|
4115
4171
|
if (tile) tiles.set(key, tile);
|
|
4116
4172
|
else tiles.delete(key);
|
|
@@ -4143,7 +4199,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4143
4199
|
}
|
|
4144
4200
|
/** The effect a layer is drawn from, or `undefined` for other layers. */
|
|
4145
4201
|
getEffectLayer(layerId) {
|
|
4146
|
-
return _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access',
|
|
4202
|
+
return _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _233 => _233.doc, 'access', _234 => _234.effectLayers, 'optionalAccess', _235 => _235[layerId]]) : void 0;
|
|
4147
4203
|
}
|
|
4148
4204
|
/** The effect paper (without its pixels), or `null`. */
|
|
4149
4205
|
getPaperEffect() {
|
|
@@ -4180,7 +4236,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4180
4236
|
/** A pixel layer that takes effect pixels: unlocked, visible, no sticker layer, no wet paint. */
|
|
4181
4237
|
effectTarget(layerId, what) {
|
|
4182
4238
|
const l = this.paintTarget(layerId, what);
|
|
4183
|
-
if (_optionalChain([this, 'access',
|
|
4239
|
+
if (_optionalChain([this, 'access', _236 => _236.doc, 'access', _237 => _237.stickers, 'optionalAccess', _238 => _238[l.id], 'optionalAccess', _239 => _239.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; ${what} another layer (add_layer).`);
|
|
4240
|
+
if (_optionalChain([this, 'access', _240 => _240.doc, 'access', _241 => _241.liveStrokes, 'optionalAccess', _242 => _242[l.id]])) throw new PaintEditorError(`Layer "${l.name}" is a stroke layer (its pixels are drawn from its strokes); ${what} another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
|
|
4184
4241
|
if (this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" holds wet paint; effects go on dried paint, so dry it first (dry_paint) and try again.`);
|
|
4185
4242
|
return l;
|
|
4186
4243
|
}
|
|
@@ -4219,8 +4276,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4219
4276
|
const was = this.doc.paperEffect;
|
|
4220
4277
|
const paperEffect = {
|
|
4221
4278
|
...this.sourceOf(d, values, options.time),
|
|
4222
|
-
opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess',
|
|
4223
|
-
blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess',
|
|
4279
|
+
opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess', _243 => _243.opacity]))), () => ( 1)),
|
|
4280
|
+
blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess', _244 => _244.blend]))), () => ( "multiply")),
|
|
4224
4281
|
image: { width: pixels.width, height: pixels.height, data: new Uint8ClampedArray(pixels.data) },
|
|
4225
4282
|
version: nextPaperEffectVersion()
|
|
4226
4283
|
};
|
|
@@ -4273,8 +4330,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4273
4330
|
const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
|
|
4274
4331
|
const loc = above ? _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, above) : null;
|
|
4275
4332
|
if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
|
|
4276
|
-
const layer = { ...createPaintLayer(_optionalChain([options, 'access',
|
|
4277
|
-
const layers = _chunkHB4ICNNAcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess',
|
|
4333
|
+
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _245 => _245.name, 'optionalAccess', _246 => _246.trim, 'call', _247 => _247()]) || d.name), surface: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
|
|
4334
|
+
const layers = _chunkHB4ICNNAcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _248 => _248.parent, 'optionalAccess', _249 => _249.id]), () => ( null)), loc ? loc.index + 1 : void 0);
|
|
4278
4335
|
const source = this.sourceOf(d, values, options.time);
|
|
4279
4336
|
this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
|
|
4280
4337
|
return { layer: this.describeLayer(layer), source };
|
|
@@ -4417,7 +4474,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4417
4474
|
/** Renders the effect paints of recorded strokes (default all of them) before a replay. */
|
|
4418
4475
|
async prepareStrokeEffects(strokeIds) {
|
|
4419
4476
|
const ids = strokeIds ? new Set(strokeIds) : null;
|
|
4420
|
-
const paints = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access',
|
|
4477
|
+
const paints = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access', _250 => _250.paint, 'optionalAccess', _251 => _251.type]) === "effect").map((s) => s.paint);
|
|
4421
4478
|
await this.prepareEffectPaints(paints);
|
|
4422
4479
|
}
|
|
4423
4480
|
/** A small preview of the effect paint (a PNG data URL `size` px wide), or `null` without a rendered one. */
|
|
@@ -4485,14 +4542,14 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4485
4542
|
const before = _chunk474IQG74cjs.readRegion.call(void 0, l.surface, rect);
|
|
4486
4543
|
const inputs = { source: { width: rect.width, height: rect.height, data: before } };
|
|
4487
4544
|
const heightInput = d.inputs.find((i) => i.kind === "image" && /^(height|depth|relief)$/i.test(i.name));
|
|
4488
|
-
const relief = _optionalChain([this, 'access',
|
|
4545
|
+
const relief = _optionalChain([this, 'access', _252 => _252.doc, 'access', _253 => _253.thick, 'optionalAccess', _254 => _254[l.id]]);
|
|
4489
4546
|
if (heightInput && relief) {
|
|
4490
4547
|
const h = _chunk474IQG74cjs.readRegion.call(void 0, relief.height, rect);
|
|
4491
4548
|
const rgba = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
4492
4549
|
for (let i = 0; i < h.length; i++) rgba.set([h[i], h[i], h[i], 255], i * 4);
|
|
4493
4550
|
inputs[heightInput.name] = { width: rect.width, height: rect.height, data: rgba };
|
|
4494
4551
|
}
|
|
4495
|
-
const sourceInput = _nullishCoalesce(_optionalChain([d, 'access',
|
|
4552
|
+
const sourceInput = _nullishCoalesce(_optionalChain([d, 'access', _255 => _255.inputs, 'access', _256 => _256.find, 'call', _257 => _257((i) => i.kind === "image" && i.name !== _optionalChain([heightInput, 'optionalAccess', _258 => _258.name])), 'optionalAccess', _259 => _259.name]), () => ( "source"));
|
|
4496
4553
|
if (sourceInput !== "source") {
|
|
4497
4554
|
inputs[sourceInput] = inputs.source;
|
|
4498
4555
|
delete inputs.source;
|
|
@@ -4754,7 +4811,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4754
4811
|
})();
|
|
4755
4812
|
const brush = this.strokeBrush(init);
|
|
4756
4813
|
const effect = this.strokeEffect(init, brush);
|
|
4757
|
-
|
|
4814
|
+
if (_optionalChain([doc, 'access', _260 => _260.liveStrokes, 'optionalAccess', _261 => _261[layer.id]])) {
|
|
4815
|
+
const why = liveStrokeRefusal(brush);
|
|
4816
|
+
if (why) throw new PaintEditorError(`Layer "${layer.name}" is a stroke layer. ${why}`);
|
|
4817
|
+
}
|
|
4818
|
+
const stickerLayer = Boolean(_optionalChain([doc, 'access', _262 => _262.stickers, 'optionalAccess', _263 => _263[layer.id], 'optionalAccess', _264 => _264.length]));
|
|
4758
4819
|
if (brush.engine === "sticker") {
|
|
4759
4820
|
if (!stickerLayer && _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; spray stickers onto an empty layer (add_layer) so they stay editable.`);
|
|
4760
4821
|
} else if (stickerLayer) {
|
|
@@ -4804,7 +4865,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4804
4865
|
}
|
|
4805
4866
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
4806
4867
|
const tracing = this.guides.tracing;
|
|
4807
|
-
if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess',
|
|
4868
|
+
if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _265 => _265.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
|
|
4808
4869
|
const perspective = this.guides.perspective;
|
|
4809
4870
|
const snapper = init.snapToPerspective && perspective.enabled && perspective.snap ? new PerspectiveSnapper(perspective) : null;
|
|
4810
4871
|
const useStencils = init.stencils !== false;
|
|
@@ -4837,7 +4898,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4837
4898
|
mixerLoad: _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [rgba[0] / 255, rgba[1] / 255, rgba[2] / 255]))),
|
|
4838
4899
|
secondary: rgbaOf(this.secondaryColor),
|
|
4839
4900
|
wet,
|
|
4840
|
-
thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access',
|
|
4901
|
+
thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _266 => _266.thick, 'optionalAccess', _267 => _267[layer.id]]), () => ( emptyThickChannels())) } : void 0,
|
|
4841
4902
|
sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc) } : void 0,
|
|
4842
4903
|
paint: effect ? null : this.strokeGradient(init, brush, color),
|
|
4843
4904
|
effect
|
|
@@ -4876,12 +4937,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4876
4937
|
const before = this.doc;
|
|
4877
4938
|
const host = {
|
|
4878
4939
|
update: (layerId, surface, rects) => {
|
|
4879
|
-
if (_optionalChain([this, 'access',
|
|
4940
|
+
if (_optionalChain([this, 'access', _268 => _268.session, 'optionalAccess', _269 => _269.init, 'access', _270 => _270.wet])) {
|
|
4880
4941
|
this.wet.syncDisplays();
|
|
4881
4942
|
return;
|
|
4882
4943
|
}
|
|
4883
4944
|
this.live = { layerId, surface };
|
|
4884
|
-
const ch = _optionalChain([this, 'access',
|
|
4945
|
+
const ch = _optionalChain([this, 'access', _271 => _271.session, 'optionalAccess', _272 => _272.thickChannels, 'call', _273 => _273()]);
|
|
4885
4946
|
this.liveThick = ch ? { layerId, channels: ch } : null;
|
|
4886
4947
|
this.emit(rects);
|
|
4887
4948
|
},
|
|
@@ -4893,7 +4954,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4893
4954
|
const wetStroke = Boolean(s.init.wet);
|
|
4894
4955
|
if (wetStroke) this.wet.driver = null;
|
|
4895
4956
|
const brush = s.init.brush;
|
|
4896
|
-
if (!cancelled && _optionalChain([s, 'access',
|
|
4957
|
+
if (!cancelled && _optionalChain([s, 'access', _274 => _274.result, 'optionalAccess', _275 => _275.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
|
|
4897
4958
|
if (cancelled || !surface) {
|
|
4898
4959
|
if (this.wetOp) {
|
|
4899
4960
|
const snap = this.wetOp.before;
|
|
@@ -4908,6 +4969,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4908
4969
|
}
|
|
4909
4970
|
const stroke = this.record(s);
|
|
4910
4971
|
s.result.strokeId = stroke.id;
|
|
4972
|
+
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _276 => _276.result, 'optionalAccess', _277 => _277.bounds]), () => ( null)));
|
|
4911
4973
|
if (wetStroke && this.wet.instantDry) {
|
|
4912
4974
|
this.wet.dry(s.layerId);
|
|
4913
4975
|
this.logWet({ kind: "dry", layerId: s.layerId, at: this.doc.strokes.length + 1 });
|
|
@@ -4918,8 +4980,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4918
4980
|
const ch = s.thickChannels();
|
|
4919
4981
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
4920
4982
|
const sprayed = s.stickers();
|
|
4921
|
-
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access',
|
|
4922
|
-
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {} }), wetStroke ? before : this.doc);
|
|
4983
|
+
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _278 => _278.doc, 'access', _279 => _279.stickers, 'optionalAccess', _280 => _280[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
|
|
4984
|
+
this.commit(`${brush.name} stroke`, this.withWetEvents(withLiveStroke({ ...this.doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {} }, stroke)), wetStroke ? before : this.doc);
|
|
4923
4985
|
}
|
|
4924
4986
|
};
|
|
4925
4987
|
let session;
|
|
@@ -4947,17 +5009,18 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4947
5009
|
if (cancelled || !surface) return;
|
|
4948
5010
|
const stroke = this.record(s);
|
|
4949
5011
|
s.result.strokeId = stroke.id;
|
|
5012
|
+
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _281 => _281.result, 'optionalAccess', _282 => _282.bounds]), () => ( null)));
|
|
4950
5013
|
const l = _chunkHB4ICNNAcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
4951
5014
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
4952
5015
|
const ch = s.thickChannels();
|
|
4953
5016
|
const sprayed = s.stickers();
|
|
4954
|
-
out = {
|
|
5017
|
+
out = withLiveStroke({
|
|
4955
5018
|
...out,
|
|
4956
5019
|
layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
4957
5020
|
strokes: [...out.strokes, stroke],
|
|
4958
5021
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
4959
|
-
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access',
|
|
4960
|
-
};
|
|
5022
|
+
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _283 => _283.stickers, 'optionalAccess', _284 => _284[l.id]]), () => ( [])), ...sprayed] } } : {}
|
|
5023
|
+
}, stroke);
|
|
4961
5024
|
}
|
|
4962
5025
|
};
|
|
4963
5026
|
const session = this.sessionFor(doc, init, host);
|
|
@@ -5014,7 +5077,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5014
5077
|
*/
|
|
5015
5078
|
replayStrokes(options) {
|
|
5016
5079
|
this.requireIdle("replaying");
|
|
5017
|
-
if (!_optionalChain([options, 'access',
|
|
5080
|
+
if (!_optionalChain([options, 'access', _285 => _285.strokeIds, 'optionalAccess', _286 => _286.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
|
|
5018
5081
|
const strokes = options.strokeIds.map((id) => {
|
|
5019
5082
|
const s = this.doc.strokes.find((x) => x.id === id);
|
|
5020
5083
|
if (!s) throw new PaintEditorError(`Unknown stroke "${id}". Call list_strokes for the ids.`);
|
|
@@ -5028,7 +5091,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5028
5091
|
if (options.layerId !== void 0) this.paintTarget(options.layerId, "replay onto");
|
|
5029
5092
|
if (options.color === void 0) {
|
|
5030
5093
|
for (const s of strokes) {
|
|
5031
|
-
if (_optionalChain([s, 'access',
|
|
5094
|
+
if (_optionalChain([s, 'access', _287 => _287.paint, 'optionalAccess', _288 => _288.type]) === "effect" && !this.effectPaintImage(s.paint)) {
|
|
5032
5095
|
throw new PaintEditorError(`Stroke "${s.id}" paints with the effect "${s.paint.effect}"${s.paint.provider ? ` from provider "${s.paint.provider}"` : ""}, which is not rendered in this editor; render it first (prepareStrokeEffects; the replay_strokes tool does this) or recolour the replay with color.`);
|
|
5033
5096
|
}
|
|
5034
5097
|
}
|
|
@@ -5097,7 +5160,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5097
5160
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
5098
5161
|
if (!id) return null;
|
|
5099
5162
|
this.requireLayer(id);
|
|
5100
|
-
const ch = _optionalChain([this, 'access',
|
|
5163
|
+
const ch = _optionalChain([this, 'access', _289 => _289.doc, 'access', _290 => _290.thick, 'optionalAccess', _291 => _291[id]]);
|
|
5101
5164
|
if (!ch) return null;
|
|
5102
5165
|
const r = reliefInfo(ch);
|
|
5103
5166
|
return { layerId: id, bounds: r.bounds, maxHeight: r.maxHeight };
|
|
@@ -5205,7 +5268,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5205
5268
|
wetState() {
|
|
5206
5269
|
const st = this.getState().wet;
|
|
5207
5270
|
const backend = this.wet.backend();
|
|
5208
|
-
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess',
|
|
5271
|
+
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _292 => _292.message]), () => ( _chunkXFYLA3ZOcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
|
|
5209
5272
|
}
|
|
5210
5273
|
/**
|
|
5211
5274
|
* Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
|
|
@@ -5290,7 +5353,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5290
5353
|
}
|
|
5291
5354
|
/** Records a settings change as a wet event (not an undo step). */
|
|
5292
5355
|
recordWetSetting(e) {
|
|
5293
|
-
this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
5356
|
+
this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _293 => _293.wet, 'access', _294 => _294.world, 'optionalAccess', _295 => _295.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
|
|
5294
5357
|
}
|
|
5295
5358
|
/** Changes a layer's wet settings (viscosity, evaporation, granulation…). Editor settings saved with the document, not an undo step. */
|
|
5296
5359
|
setWetParams(layerId, update) {
|
|
@@ -5357,7 +5420,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5357
5420
|
currentLayers() {
|
|
5358
5421
|
const live = this.live;
|
|
5359
5422
|
if (!live) return this.doc.layers;
|
|
5360
|
-
if (_optionalChain([this, 'access',
|
|
5423
|
+
if (_optionalChain([this, 'access', _296 => _296.liveLayers, 'optionalAccess', _297 => _297.key]) === live.surface) return this.liveLayers.layers;
|
|
5361
5424
|
const layers = _chunkHB4ICNNAcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
5362
5425
|
this.liveLayers = { key: live.surface, layers };
|
|
5363
5426
|
return layers;
|
|
@@ -5380,7 +5443,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5380
5443
|
tracingNode(t) {
|
|
5381
5444
|
const { width, height } = this.doc.canvas;
|
|
5382
5445
|
const key = this.tracingVersion * 100003 + width * 7 + height;
|
|
5383
|
-
if (_optionalChain([this, 'access',
|
|
5446
|
+
if (_optionalChain([this, 'access', _298 => _298.tracingCache, 'optionalAccess', _299 => _299.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
|
|
5384
5447
|
const src = _nullishCoalesce(this.imagePixels.get(t.src), () => ( this.decodeImage(t.src)));
|
|
5385
5448
|
const image = resampleInto(src, t.rect, width, height);
|
|
5386
5449
|
const node = { type: "image", id: TRACING_NODE_ID, name: "Tracing", visible: true, opacity: t.opacity, blend: "normal", image, version: key + Math.round(t.opacity * 1e3) / 1e4 };
|
|
@@ -5407,8 +5470,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5407
5470
|
let out = layers;
|
|
5408
5471
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
5409
5472
|
for (const id of ids) {
|
|
5410
|
-
const ch = _optionalChain([live, 'optionalAccess',
|
|
5411
|
-
const l = ch && _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, out, id), 'optionalAccess',
|
|
5473
|
+
const ch = _optionalChain([live, 'optionalAccess', _300 => _300.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _301 => _301[id]]);
|
|
5474
|
+
const l = ch && _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, out, id), 'optionalAccess', _302 => _302.layer]);
|
|
5412
5475
|
if (!ch || !isPixelLayer(l)) continue;
|
|
5413
5476
|
let cache = this.litCaches.get(id);
|
|
5414
5477
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
@@ -5421,7 +5484,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5421
5484
|
let layers = this.litLayers((_nullishCoalesce(options.wet, () => ( "display"))) === "dried" ? this.driedLayers() : this.currentLayers());
|
|
5422
5485
|
if (options.layerIds) {
|
|
5423
5486
|
const picked = [];
|
|
5424
|
-
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, layers, id), 'optionalAccess',
|
|
5487
|
+
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _303 => _303.layer]), () => ( this.requireLayer(id))));
|
|
5425
5488
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
5426
5489
|
}
|
|
5427
5490
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -5437,7 +5500,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5437
5500
|
*/
|
|
5438
5501
|
compositeTiles(rect, onTile, options = {}) {
|
|
5439
5502
|
const dirty = options.dirty === "all" ? void 0 : options.dirty;
|
|
5440
|
-
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access',
|
|
5503
|
+
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _304 => _304.live, 'optionalAccess', _305 => _305.layerId]), () => ( this.doc.activeLayerId)) });
|
|
5441
5504
|
}
|
|
5442
5505
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
5443
5506
|
compositePixels(options = {}) {
|
|
@@ -5501,7 +5564,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5501
5564
|
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length && _chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id)) stickers[id] = list.map((x) => ({ ...x }));
|
|
5502
5565
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
5503
5566
|
else delete ext.stickers;
|
|
5504
|
-
const
|
|
5567
|
+
const liveStrokes = {};
|
|
5568
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) if (_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id)) liveStrokes[id] = list.map((x) => JSON.parse(JSON.stringify(x)));
|
|
5569
|
+
if (Object.keys(liveStrokes).length) ext.liveStrokes = liveStrokes;
|
|
5570
|
+
else delete ext.liveStrokes;
|
|
5571
|
+
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _306 => _306.layer])));
|
|
5505
5572
|
if (effectLayers) ext.effectLayers = effectLayers;
|
|
5506
5573
|
else delete ext.effectLayers;
|
|
5507
5574
|
if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
|
|
@@ -5524,10 +5591,20 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5524
5591
|
}
|
|
5525
5592
|
if (Object.keys(stickers).length) state = { ...state, stickers };
|
|
5526
5593
|
}
|
|
5594
|
+
if (ext.liveStrokes && typeof ext.liveStrokes === "object") {
|
|
5595
|
+
const liveStrokes = {};
|
|
5596
|
+
for (const [id, list] of Object.entries(ext.liveStrokes)) {
|
|
5597
|
+
if (!isPixelLayer(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _307 => _307.layer])) || !Array.isArray(list)) continue;
|
|
5598
|
+
const ok = list.map(normalizeBrushStroke).filter((x) => x !== null).map((x) => ({ ...x, layerId: id }));
|
|
5599
|
+
if (ok.length !== list.length) problems.push(`Some strokes of stroke layer "${id}" could not be read; they were dropped (the layer's pixels are kept until a stroke is edited).`);
|
|
5600
|
+
liveStrokes[id] = ok;
|
|
5601
|
+
}
|
|
5602
|
+
if (Object.keys(liveStrokes).length) state = { ...state, liveStrokes };
|
|
5603
|
+
}
|
|
5527
5604
|
if (ext.effectLayers && typeof ext.effectLayers === "object") {
|
|
5528
5605
|
const effectLayers = {};
|
|
5529
5606
|
for (const [id, v] of Object.entries(ext.effectLayers)) {
|
|
5530
|
-
if (!isPixelLayer(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess',
|
|
5607
|
+
if (!isPixelLayer(_optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _308 => _308.layer]))) continue;
|
|
5531
5608
|
const source = readPaintEffectSource(v);
|
|
5532
5609
|
if (source) effectLayers[id] = source;
|
|
5533
5610
|
else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
|
|
@@ -5568,16 +5645,23 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5568
5645
|
this.readGuides(loaded.guides, loaded.state, loaded.problems);
|
|
5569
5646
|
if (Array.isArray(loaded.swatches)) this.swatches = loaded.swatches.map(readSwatch).filter((x) => x !== null);
|
|
5570
5647
|
for (const s of loaded.state.strokes) {
|
|
5571
|
-
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access',
|
|
5648
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _309 => _309.exec, 'call', _310 => _310(s.id), 'optionalAccess', _311 => _311[1]]), () => ( 0)));
|
|
5572
5649
|
if (n >= this.strokeCounter) this.strokeCounter = n + 1;
|
|
5573
5650
|
}
|
|
5574
5651
|
this.undoStack = [];
|
|
5575
5652
|
this.redoStack = [];
|
|
5576
5653
|
this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
|
|
5654
|
+
for (const list of Object.values(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
|
|
5655
|
+
for (const s of list) {
|
|
5656
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _312 => _312.exec, 'call', _313 => _313(s.id), 'optionalAccess', _314 => _314[1]]), () => ( 0)));
|
|
5657
|
+
if (n >= this.strokeCounter) this.strokeCounter = n + 1;
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5577
5660
|
this.docRevision++;
|
|
5578
5661
|
delete this.extensions.layerChannels;
|
|
5579
5662
|
delete this.extensions.lighting;
|
|
5580
5663
|
delete this.extensions.stickers;
|
|
5664
|
+
delete this.extensions.liveStrokes;
|
|
5581
5665
|
delete this.extensions.effectLayers;
|
|
5582
5666
|
delete this.extensions.paperEffect;
|
|
5583
5667
|
this.viewCompositor.clear();
|
|
@@ -5662,8 +5746,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5662
5746
|
const layers = toStandard(dried);
|
|
5663
5747
|
const result = _chunkBBUE3UJLcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
5664
5748
|
for (const [mode, names] of changed) {
|
|
5665
|
-
const label = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access',
|
|
5666
|
-
const std = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access',
|
|
5749
|
+
const label = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access', _315 => _315.find, 'call', _316 => _316((m) => m.id === mode), 'optionalAccess', _317 => _317.label]), () => ( mode));
|
|
5750
|
+
const std = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access', _318 => _318.find, 'call', _319 => _319((m) => m.id === _chunkOLNIPTB3cjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _320 => _320.label]), () => ( _chunkOLNIPTB3cjs.standardBlendMode.call(void 0, mode)));
|
|
5667
5751
|
const list = names.map((n) => `"${n}"`).join(", ");
|
|
5668
5752
|
const one = names.length === 1;
|
|
5669
5753
|
result.warnings.push(`${label} blending has no PSD equivalent; ${list} ${one ? "was" : "were"} written as ${std}, the nearest Photoshop mode, so ${one ? "it looks" : "they look"} different in Photoshop (the merged image is exact).`);
|
|
@@ -5779,7 +5863,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5779
5863
|
const { src, pixels } = this.importImage(options, "The reference image");
|
|
5780
5864
|
const ref2 = {
|
|
5781
5865
|
id: `ref${this.nextReferenceId++}`,
|
|
5782
|
-
name: _optionalChain([options, 'access',
|
|
5866
|
+
name: _optionalChain([options, 'access', _321 => _321.name, 'optionalAccess', _322 => _322.trim, 'call', _323 => _323()]) || `Reference ${this.guides.references.length + 1}`,
|
|
5783
5867
|
src,
|
|
5784
5868
|
width: pixels.width,
|
|
5785
5869
|
height: pixels.height,
|
|
@@ -5858,7 +5942,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5858
5942
|
try {
|
|
5859
5943
|
const px = this.decodeImage(ref2.src, `Reference "${ref2.name}"`);
|
|
5860
5944
|
guides.references.push({ id: ref2.id, name: String(_nullishCoalesce(ref2.name, () => ( ref2.id))), src: ref2.src, width: px.width, height: px.height, x: Number(ref2.x) || 0, y: Number(ref2.y) || 0, displayWidth: Number(ref2.displayWidth) || 240, visible: ref2.visible !== false });
|
|
5861
|
-
const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access',
|
|
5945
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _324 => _324.exec, 'call', _325 => _325(ref2.id), 'optionalAccess', _326 => _326[1]]), () => ( 0)));
|
|
5862
5946
|
if (n >= this.nextReferenceId) this.nextReferenceId = n + 1;
|
|
5863
5947
|
} catch (e) {
|
|
5864
5948
|
problems.push(e.message);
|
|
@@ -5869,7 +5953,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5869
5953
|
guides.stencils = [];
|
|
5870
5954
|
r.stencils.forEach((raw2, i) => {
|
|
5871
5955
|
try {
|
|
5872
|
-
const id = typeof _optionalChain([raw2, 'optionalAccess',
|
|
5956
|
+
const id = typeof _optionalChain([raw2, 'optionalAccess', _327 => _327.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
|
|
5873
5957
|
guides.stencils.push(normalizeStencil(raw2, id));
|
|
5874
5958
|
const n = Number(id.slice(7));
|
|
5875
5959
|
if (n >= this.nextStencilId) this.nextStencilId = n + 1;
|
|
@@ -5892,12 +5976,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5892
5976
|
/** The next free sticker number (ids `st<n>` are unique across the document). */
|
|
5893
5977
|
nextStickerNumber(doc = this.doc) {
|
|
5894
5978
|
let n = 0;
|
|
5895
|
-
for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access',
|
|
5979
|
+
for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _328 => _328.exec, 'call', _329 => _329(st.id), 'optionalAccess', _330 => _330[1]]), () => ( 0))));
|
|
5896
5980
|
return n + 1;
|
|
5897
5981
|
}
|
|
5898
5982
|
stickerLayer(layerId) {
|
|
5899
5983
|
const l = this.wetLayer(layerId, "edit the stickers of");
|
|
5900
|
-
const stickers = _optionalChain([this, 'access',
|
|
5984
|
+
const stickers = _optionalChain([this, 'access', _331 => _331.doc, 'access', _332 => _332.stickers, 'optionalAccess', _333 => _333[l.id]]);
|
|
5901
5985
|
if (!stickers) throw new PaintEditorError(`Layer "${l.name}" has no stickers; spray some with a sticker brush (list_brushes category sticker).`);
|
|
5902
5986
|
return { layer: l, stickers };
|
|
5903
5987
|
}
|
|
@@ -5906,7 +5990,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5906
5990
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
5907
5991
|
if (!id) return [];
|
|
5908
5992
|
this.requireLayer(id);
|
|
5909
|
-
return (_nullishCoalesce(_optionalChain([this, 'access',
|
|
5993
|
+
return (_nullishCoalesce(_optionalChain([this, 'access', _334 => _334.doc, 'access', _335 => _335.stickers, 'optionalAccess', _336 => _336[id]]), () => ( []))).map((s) => ({ ...s }));
|
|
5910
5994
|
}
|
|
5911
5995
|
/**
|
|
5912
5996
|
* Replaces a layer's stickers and redraws its pixels from them (one undo step). With `dirty`,
|
|
@@ -5926,7 +6010,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5926
6010
|
}
|
|
5927
6011
|
/** The document from before the sticker preview on screen, or `null` when none is (anything else changed the document since). */
|
|
5928
6012
|
previewBase() {
|
|
5929
|
-
return _optionalChain([this, 'access',
|
|
6013
|
+
return _optionalChain([this, 'access', _337 => _337.stickerPreview, 'optionalAccess', _338 => _338.shown]) === this.doc ? this.stickerPreview.base : null;
|
|
5930
6014
|
}
|
|
5931
6015
|
readStickerUpdate(update) {
|
|
5932
6016
|
try {
|
|
@@ -5941,7 +6025,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5941
6025
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
5942
6026
|
if (!id) return null;
|
|
5943
6027
|
this.requireLayer(id);
|
|
5944
|
-
const hit = _chunkNKTNLJUJcjs.stickerAt.call(void 0, _nullishCoalesce(_optionalChain([this, 'access',
|
|
6028
|
+
const hit = _chunkNKTNLJUJcjs.stickerAt.call(void 0, _nullishCoalesce(_optionalChain([this, 'access', _339 => _339.doc, 'access', _340 => _340.stickers, 'optionalAccess', _341 => _341[id]]), () => ( [])), x, y);
|
|
5945
6029
|
return hit ? { ...hit } : null;
|
|
5946
6030
|
}
|
|
5947
6031
|
/** Picks a sticker for the panel and canvas (`null` for none). Editor state, not an undo step. */
|
|
@@ -5997,8 +6081,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5997
6081
|
const layer = this.wetLayer(layerId, "add stickers to");
|
|
5998
6082
|
if (!input.length) throw new PaintEditorError("Pass at least one sticker (stamp, x, y).");
|
|
5999
6083
|
if (input.length > MAX_ADD_STICKERS) throw new PaintEditorError(`At most ${MAX_ADD_STICKERS} stickers per call; split them over several calls.`);
|
|
6000
|
-
const existing = _optionalChain([this, 'access',
|
|
6001
|
-
if (!_optionalChain([existing, 'optionalAccess',
|
|
6084
|
+
const existing = _optionalChain([this, 'access', _342 => _342.doc, 'access', _343 => _343.stickers, 'optionalAccess', _344 => _344[layer.id]]);
|
|
6085
|
+
if (!_optionalChain([existing, 'optionalAccess', _345 => _345.length])) {
|
|
6002
6086
|
if (this.wet.wetLayerIds().includes(layer.id) || _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; add stickers to an empty layer (add_layer) or a sticker layer so they stay editable.`);
|
|
6003
6087
|
}
|
|
6004
6088
|
let n = this.nextStickerNumber();
|
|
@@ -6014,7 +6098,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
6014
6098
|
const id = n++;
|
|
6015
6099
|
return { id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => ( _chunkPQ3H2AANcjs.mix32.call(void 0, id * 2654435761 >>> 0) & 2147483647)), ...u };
|
|
6016
6100
|
});
|
|
6017
|
-
this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess',
|
|
6101
|
+
this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _346 => _346.length]) ? added.map(_chunkNKTNLJUJcjs.stickerRect) : void 0);
|
|
6018
6102
|
return added.map((s) => ({ ...s }));
|
|
6019
6103
|
}
|
|
6020
6104
|
/** Brings stickers to the top (`front`) or bottom of their layer (one undo step). */
|
|
@@ -6042,14 +6126,286 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
6042
6126
|
const l = this.wetLayer(layerId, "set the stickers of");
|
|
6043
6127
|
this.commitStickers("Stickers", l, stickers.map((s) => ({ ...s })));
|
|
6044
6128
|
}
|
|
6129
|
+
// --- Live stroke layers ---------------------------------------------------------
|
|
6130
|
+
/** The document's `liveStrokes` without these layers (as a spread: `{}` when unchanged). */
|
|
6131
|
+
liveStrokesWithout(ids) {
|
|
6132
|
+
const t = this.doc.liveStrokes;
|
|
6133
|
+
if (!t || !ids.some((id) => t[id])) return {};
|
|
6134
|
+
const out = { ...t };
|
|
6135
|
+
for (const id of ids) delete out[id];
|
|
6136
|
+
return { liveStrokes: out };
|
|
6137
|
+
}
|
|
6138
|
+
liveStrokeLayer(layerId, what) {
|
|
6139
|
+
const l = this.wetLayer(layerId, what);
|
|
6140
|
+
const strokes = _optionalChain([this, 'access', _347 => _347.doc, 'access', _348 => _348.liveStrokes, 'optionalAccess', _349 => _349[l.id]]);
|
|
6141
|
+
if (!strokes) throw new PaintEditorError(`Layer "${l.name}" is not a stroke layer; add one with add_layer {type: "strokes"} (or convert_to_stroke_layer on an empty layer), then paint on it.`);
|
|
6142
|
+
return { layer: l, strokes };
|
|
6143
|
+
}
|
|
6144
|
+
/** Whether a layer is a live stroke layer. */
|
|
6145
|
+
isLiveStrokeLayer(layerId) {
|
|
6146
|
+
return Boolean(_optionalChain([this, 'access', _350 => _350.doc, 'access', _351 => _351.liveStrokes, 'optionalAccess', _352 => _352[layerId]]));
|
|
6147
|
+
}
|
|
6148
|
+
/** Makes an empty pixel layer a live stroke layer (one undo step). */
|
|
6149
|
+
convertToLiveStrokes(layerId) {
|
|
6150
|
+
this.requireIdle("converting a layer");
|
|
6151
|
+
const l = this.paintTarget(layerId, "convert");
|
|
6152
|
+
if (_optionalChain([this, 'access', _353 => _353.doc, 'access', _354 => _354.liveStrokes, 'optionalAccess', _355 => _355[l.id]])) return this.describeLayer(l);
|
|
6153
|
+
if (_optionalChain([this, 'access', _356 => _356.doc, 'access', _357 => _357.stickers, 'optionalAccess', _358 => _358[l.id], 'optionalAccess', _359 => _359.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
|
|
6154
|
+
if (_chunk474IQG74cjs.contentBounds.call(void 0, l.surface) || this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" already has paint, which isn't kept as strokes; convert an empty layer or add a stroke layer (add_layer {type: "strokes"}).`);
|
|
6155
|
+
this.commit("Convert to stroke layer", { ...this.doc, liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [l.id]: [] } });
|
|
6156
|
+
return this.describeLayer(this.getLayer(l.id));
|
|
6157
|
+
}
|
|
6158
|
+
/** A stroke layer's strokes, bottom first. */
|
|
6159
|
+
listLiveStrokes(layerId) {
|
|
6160
|
+
return this.liveStrokeLayer(layerId, "list the strokes of").strokes.map((x) => ({ ...x }));
|
|
6161
|
+
}
|
|
6162
|
+
/** The stroke layer holding a live stroke, and where. */
|
|
6163
|
+
findLiveStroke(id) {
|
|
6164
|
+
for (const [layerId, strokes] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
|
|
6165
|
+
const index = strokes.findIndex((x) => x.id === id);
|
|
6166
|
+
const layer = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _360 => _360.layer]);
|
|
6167
|
+
if (index >= 0 && isPixelLayer(layer)) return { layer, strokes, index };
|
|
6168
|
+
}
|
|
6169
|
+
const baked = this.doc.strokes.some((x) => x.id === id);
|
|
6170
|
+
throw new PaintEditorError(
|
|
6171
|
+
baked ? `Stroke "${id}" was painted on a pixel layer, so its pixels are baked; only strokes on a stroke layer can be edited (list_strokes {live: true}). Replay it onto a stroke layer (replay_strokes layerId) to edit the copy.` : `Unknown stroke "${id}". Call list_strokes {live: true} for the ids of editable strokes.`
|
|
6172
|
+
);
|
|
6173
|
+
}
|
|
6174
|
+
/**
|
|
6175
|
+
* Changes a live stroke's brush (a preset by `brushId`, keeping the stroke's size, and/or brush
|
|
6176
|
+
* settings), colour, paint or seed, and redraws its layer (one undo step). A new colour replaces
|
|
6177
|
+
* gradient or effect paint. Returns the stroke and the area that changed.
|
|
6178
|
+
*/
|
|
6179
|
+
updateStroke(id, update) {
|
|
6180
|
+
this.requireIdle("editing a stroke");
|
|
6181
|
+
const { layer, strokes, index } = this.findLiveStroke(id);
|
|
6182
|
+
const was = strokes[index];
|
|
6183
|
+
let brush = was.brush;
|
|
6184
|
+
if (update.brushId !== void 0) {
|
|
6185
|
+
const b = this.requireBrush(update.brushId);
|
|
6186
|
+
brush = _chunkNKTNLJUJcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
|
|
6187
|
+
}
|
|
6188
|
+
if (update.brush !== void 0) {
|
|
6189
|
+
if (!update.brush || typeof update.brush !== "object") throw new PaintEditorError("brush must be an object of brush settings (as set_brush takes).");
|
|
6190
|
+
brush = _chunkNKTNLJUJcjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
|
|
6191
|
+
}
|
|
6192
|
+
const why = liveStrokeRefusal(brush);
|
|
6193
|
+
if (why) throw new PaintEditorError(why);
|
|
6194
|
+
const next = { ...was, brush: _chunkNKTNLJUJcjs.brushToJSON.call(void 0, brush) };
|
|
6195
|
+
if (update.seed !== void 0) {
|
|
6196
|
+
if (!Number.isInteger(update.seed) || update.seed < 0) throw new PaintEditorError(`seed ${update.seed} must be a whole number of 0 or more.`);
|
|
6197
|
+
next.seed = update.seed;
|
|
6198
|
+
}
|
|
6199
|
+
if (update.color !== void 0) {
|
|
6200
|
+
next.color = parseColor(update.color);
|
|
6201
|
+
delete next.paint;
|
|
6202
|
+
}
|
|
6203
|
+
if (update.paint !== void 0) {
|
|
6204
|
+
if (update.paint === null) delete next.paint;
|
|
6205
|
+
else if (_chunkNKTNLJUJcjs.isPaintEffectPaint.call(void 0, update.paint)) {
|
|
6206
|
+
if (!this.effectPaintImage(update.paint)) throw new PaintEditorError(`The effect "${update.paint.effect}" is not rendered yet; render it first (prepareEffectPaints; the update_stroke tool does this).`);
|
|
6207
|
+
next.paint = JSON.parse(JSON.stringify(update.paint));
|
|
6208
|
+
} else {
|
|
6209
|
+
const p = this.readStrokePaint(update.paint);
|
|
6210
|
+
if (p.type === "color") {
|
|
6211
|
+
next.color = p.color;
|
|
6212
|
+
delete next.paint;
|
|
6213
|
+
} else next.paint = JSON.parse(JSON.stringify(p));
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
const rgb = _chunkNKTNLJUJcjs.hexToRgb8.call(void 0, next.color).map((v) => v / 255);
|
|
6217
|
+
const load = brushLoadForStroke(brush, _chunkPQ3H2AANcjs.EMPTY_MIXER_LOAD, rgb);
|
|
6218
|
+
if (load.reservoir || load.pickup) next.load = load;
|
|
6219
|
+
else delete next.load;
|
|
6220
|
+
const list = strokes.map((x, i) => i === index ? next : x);
|
|
6221
|
+
this.commitLiveStrokes("Edit stroke", layer, list, this.strokeAreas([was]));
|
|
6222
|
+
return { stroke: { ...next }, bounds: _nullishCoalesce(unionRect(this.strokeArea(was), this.strokeArea(next)), () => ( { x: 0, y: 0, width: 0, height: 0 })) };
|
|
6223
|
+
}
|
|
6224
|
+
/**
|
|
6225
|
+
* Replaces a live stroke's points, or moves, scales, rotates or flips them (`transform`, about
|
|
6226
|
+
* the stroke's centre unless an origin is given; the brush size scales too), and redraws its
|
|
6227
|
+
* layer (one undo step). Returns the stroke and the area that changed.
|
|
6228
|
+
*/
|
|
6229
|
+
editStrokePoints(id, edit) {
|
|
6230
|
+
this.requireIdle("editing a stroke");
|
|
6231
|
+
if (edit.points === void 0 === (edit.transform === void 0)) throw new PaintEditorError("Pass either points (the new pen samples) or transform (dx, dy, scale, rotate, flipX), not both.");
|
|
6232
|
+
const { layer, strokes, index } = this.findLiveStroke(id);
|
|
6233
|
+
const was = strokes[index];
|
|
6234
|
+
let next;
|
|
6235
|
+
if (edit.points !== void 0) {
|
|
6236
|
+
const points = this.checkPoints(edit.points);
|
|
6237
|
+
next = { ...was, points: points.map((p) => ({ ...p })) };
|
|
6238
|
+
} else {
|
|
6239
|
+
const t = edit.transform;
|
|
6240
|
+
if (t.scale !== void 0 && !(t.scale > 0 && t.scale <= 20)) throw new PaintEditorError(`scale ${t.scale} is out of range; use above 0 up to 20.`);
|
|
6241
|
+
for (const k of ["dx", "dy", "rotate"]) if (t[k] !== void 0 && !Number.isFinite(t[k])) throw new PaintEditorError(`${k} must be a number.`);
|
|
6242
|
+
const b = strokeBounds(was.points);
|
|
6243
|
+
const m = variationAffine(t, _nullishCoalesce(t.origin, () => ( { x: b.x + b.width / 2, y: b.y + b.height / 2 })));
|
|
6244
|
+
next = varyStroke(was, m, {});
|
|
6245
|
+
if (was.stencils) next.stencils = was.stencils;
|
|
6246
|
+
}
|
|
6247
|
+
const list = strokes.map((x, i) => i === index ? next : x);
|
|
6248
|
+
this.commitLiveStrokes("Edit stroke points", layer, list, this.strokeAreas([was]));
|
|
6249
|
+
return { stroke: { ...next }, bounds: _nullishCoalesce(unionRect(this.strokeArea(was), this.strokeArea(next)), () => ( { x: 0, y: 0, width: 0, height: 0 })) };
|
|
6250
|
+
}
|
|
6251
|
+
/** Deletes live strokes (one undo step). Returns the ids removed and the area that changed. */
|
|
6252
|
+
removeStrokes(ids) {
|
|
6253
|
+
this.requireIdle("removing strokes");
|
|
6254
|
+
if (!ids.length) throw new PaintEditorError("Pass at least one stroke id (list_strokes {live: true}).");
|
|
6255
|
+
const found = ids.map((id) => this.findLiveStroke(id));
|
|
6256
|
+
let doc = this.doc;
|
|
6257
|
+
let bounds = null;
|
|
6258
|
+
const layers = /* @__PURE__ */ new Map();
|
|
6259
|
+
for (const f of found) layers.set(f.layer.id, f.layer);
|
|
6260
|
+
for (const [layerId, layer] of layers) {
|
|
6261
|
+
const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _361 => _361.liveStrokes, 'optionalAccess', _362 => _362[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
|
|
6262
|
+
for (const x of gone) bounds = unionRect(bounds, this.strokeArea(x));
|
|
6263
|
+
doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _363 => _363.liveStrokes, 'optionalAccess', _364 => _364[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
|
|
6264
|
+
}
|
|
6265
|
+
this.commit(ids.length === 1 ? "Remove stroke" : "Remove strokes", doc);
|
|
6266
|
+
return { removed: [...ids], bounds };
|
|
6267
|
+
}
|
|
6268
|
+
/** Moves a live stroke to `index` in its layer (0 = bottom) and redraws (one undo step). Returns the new order. */
|
|
6269
|
+
reorderStroke(id, index) {
|
|
6270
|
+
this.requireIdle("reordering strokes");
|
|
6271
|
+
const { layer, strokes, index: from } = this.findLiveStroke(id);
|
|
6272
|
+
if (!Number.isInteger(index) || index < 0 || index >= strokes.length) throw new PaintEditorError(`index ${index} is out of range; the layer has ${strokes.length} strokes, so use 0..${strokes.length - 1} (0 = bottom).`);
|
|
6273
|
+
const list = [...strokes];
|
|
6274
|
+
const [moved] = list.splice(from, 1);
|
|
6275
|
+
list.splice(index, 0, moved);
|
|
6276
|
+
if (from !== index) this.commitLiveStrokes("Reorder stroke", layer, list, this.strokeAreas([moved]));
|
|
6277
|
+
return list.map((x) => x.id);
|
|
6278
|
+
}
|
|
6279
|
+
/** Turns a stroke layer into a plain pixel layer with the same pixels (one undo step). */
|
|
6280
|
+
rasterizeLiveStrokes(layerId) {
|
|
6281
|
+
this.requireIdle("rasterizing");
|
|
6282
|
+
const { layer } = this.liveStrokeLayer(layerId, "rasterize");
|
|
6283
|
+
this.commit("Rasterize stroke layer", this.withPaintEvent({ ...this.doc, ...this.liveStrokesWithout([layer.id]) }, { kind: "live-strokes", layerId: layer.id, data: { rasterized: true } }));
|
|
6284
|
+
return this.describeLayer(this.getLayer(layer.id));
|
|
6285
|
+
}
|
|
6286
|
+
/** Sets a layer's live strokes and redraws it (replays). `null` makes it a plain pixel layer. */
|
|
6287
|
+
replaceLiveStrokes(layerId, strokes) {
|
|
6288
|
+
const l = this.wetLayer(layerId, "set the strokes of");
|
|
6289
|
+
if (strokes === null) {
|
|
6290
|
+
this.commit("Rasterize stroke layer", { ...this.doc, ...this.liveStrokesWithout([l.id]) });
|
|
6291
|
+
return;
|
|
6292
|
+
}
|
|
6293
|
+
this.commitLiveStrokes("Strokes", l, strokes.map((x) => ({ ...x, layerId: l.id })));
|
|
6294
|
+
}
|
|
6295
|
+
/**
|
|
6296
|
+
* The top-most stroke of a stroke layer (default the active layer) that painted the pixel at
|
|
6297
|
+
* (x, y) document pixels, or `null`. Strokes whose area holds the point are drawn alone, top
|
|
6298
|
+
* first, until one covers it.
|
|
6299
|
+
*/
|
|
6300
|
+
liveStrokeAt(layerId, x, y) {
|
|
6301
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) throw new PaintEditorError("x and y must be numbers of document pixels.");
|
|
6302
|
+
const { layer, strokes } = this.liveStrokeLayer(layerId, "pick a stroke on");
|
|
6303
|
+
const plain = { ...layer, visible: true, locks: void 0, offset: { x: 0, y: 0 } };
|
|
6304
|
+
const doc = { ...this.doc, liveStrokes: void 0, stickers: void 0 };
|
|
6305
|
+
const px = Math.floor(x);
|
|
6306
|
+
const py = Math.floor(y);
|
|
6307
|
+
for (let i = strokes.length - 1; i >= 0; i--) {
|
|
6308
|
+
const area = this.strokeArea(strokes[i]);
|
|
6309
|
+
if (!area || px < area.x || py < area.y || px >= area.x + area.width || py >= area.y + area.height) continue;
|
|
6310
|
+
const drawn = this.drawLiveStroke(doc, plain, _chunk474IQG74cjs.emptySurface.call(void 0, 4), strokes[i]).surface;
|
|
6311
|
+
if (_chunk474IQG74cjs.readPixel.call(void 0, drawn, px, py)[3] > 24) return { ...strokes[i] };
|
|
6312
|
+
}
|
|
6313
|
+
return null;
|
|
6314
|
+
}
|
|
6315
|
+
/** Picks a stroke for the stroke panel and canvas (`null` for none). Editor state, not an undo step. */
|
|
6316
|
+
selectStroke(id) {
|
|
6317
|
+
if (id === this.selectedStroke) return;
|
|
6318
|
+
this.selectedStroke = id;
|
|
6319
|
+
this.emit([]);
|
|
6320
|
+
}
|
|
6321
|
+
/** Where a live stroke painted (document pixels), or `null`. */
|
|
6322
|
+
liveStrokeArea(id) {
|
|
6323
|
+
return this.strokeArea(this.findLiveStroke(id).strokes.find((s) => s.id === id));
|
|
6324
|
+
}
|
|
6325
|
+
/** Commits a layer's new stroke list with its redrawn pixels, recorded for replays (one undo step). */
|
|
6326
|
+
commitLiveStrokes(label, layer, list, dirty) {
|
|
6327
|
+
this.commit(label, this.withLiveStrokes(this.doc, layer, list, dirty));
|
|
6328
|
+
}
|
|
6329
|
+
withLiveStrokes(doc, layer, list, dirty) {
|
|
6330
|
+
if (_chunkHB4ICNNAcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it (update_layer locks) first.`);
|
|
6331
|
+
const current = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _365 => _365.layer]);
|
|
6332
|
+
const surface = this.drawLiveStrokes(_nullishCoalesce(current, () => ( layer)), list, dirty);
|
|
6333
|
+
const next = { ...doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, doc.layers, layer.id, (l) => ({ ...l, surface, offset: { x: 0, y: 0 } })), liveStrokes: { ..._nullishCoalesce(doc.liveStrokes, () => ( {})), [layer.id]: [...list] } };
|
|
6334
|
+
return this.withPaintEvent(next, { kind: "live-strokes", layerId: layer.id, data: { strokes: list.map((x) => JSON.parse(JSON.stringify(x))) } });
|
|
6335
|
+
}
|
|
6336
|
+
/** Where a stroke painted (document pixels): as learnt when it was painted or drawn, else an estimate from its points and brush. */
|
|
6337
|
+
strokeArea(s) {
|
|
6338
|
+
return this.paintedBounds.has(s) ? this.paintedBounds.get(s) : liveStrokeBounds(s);
|
|
6339
|
+
}
|
|
6340
|
+
/** The areas strokes painted, or `null` when one is not known (a full redraw then). */
|
|
6341
|
+
strokeAreas(strokes) {
|
|
6342
|
+
const out = [];
|
|
6343
|
+
for (const s of strokes) {
|
|
6344
|
+
if (!this.paintedBounds.has(s)) return null;
|
|
6345
|
+
const b = this.paintedBounds.get(s);
|
|
6346
|
+
if (b) out.push(b);
|
|
6347
|
+
}
|
|
6348
|
+
return out;
|
|
6349
|
+
}
|
|
6350
|
+
/** Draws one stroke onto `surface` of a plain copy of the layer; returns the result and the area it painted. */
|
|
6351
|
+
drawLiveStroke(doc, plain, surface, st) {
|
|
6352
|
+
let out = surface;
|
|
6353
|
+
const host = {
|
|
6354
|
+
update: () => {
|
|
6355
|
+
},
|
|
6356
|
+
commit: (_s, drawn, cancelled) => {
|
|
6357
|
+
if (!cancelled && drawn) out = drawn;
|
|
6358
|
+
}
|
|
6359
|
+
};
|
|
6360
|
+
const init = { layerId: plain.id, color: st.color, brush: st.brush, seed: st.seed, copies: _nullishCoalesce(st.copies, () => ( [])), ...st.load ? { load: st.load } : {}, ...st.paint ? { paint: st.paint } : {}, snapToPerspective: false, stencils: false, maskStencils: _nullishCoalesce(st.stencils, () => ( [])) };
|
|
6361
|
+
const session = this.sessionFor({ ...doc, layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, doc.layers, plain.id, () => ({ ...plain, surface })) }, init, host);
|
|
6362
|
+
session.push(st.points);
|
|
6363
|
+
const result = session.end();
|
|
6364
|
+
this.paintedBounds.set(st, result.bounds);
|
|
6365
|
+
return { surface: out, bounds: result.bounds };
|
|
6366
|
+
}
|
|
6367
|
+
/**
|
|
6368
|
+
* A stroke layer's pixels drawn from its strokes, bottom first. With `dirty` (the areas the old
|
|
6369
|
+
* strokes that changed had painted), only the tiles there and under any stroke whose area isn't
|
|
6370
|
+
* known yet are drawn again, from the strokes that reach them (a pixel depends only on the
|
|
6371
|
+
* strokes over it); the other tiles are kept. Without it, or with `null`, every stroke is drawn.
|
|
6372
|
+
*/
|
|
6373
|
+
drawLiveStrokes(layer, list, dirty) {
|
|
6374
|
+
const plain = { ...layer, visible: true, locks: void 0, offset: { x: 0, y: 0 } };
|
|
6375
|
+
const doc = { ...this.doc, liveStrokes: void 0, stickers: void 0 };
|
|
6376
|
+
const unknown = list.filter((s) => !this.paintedBounds.has(s));
|
|
6377
|
+
const partial = dirty && !layer.offset.x && !layer.offset.y && unknown.length <= 4;
|
|
6378
|
+
if (!partial) {
|
|
6379
|
+
let surface2 = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
|
|
6380
|
+
for (const st of list) surface2 = this.drawLiveStroke(doc, plain, surface2, st).surface;
|
|
6381
|
+
return surface2;
|
|
6382
|
+
}
|
|
6383
|
+
const areas = [...dirty];
|
|
6384
|
+
for (const st of unknown) {
|
|
6385
|
+
const b = this.drawLiveStroke(doc, plain, _chunk474IQG74cjs.emptySurface.call(void 0, 4), st).bounds;
|
|
6386
|
+
if (b) areas.push(b);
|
|
6387
|
+
}
|
|
6388
|
+
const { width, height } = this.doc.canvas;
|
|
6389
|
+
const rects = areas.map((r) => clipRect(r, width, height)).filter((r) => r !== null);
|
|
6390
|
+
if (!rects.length) return layer.surface;
|
|
6391
|
+
const overlaps = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
|
|
6392
|
+
let drawn = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
|
|
6393
|
+
for (const st of list) {
|
|
6394
|
+
const b = this.paintedBounds.get(st);
|
|
6395
|
+
if (b && rects.some((r) => overlaps(r, b))) drawn = this.drawLiveStroke(doc, plain, drawn, st).surface;
|
|
6396
|
+
}
|
|
6397
|
+
let surface = layer.surface;
|
|
6398
|
+
for (const r of rects) surface = _chunk474IQG74cjs.writeRegion.call(void 0, surface, r, _chunk474IQG74cjs.readRegion.call(void 0, drawn, r));
|
|
6399
|
+
return surface;
|
|
6400
|
+
}
|
|
6045
6401
|
// --- Stencils --------------------------------------------------------------------
|
|
6046
|
-
|
|
6047
|
-
|
|
6402
|
+
__init116() {this.stencilCache = null}
|
|
6403
|
+
__init117() {this.nextStencilId = 1}
|
|
6048
6404
|
/** The mask stencils' coverage over the canvas (cached), or `null` when none masks. */
|
|
6049
6405
|
stencilSelection(stencils = this.guides.stencils) {
|
|
6050
6406
|
const { width, height } = this.doc.canvas;
|
|
6051
6407
|
const size = `${width}x${height}`;
|
|
6052
|
-
if (_optionalChain([this, 'access',
|
|
6408
|
+
if (_optionalChain([this, 'access', _366 => _366.stencilCache, 'optionalAccess', _367 => _367.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
|
|
6053
6409
|
const mask = stencilMask(stencils, width, height);
|
|
6054
6410
|
this.stencilCache = { key: stencils, size, mask };
|
|
6055
6411
|
return mask;
|
|
@@ -6111,7 +6467,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
6111
6467
|
makeSwatch(color, name) {
|
|
6112
6468
|
const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
|
|
6113
6469
|
const out = { color: _chunkPQ3H2AANcjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
|
|
6114
|
-
if (_optionalChain([name, 'optionalAccess',
|
|
6470
|
+
if (_optionalChain([name, 'optionalAccess', _368 => _368.trim, 'call', _369 => _369()])) out.name = name.trim();
|
|
6115
6471
|
if (p.type === "gradient") out.paint = p;
|
|
6116
6472
|
return out;
|
|
6117
6473
|
}
|
|
@@ -6163,7 +6519,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
6163
6519
|
* mix becomes the paint colour. Returns the mixed colour and the pile's bounds.
|
|
6164
6520
|
*/
|
|
6165
6521
|
mixOnPad(paints, options = {}) {
|
|
6166
|
-
const parsed = (_nullishCoalesce(paints, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess',
|
|
6522
|
+
const parsed = (_nullishCoalesce(paints, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _370 => _370.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _371 => _371.parts]) }));
|
|
6167
6523
|
let r;
|
|
6168
6524
|
try {
|
|
6169
6525
|
r = this.pad.mix(parsed, options);
|
|
@@ -6252,13 +6608,24 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
6252
6608
|
}
|
|
6253
6609
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
6254
6610
|
layerSurface(id) {
|
|
6255
|
-
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess',
|
|
6611
|
+
const l = _optionalChain([_chunkHB4ICNNAcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _372 => _372.layer]);
|
|
6256
6612
|
return isPixelLayer(l) ? l.surface : null;
|
|
6257
6613
|
}
|
|
6258
6614
|
}, _class10.__initStatic(), _class10);
|
|
6259
6615
|
var MAX_IMAGE_SIDE = 8192;
|
|
6260
6616
|
var movePoint = (p, dx, dy) => ({ x: p.x + dx, y: p.y + dy });
|
|
6261
6617
|
var moveRect = (r, dx, dy) => ({ ...r, x: r.x + dx, y: r.y + dy });
|
|
6618
|
+
function clipRect(r, width, height) {
|
|
6619
|
+
const x0 = Math.max(0, Math.floor(r.x));
|
|
6620
|
+
const y0 = Math.max(0, Math.floor(r.y));
|
|
6621
|
+
const x1 = Math.min(width, Math.ceil(r.x + r.width));
|
|
6622
|
+
const y1 = Math.min(height, Math.ceil(r.y + r.height));
|
|
6623
|
+
return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;
|
|
6624
|
+
}
|
|
6625
|
+
function withLiveStroke(doc, stroke) {
|
|
6626
|
+
const list = _optionalChain([doc, 'access', _373 => _373.liveStrokes, 'optionalAccess', _374 => _374[stroke.layerId]]);
|
|
6627
|
+
return list ? { ...doc, liveStrokes: { ...doc.liveStrokes, [stroke.layerId]: [...list, stroke] } } : doc;
|
|
6628
|
+
}
|
|
6262
6629
|
function shiftDocument(doc, dx, dy) {
|
|
6263
6630
|
if (!dx && !dy) return doc;
|
|
6264
6631
|
let layers = doc.layers;
|
|
@@ -6275,11 +6642,18 @@ function shiftDocument(doc, dx, dy) {
|
|
|
6275
6642
|
return s.stencils ? { ...moved, stencils: s.stencils.map((x) => translateStencil(x, dx, dy)) } : moved;
|
|
6276
6643
|
})
|
|
6277
6644
|
};
|
|
6645
|
+
const moveStroke = (s) => {
|
|
6646
|
+
const moved = varyStroke(s, m, {});
|
|
6647
|
+
return s.stencils ? { ...moved, stencils: s.stencils.map((x) => translateStencil(x, dx, dy)) } : moved;
|
|
6648
|
+
};
|
|
6278
6649
|
if (doc.stickers) out.stickers = Object.fromEntries(Object.entries(doc.stickers).map(([id, list]) => [id, moveStickers(list)]));
|
|
6650
|
+
if (doc.liveStrokes) out.liveStrokes = Object.fromEntries(Object.entries(doc.liveStrokes).map(([id, list]) => [id, list.map(moveStroke)]));
|
|
6279
6651
|
if (doc.paintEvents) {
|
|
6280
6652
|
out.paintEvents = doc.paintEvents.map((e) => {
|
|
6281
|
-
const list = e.kind === "stickers" ? _optionalChain([e, 'access',
|
|
6282
|
-
|
|
6653
|
+
const list = e.kind === "stickers" ? _optionalChain([e, 'access', _375 => _375.data, 'optionalAccess', _376 => _376.stickers]) : void 0;
|
|
6654
|
+
if (list) return { ...e, data: { ...e.data, stickers: moveStickers(list) } };
|
|
6655
|
+
const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _377 => _377.data, 'optionalAccess', _378 => _378.strokes]) : void 0;
|
|
6656
|
+
return strokes ? { ...e, data: { ...e.data, strokes: strokes.map(moveStroke) } } : e;
|
|
6283
6657
|
});
|
|
6284
6658
|
}
|
|
6285
6659
|
if (doc.wetEvents) {
|
|
@@ -6360,8 +6734,8 @@ function strokeSchedule(points) {
|
|
|
6360
6734
|
return total > 0 ? acc.map((d) => d / total) : points.map(() => 1);
|
|
6361
6735
|
}
|
|
6362
6736
|
function strokeDuration(points, max = 1800) {
|
|
6363
|
-
const t0 = _optionalChain([points, 'access',
|
|
6364
|
-
const t1 = _optionalChain([points, 'access',
|
|
6737
|
+
const t0 = _optionalChain([points, 'access', _379 => _379[0], 'optionalAccess', _380 => _380.t]);
|
|
6738
|
+
const t1 = _optionalChain([points, 'access', _381 => _381[points.length - 1], 'optionalAccess', _382 => _382.t]);
|
|
6365
6739
|
let ms;
|
|
6366
6740
|
if (points.every((p) => Number.isFinite(p.t)) && t1 > t0) ms = t1 - t0;
|
|
6367
6741
|
else {
|
|
@@ -6415,7 +6789,7 @@ var PaintDirector = class {
|
|
|
6415
6789
|
}
|
|
6416
6790
|
where(id) {
|
|
6417
6791
|
const a = this.presence.get(id);
|
|
6418
|
-
return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess',
|
|
6792
|
+
return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _383 => _383.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _384 => _384.y]), () => ( 0)) };
|
|
6419
6793
|
}
|
|
6420
6794
|
/** Glides to `to`; an actor that just appeared starts there instead of the corner. */
|
|
6421
6795
|
async glide(id, to, ms = 380) {
|
|
@@ -6462,8 +6836,8 @@ var PaintDirector = class {
|
|
|
6462
6836
|
}
|
|
6463
6837
|
case "replay": {
|
|
6464
6838
|
await this.say(id, command.note, 500);
|
|
6465
|
-
const source = c.getStrokes().filter((s) => _optionalChain([command, 'access',
|
|
6466
|
-
const first = _optionalChain([source, 'access',
|
|
6839
|
+
const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _385 => _385.replay, 'access', _386 => _386.strokeIds, 'optionalAccess', _387 => _387.includes, 'call', _388 => _388(s.id)]));
|
|
6840
|
+
const first = _optionalChain([source, 'access', _389 => _389[0], 'optionalAccess', _390 => _390.points, 'access', _391 => _391[0]]);
|
|
6467
6841
|
if (first) await this.glide(id, first);
|
|
6468
6842
|
const result = c.replayStrokes(command.replay);
|
|
6469
6843
|
if (result.bounds) await this.glide(id, centre(result.bounds), 520);
|
|
@@ -7899,12 +8273,12 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7899
8273
|
add({
|
|
7900
8274
|
name: "add_layer",
|
|
7901
8275
|
title: "Add a layer",
|
|
7902
|
-
description: "Adds an empty pixel layer
|
|
8276
|
+
description: "Adds an empty pixel layer, a group, or a stroke layer (type strokes: its strokes stay editable with update_stroke and edit_stroke_points) above the active layer, or above aboveId, or at the top of parentId; it becomes the active layer. One undo step. Returns the layer (liveStrokes: its stroke count, for a stroke layer).",
|
|
7903
8277
|
inputSchema: {
|
|
7904
8278
|
type: "object",
|
|
7905
8279
|
properties: {
|
|
7906
8280
|
name: { type: "string", minLength: 1, description: 'Layer name (default "Layer n").' },
|
|
7907
|
-
type: { type: "string", enum: ["pixel", "group"], description: "pixel (default) or
|
|
8281
|
+
type: { type: "string", enum: ["pixel", "group", "strokes"], description: "pixel (default), group, or strokes: a live stroke layer whose pixels are drawn from its strokes, so each stays editable. It takes dab, particle, bristle and Mixer Brush strokes that pick up no paint." },
|
|
7908
8282
|
aboveId: { type: "string", description: "Put it directly above this layer (default the active layer)." },
|
|
7909
8283
|
parentId: { type: "string", description: "Put it at the top of this group instead." }
|
|
7910
8284
|
},
|
|
@@ -8059,7 +8433,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
8059
8433
|
annotations: { title: "List brushes", ...READ6 },
|
|
8060
8434
|
handler: () => {
|
|
8061
8435
|
const s = c.getState();
|
|
8062
|
-
return { activeBrushId: s.brush.id, activeEdited: !s.brush.builtin && Boolean(_optionalChain([c, 'access',
|
|
8436
|
+
return { activeBrushId: s.brush.id, activeEdited: !s.brush.builtin && Boolean(_optionalChain([c, 'access', _392 => _392.getBrush, 'call', _393 => _393(s.brush.id), 'optionalAccess', _394 => _394.builtin])), brushes: s.brushes.map(brushSummary) };
|
|
8063
8437
|
}
|
|
8064
8438
|
});
|
|
8065
8439
|
add({
|
|
@@ -8266,44 +8640,156 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
8266
8640
|
add({
|
|
8267
8641
|
name: "list_strokes",
|
|
8268
8642
|
title: "List recorded strokes",
|
|
8269
|
-
description: "Lists the recorded strokes, oldest first (every stroke is kept as data): id, layer, brush id and name, colour, point count, bounds and
|
|
8643
|
+
description: "Lists the recorded strokes, oldest first (every stroke is kept as data): id, layer, brush id and name, colour, point count, bounds, seed and whether it is live. With ids, also the points. Use the ids with replay_strokes. With live true, lists the strokes of stroke layers as they are now, bottom first: the ones update_stroke, edit_stroke_points, reorder_stroke and remove_strokes change.",
|
|
8270
8644
|
inputSchema: {
|
|
8271
8645
|
type: "object",
|
|
8272
8646
|
properties: {
|
|
8273
8647
|
ids: { type: "array", items: { type: "string", description: "Stroke id." }, description: "Only these strokes, with their points." },
|
|
8274
|
-
last: { type: "integer", minimum: 1, maximum: 1e3, description: "Only the most recent n strokes (default 100)." }
|
|
8648
|
+
last: { type: "integer", minimum: 1, maximum: 1e3, description: "Only the most recent n strokes (default 100)." },
|
|
8649
|
+
live: { type: "boolean", description: "Only the editable strokes of stroke layers, as they are now, bottom first (default false: the whole recorded history)." },
|
|
8650
|
+
layerId: { type: "string", description: "Only strokes of this layer." }
|
|
8275
8651
|
},
|
|
8276
8652
|
additionalProperties: false
|
|
8277
8653
|
},
|
|
8278
8654
|
annotations: { title: "List recorded strokes", ...READ6 },
|
|
8279
8655
|
coordinates: { out: ["strokes[].bounds", "strokes[].points[]"] },
|
|
8280
|
-
handler: ({ ids, last }) => {
|
|
8281
|
-
|
|
8656
|
+
handler: ({ ids, last, live, layerId }) => {
|
|
8657
|
+
if (layerId !== void 0 && !c.getLayer(layerId)) throw new Error(`Unknown layer "${layerId}". Call list_layers for the ids.`);
|
|
8658
|
+
const liveAll = Object.values(_nullishCoalesce(c.document.liveStrokes, () => ( {}))).flat();
|
|
8659
|
+
const liveIds = new Set(liveAll.map((s) => s.id));
|
|
8660
|
+
let all = live ? liveAll : c.getStrokes();
|
|
8661
|
+
if (layerId !== void 0) all = all.filter((s) => s.layerId === layerId);
|
|
8282
8662
|
const picked = ids ? all.filter((s) => ids.includes(s.id)) : all.slice(-(_nullishCoalesce(last, () => ( 100))));
|
|
8283
8663
|
if (ids) {
|
|
8284
8664
|
for (const id of ids) if (!all.some((s) => s.id === id)) throw new Error(`Unknown stroke "${id}". Call list_strokes without ids for the ids.`);
|
|
8285
8665
|
}
|
|
8286
|
-
return {
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8666
|
+
return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _395 => _395.document, 'access', _396 => _396.liveStrokes, 'optionalAccess', _397 => _397[s.layerId], 'optionalAccess', _398 => _398.includes, 'call', _399 => _399(s)]) === true)) };
|
|
8667
|
+
}
|
|
8668
|
+
});
|
|
8669
|
+
add({
|
|
8670
|
+
name: "stroke_at",
|
|
8671
|
+
title: "Find the stroke at a point",
|
|
8672
|
+
description: "Returns the top-most stroke of a stroke layer that painted the pixel at a point (document pixels), or stroke null when none did, so you can pick one stroke among overlapping ones before update_stroke, edit_stroke_points or remove_strokes. Changes nothing.",
|
|
8673
|
+
inputSchema: {
|
|
8674
|
+
type: "object",
|
|
8675
|
+
properties: {
|
|
8676
|
+
layerId: { type: "string", description: "Stroke layer id from list_layers (default the active layer)." },
|
|
8677
|
+
x: { type: "number", description: "Point x in document pixels." },
|
|
8678
|
+
y: { type: "number", description: "Point y in document pixels." }
|
|
8679
|
+
},
|
|
8680
|
+
required: ["x", "y"],
|
|
8681
|
+
additionalProperties: false
|
|
8682
|
+
},
|
|
8683
|
+
annotations: { title: "Find the stroke at a point", ...READ6 },
|
|
8684
|
+
coordinates: { in: [""], out: ["stroke.bounds"] },
|
|
8685
|
+
handler: ({ layerId, x, y }) => {
|
|
8686
|
+
const s = c.liveStrokeAt(layerId, x, y);
|
|
8687
|
+
return { stroke: s ? strokeSummary(s, false, true) : null };
|
|
8305
8688
|
}
|
|
8306
8689
|
});
|
|
8690
|
+
add({
|
|
8691
|
+
name: "update_stroke",
|
|
8692
|
+
title: "Change a stroke",
|
|
8693
|
+
description: "Changes a stroke on a stroke layer after it was painted: another brush preset (brushId, keeping the stroke size), brush settings (as set_brush takes), colour (replaces gradient paint), paint, or seed, then redraws the layer exactly. Ids come from list_strokes {live: true}. Refuses brushes a stroke layer cannot redraw (wet, impasto, sticker, eraser, smudge, blender, pick-up). One undo step. Returns the stroke and the area that changed.",
|
|
8694
|
+
inputSchema: {
|
|
8695
|
+
type: "object",
|
|
8696
|
+
properties: {
|
|
8697
|
+
id: { type: "string", description: "Stroke id from list_strokes {live: true}." },
|
|
8698
|
+
brushId: { type: "string", description: "Brush preset id from list_brushes; the stroke keeps its size." },
|
|
8699
|
+
brush: { type: "object", properties: BRUSH_FIELDS, additionalProperties: false, description: "Brush settings to change on top of brushId or the stroke\u2019s brush; missing fields keep their values." },
|
|
8700
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "New colour #rrggbb (replaces gradient paint)." },
|
|
8701
|
+
paint: { anyOf: [_chunkPQ3H2AANcjs.PAINT_SOURCE_JSON_SCHEMA, { type: "null", description: "Back to the stroke\u2019s plain colour." }], description: "A colour or gradient paint for the stroke; null drops its gradient." },
|
|
8702
|
+
seed: { type: "integer", minimum: 0, description: "Another jitter seed: particles, scatter and texture fall differently." }
|
|
8703
|
+
},
|
|
8704
|
+
required: ["id"],
|
|
8705
|
+
additionalProperties: false
|
|
8706
|
+
},
|
|
8707
|
+
annotations: { title: "Change a stroke", ...WRITE5 },
|
|
8708
|
+
coordinates: { out: ["bounds", "stroke.bounds"] },
|
|
8709
|
+
handler: ({ id, ...update }) => {
|
|
8710
|
+
if (!Object.keys(update).length) throw new Error("Pass at least one change: brushId, brush, color, paint or seed.");
|
|
8711
|
+
const r = c.updateStroke(id, update);
|
|
8712
|
+
return { stroke: strokeSummary(r.stroke, false, true), bounds: r.bounds };
|
|
8713
|
+
}
|
|
8714
|
+
});
|
|
8715
|
+
add({
|
|
8716
|
+
name: "edit_stroke_points",
|
|
8717
|
+
title: "Move or reshape a stroke",
|
|
8718
|
+
description: "Replaces a stroke\u2019s points (points, document pixels), or moves, scales, rotates or flips it (transform, about its centre unless origin is given; the brush size scales with it), then redraws its stroke layer exactly. Pass one of points or transform. One undo step. Returns the stroke with its points and the area that changed.",
|
|
8719
|
+
inputSchema: {
|
|
8720
|
+
type: "object",
|
|
8721
|
+
properties: {
|
|
8722
|
+
id: { type: "string", description: "Stroke id from list_strokes {live: true}." },
|
|
8723
|
+
points: POINTS,
|
|
8724
|
+
transform: {
|
|
8725
|
+
type: "object",
|
|
8726
|
+
description: "A move, scale, rotation or flip of the whole stroke.",
|
|
8727
|
+
properties: {
|
|
8728
|
+
dx: { type: "number", description: "Move right by this many pixels (default 0)." },
|
|
8729
|
+
dy: { type: "number", description: "Move down by this many pixels (default 0)." },
|
|
8730
|
+
scale: { type: "number", exclusiveMinimum: 0, maximum: 20, description: "Scale about the origin; brush size scales too (default 1)." },
|
|
8731
|
+
rotate: { type: "number", minimum: -360, maximum: 360, description: "Rotate about the origin, degrees clockwise (default 0)." },
|
|
8732
|
+
flipX: { type: "boolean", description: "Mirror left to right about the origin (default false)." },
|
|
8733
|
+
origin: { type: "object", description: "Centre for scale, rotate and flip (default the centre of the stroke).", properties: { x: { type: "number", description: "Document x." }, y: { type: "number", description: "Document y." } }, required: ["x", "y"], additionalProperties: false }
|
|
8734
|
+
},
|
|
8735
|
+
additionalProperties: false
|
|
8736
|
+
}
|
|
8737
|
+
},
|
|
8738
|
+
required: ["id"],
|
|
8739
|
+
additionalProperties: false
|
|
8740
|
+
},
|
|
8741
|
+
annotations: { title: "Move or reshape a stroke", ...WRITE5 },
|
|
8742
|
+
coordinates: { in: ["points[]", "transform.origin"], out: ["bounds", "stroke.bounds", "stroke.points[]"] },
|
|
8743
|
+
handler: ({ id, points, transform }) => {
|
|
8744
|
+
const r = c.editStrokePoints(id, { points, transform });
|
|
8745
|
+
return { stroke: strokeSummary(r.stroke, true, true), bounds: r.bounds };
|
|
8746
|
+
}
|
|
8747
|
+
});
|
|
8748
|
+
add({
|
|
8749
|
+
name: "reorder_stroke",
|
|
8750
|
+
title: "Move a stroke up or down",
|
|
8751
|
+
description: "Moves a stroke to index in its stroke layer (0 = bottom, drawn first) and redraws the layer. One undo step. Returns the new order of ids, bottom first.",
|
|
8752
|
+
inputSchema: {
|
|
8753
|
+
type: "object",
|
|
8754
|
+
properties: { id: { type: "string", description: "Stroke id from list_strokes {live: true}." }, index: { type: "integer", minimum: 0, description: "New position, 0 = bottom." } },
|
|
8755
|
+
required: ["id", "index"],
|
|
8756
|
+
additionalProperties: false
|
|
8757
|
+
},
|
|
8758
|
+
annotations: { title: "Move a stroke up or down", ...WRITE5 },
|
|
8759
|
+
handler: ({ id, index }) => ({ order: c.reorderStroke(id, index) })
|
|
8760
|
+
});
|
|
8761
|
+
add({
|
|
8762
|
+
name: "remove_strokes",
|
|
8763
|
+
title: "Delete strokes",
|
|
8764
|
+
description: "Deletes strokes from their stroke layers (the eraser of a stroke layer) and redraws them. All checked first; one undo step. Returns the ids removed and the area that changed.",
|
|
8765
|
+
inputSchema: {
|
|
8766
|
+
type: "object",
|
|
8767
|
+
properties: { ids: { type: "array", minItems: 1, items: { type: "string", description: "Stroke id." }, description: "Stroke ids from list_strokes {live: true}." } },
|
|
8768
|
+
required: ["ids"],
|
|
8769
|
+
additionalProperties: false
|
|
8770
|
+
},
|
|
8771
|
+
annotations: { title: "Delete strokes", ...DESTRUCTIVE3 },
|
|
8772
|
+
coordinates: { out: ["bounds"] },
|
|
8773
|
+
handler: ({ ids }) => c.removeStrokes(ids)
|
|
8774
|
+
});
|
|
8775
|
+
add({
|
|
8776
|
+
name: "convert_to_stroke_layer",
|
|
8777
|
+
title: "Make a layer a stroke layer",
|
|
8778
|
+
description: 'Makes an empty pixel layer a stroke layer, so strokes painted on it stay editable. Refuses a layer with paint (add_layer {type: "strokes"} instead). One undo step. Returns the layer.',
|
|
8779
|
+
inputSchema: { type: "object", properties: { layerId: { type: "string", description: "Layer id from list_layers (default the active layer)." } }, additionalProperties: false },
|
|
8780
|
+
annotations: { title: "Make a layer a stroke layer", ...WRITE5 },
|
|
8781
|
+
coordinates: { out: ["bounds"] },
|
|
8782
|
+
handler: ({ layerId }) => c.convertToLiveStrokes(layerId)
|
|
8783
|
+
});
|
|
8784
|
+
add({
|
|
8785
|
+
name: "rasterize_stroke_layer",
|
|
8786
|
+
title: "Rasterize a stroke layer",
|
|
8787
|
+
description: "Turns a stroke layer into a plain pixel layer with the same pixels: its strokes stop being editable, and erasers, smudges and fills work on it. One undo step. Returns the layer.",
|
|
8788
|
+
inputSchema: { type: "object", properties: { layerId: { type: "string", description: "Stroke layer id from list_layers (default the active layer)." } }, additionalProperties: false },
|
|
8789
|
+
annotations: { title: "Rasterize a stroke layer", ...DESTRUCTIVE3 },
|
|
8790
|
+
coordinates: { out: ["bounds"] },
|
|
8791
|
+
handler: ({ layerId }) => c.rasterizeLiveStrokes(layerId)
|
|
8792
|
+
});
|
|
8307
8793
|
add({
|
|
8308
8794
|
name: "replay_strokes",
|
|
8309
8795
|
title: "Replay strokes, varied",
|
|
@@ -8465,44 +8951,62 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
8465
8951
|
}
|
|
8466
8952
|
function hostTool({ coordinates, ...tool }, { origin, onChange }) {
|
|
8467
8953
|
if (!origin && !onChange) return tool;
|
|
8468
|
-
const write = !_optionalChain([tool, 'access',
|
|
8954
|
+
const write = !_optionalChain([tool, 'access', _400 => _400.annotations, 'optionalAccess', _401 => _401.readOnlyHint]);
|
|
8469
8955
|
const done = (result) => {
|
|
8470
|
-
if (write) _optionalChain([onChange, 'optionalCall',
|
|
8471
|
-
return origin && _optionalChain([coordinates, 'optionalAccess',
|
|
8956
|
+
if (write) _optionalChain([onChange, 'optionalCall', _402 => _402({ tool: tool.name })]);
|
|
8957
|
+
return origin && _optionalChain([coordinates, 'optionalAccess', _403 => _403.out]) ? fromDocument(result, coordinates.out, origin) : result;
|
|
8472
8958
|
};
|
|
8473
8959
|
return {
|
|
8474
8960
|
...tool,
|
|
8475
8961
|
...origin ? { description: hostedText(_nullishCoalesce(tool.description, () => ( ""))), inputSchema: hostedSchema(tool.inputSchema) } : {},
|
|
8476
8962
|
handler: (args, context) => {
|
|
8477
|
-
const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess',
|
|
8963
|
+
const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _404 => _404.in]) ? toDocument(args, coordinates.in, origin) : args, context);
|
|
8478
8964
|
return r instanceof Promise ? r.then(done) : done(r);
|
|
8479
8965
|
}
|
|
8480
8966
|
};
|
|
8481
8967
|
}
|
|
8968
|
+
function strokeSummary(s, withPoints, live) {
|
|
8969
|
+
const xs = s.points.map((p) => p.x);
|
|
8970
|
+
const ys = s.points.map((p) => p.y);
|
|
8971
|
+
const pad = s.brush.tip.size / 2;
|
|
8972
|
+
return {
|
|
8973
|
+
id: s.id,
|
|
8974
|
+
layerId: s.layerId,
|
|
8975
|
+
brushId: s.brush.id,
|
|
8976
|
+
brushName: s.brush.name,
|
|
8977
|
+
color: s.color,
|
|
8978
|
+
points: withPoints ? s.points : s.points.length,
|
|
8979
|
+
seed: s.seed,
|
|
8980
|
+
copies: _nullishCoalesce(_optionalChain([s, 'access', _405 => _405.copies, 'optionalAccess', _406 => _406.length]), () => ( 0)),
|
|
8981
|
+
live,
|
|
8982
|
+
bounds: { x: Math.floor(Math.min(...xs) - pad), y: Math.floor(Math.min(...ys) - pad), width: Math.ceil(Math.max(...xs) - Math.min(...xs) + 2 * pad), height: Math.ceil(Math.max(...ys) - Math.min(...ys) + 2 * pad) }
|
|
8983
|
+
};
|
|
8984
|
+
}
|
|
8482
8985
|
|
|
8483
8986
|
// src/paint-editor/ui.ts
|
|
8484
8987
|
var PAINT_TOOLS = [
|
|
8485
8988
|
{ id: "brush", label: "Brush", key: "b" },
|
|
8486
8989
|
{ id: "eyedropper", label: "Eyedropper", key: "i" },
|
|
8487
8990
|
{ id: "sticker", label: "Stickers", key: "s" },
|
|
8991
|
+
{ id: "stroke", label: "Select stroke", key: "v" },
|
|
8488
8992
|
{ id: "pan", label: "Pan", key: "h" },
|
|
8489
8993
|
{ id: "rotate", label: "Rotate view", key: "r" }
|
|
8490
8994
|
];
|
|
8491
8995
|
var PaintGesture = (_class11 = class {
|
|
8492
|
-
constructor(controller, box) {;_class11.prototype.
|
|
8996
|
+
constructor(controller, box) {;_class11.prototype.__init118.call(this);_class11.prototype.__init119.call(this);_class11.prototype.__init120.call(this);_class11.prototype.__init121.call(this);_class11.prototype.__init122.call(this);_class11.prototype.__init123.call(this);
|
|
8493
8997
|
this.controller = controller;
|
|
8494
8998
|
this.box = box;
|
|
8495
8999
|
}
|
|
8496
9000
|
|
|
8497
9001
|
|
|
8498
|
-
|
|
9002
|
+
__init118() {this.tool = "brush"}
|
|
8499
9003
|
/** The last refusal (a hidden or locked layer), for the editor to show. */
|
|
8500
|
-
|
|
9004
|
+
__init119() {this.error = null}
|
|
8501
9005
|
/** The predicted tail of the current stroke in document pixels (draw it as a thin preview). */
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
9006
|
+
__init120() {this.predicted = []}
|
|
9007
|
+
__init121() {this.mode = null}
|
|
9008
|
+
__init122() {this.penAt = null}
|
|
9009
|
+
__init123() {this.penDown = false}
|
|
8506
9010
|
doc(e) {
|
|
8507
9011
|
const b = this.box();
|
|
8508
9012
|
const s = this.controller.getState();
|
|
@@ -8533,6 +9037,7 @@ var PaintGesture = (_class11 = class {
|
|
|
8533
9037
|
this.mode = { kind: "rotate", pointerId: e.pointerId, angle: Math.atan2(e.clientY - b.top - b.height / 2, e.clientX - b.left - b.width / 2), rotation: this.controller.getState().view.rotation };
|
|
8534
9038
|
return true;
|
|
8535
9039
|
}
|
|
9040
|
+
if (tool === "stroke") return this.strokeDown(e);
|
|
8536
9041
|
if (tool === "eyedropper" || e.altKey) {
|
|
8537
9042
|
this.pick(e);
|
|
8538
9043
|
return false;
|
|
@@ -8549,6 +9054,34 @@ var PaintGesture = (_class11 = class {
|
|
|
8549
9054
|
return false;
|
|
8550
9055
|
}
|
|
8551
9056
|
}
|
|
9057
|
+
/**
|
|
9058
|
+
* The Select stroke tool, on a stroke layer: pressing a stroke picks it and dragging moves it
|
|
9059
|
+
* (one undo step at the drop); pressing where no stroke painted clears the pick.
|
|
9060
|
+
*/
|
|
9061
|
+
strokeDown(e) {
|
|
9062
|
+
const p = this.doc(e);
|
|
9063
|
+
const s = this.controller.getState();
|
|
9064
|
+
const layerId = s.document.activeLayerId;
|
|
9065
|
+
if (!layerId || !_optionalChain([s, 'access', _407 => _407.document, 'access', _408 => _408.liveStrokes, 'optionalAccess', _409 => _409[layerId]])) {
|
|
9066
|
+
this.error = "Pick a stroke layer in the Layers panel (or add one) to select its strokes.";
|
|
9067
|
+
return false;
|
|
9068
|
+
}
|
|
9069
|
+
try {
|
|
9070
|
+
const hit = this.controller.liveStrokeAt(layerId, p.x, p.y);
|
|
9071
|
+
this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _410 => _410.id]), () => ( null)));
|
|
9072
|
+
if (!hit) return false;
|
|
9073
|
+
this.mode = { kind: "move-stroke", pointerId: e.pointerId, id: hit.id, from: p, to: p };
|
|
9074
|
+
return true;
|
|
9075
|
+
} catch (err) {
|
|
9076
|
+
this.error = err instanceof Error ? err.message : String(err);
|
|
9077
|
+
return false;
|
|
9078
|
+
}
|
|
9079
|
+
}
|
|
9080
|
+
/** While a stroke is dragged: how far it has moved (document pixels), to draw its outline there. */
|
|
9081
|
+
get strokeDrag() {
|
|
9082
|
+
const m = this.mode;
|
|
9083
|
+
return _optionalChain([m, 'optionalAccess', _411 => _411.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
|
|
9084
|
+
}
|
|
8552
9085
|
/**
|
|
8553
9086
|
* The Stickers tool: pressing a sticker picks it and dragging moves it (one undo step at the
|
|
8554
9087
|
* drop); pressing anywhere else places the active brush's first stamp there, at its tip size and
|
|
@@ -8594,6 +9127,10 @@ var PaintGesture = (_class11 = class {
|
|
|
8594
9127
|
this.controller.setView({ rotation: r });
|
|
8595
9128
|
return;
|
|
8596
9129
|
}
|
|
9130
|
+
if (m.kind === "move-stroke") {
|
|
9131
|
+
m.to = this.doc(e);
|
|
9132
|
+
return;
|
|
9133
|
+
}
|
|
8597
9134
|
if (m.kind === "sticker") {
|
|
8598
9135
|
const p = this.doc(e);
|
|
8599
9136
|
m.at = { x: round2(p.x + m.dx), y: round2(p.y + m.dy) };
|
|
@@ -8617,7 +9154,18 @@ var PaintGesture = (_class11 = class {
|
|
|
8617
9154
|
if (!m || m.pointerId !== e.pointerId) return;
|
|
8618
9155
|
this.mode = null;
|
|
8619
9156
|
this.predicted = [];
|
|
8620
|
-
if (m.kind === "stroke") _optionalChain([this, 'access',
|
|
9157
|
+
if (m.kind === "stroke") _optionalChain([this, 'access', _412 => _412.controller, 'access', _413 => _413.activeStroke, 'optionalAccess', _414 => _414.end, 'call', _415 => _415()]);
|
|
9158
|
+
if (m.kind === "move-stroke") {
|
|
9159
|
+
const dx = Math.round((this.doc(e).x - m.from.x) * 100) / 100;
|
|
9160
|
+
const dy = Math.round((this.doc(e).y - m.from.y) * 100) / 100;
|
|
9161
|
+
if (dx || dy) {
|
|
9162
|
+
try {
|
|
9163
|
+
this.controller.editStrokePoints(m.id, { transform: { dx, dy } });
|
|
9164
|
+
} catch (err) {
|
|
9165
|
+
this.error = err instanceof Error ? err.message : String(err);
|
|
9166
|
+
}
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
8621
9169
|
if (m.kind === "sticker" && m.at) {
|
|
8622
9170
|
try {
|
|
8623
9171
|
this.controller.updateSticker(void 0, m.id, m.at);
|
|
@@ -8630,8 +9178,8 @@ var PaintGesture = (_class11 = class {
|
|
|
8630
9178
|
cancel() {
|
|
8631
9179
|
this.penDown = false;
|
|
8632
9180
|
this.predicted = [];
|
|
8633
|
-
if (_optionalChain([this, 'access',
|
|
8634
|
-
if (_optionalChain([this, 'access',
|
|
9181
|
+
if (_optionalChain([this, 'access', _416 => _416.mode, 'optionalAccess', _417 => _417.kind]) === "stroke") _optionalChain([this, 'access', _418 => _418.controller, 'access', _419 => _419.activeStroke, 'optionalAccess', _420 => _420.cancel, 'call', _421 => _421()]);
|
|
9182
|
+
if (_optionalChain([this, 'access', _422 => _422.mode, 'optionalAccess', _423 => _423.kind]) === "sticker") this.controller.cancelStickerPreview();
|
|
8635
9183
|
this.mode = null;
|
|
8636
9184
|
}
|
|
8637
9185
|
get active() {
|
|
@@ -8693,13 +9241,13 @@ function handlePaintShortcut(controller, gesture, e) {
|
|
|
8693
9241
|
return false;
|
|
8694
9242
|
}
|
|
8695
9243
|
var PaintCanvasPresenter = (_class12 = class {
|
|
8696
|
-
constructor(controller) {;_class12.prototype.
|
|
9244
|
+
constructor(controller) {;_class12.prototype.__init124.call(this);_class12.prototype.__init125.call(this);_class12.prototype.__init126.call(this);
|
|
8697
9245
|
this.controller = controller;
|
|
8698
9246
|
}
|
|
8699
9247
|
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
9248
|
+
__init124() {this.uploaded = /* @__PURE__ */ new Map()}
|
|
9249
|
+
__init125() {this.scratch = null}
|
|
9250
|
+
__init126() {this.size = ""}
|
|
8703
9251
|
/** Draws what changed into `ctx` (a canvas the size of the document); returns the tiles drawn. */
|
|
8704
9252
|
render(ctx) {
|
|
8705
9253
|
const { width, height } = this.controller.document.canvas;
|
|
@@ -8726,12 +9274,25 @@ var PaintCanvasPresenter = (_class12 = class {
|
|
|
8726
9274
|
return drawn;
|
|
8727
9275
|
}
|
|
8728
9276
|
}, _class12);
|
|
8729
|
-
function guideOverlay(controller) {
|
|
9277
|
+
function guideOverlay(controller, drag) {
|
|
8730
9278
|
const s = controller.getState();
|
|
8731
9279
|
const size = s.document.canvas;
|
|
8732
9280
|
const out = [];
|
|
8733
9281
|
const layerId = s.document.activeLayerId;
|
|
8734
|
-
const
|
|
9282
|
+
const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _424 => _424.document, 'access', _425 => _425.liveStrokes, 'optionalAccess', _426 => _426[layerId], 'optionalAccess', _427 => _427.some, 'call', _428 => _428((x) => x.id === s.selectedStroke)]) : false;
|
|
9283
|
+
const area = strokePicked ? controller.liveStrokeArea(s.selectedStroke) : null;
|
|
9284
|
+
if (area) {
|
|
9285
|
+
const dx = drag && drag.id === s.selectedStroke ? drag.dx : 0;
|
|
9286
|
+
const dy = drag && drag.id === s.selectedStroke ? drag.dy : 0;
|
|
9287
|
+
const box = [
|
|
9288
|
+
{ x: area.x + dx, y: area.y + dy },
|
|
9289
|
+
{ x: area.x + area.width + dx, y: area.y + dy },
|
|
9290
|
+
{ x: area.x + area.width + dx, y: area.y + area.height + dy },
|
|
9291
|
+
{ x: area.x + dx, y: area.y + area.height + dy }
|
|
9292
|
+
];
|
|
9293
|
+
for (let i = 0; i < 4; i++) out.push({ from: box[i], to: box[(i + 1) % 4], kind: "stroke" });
|
|
9294
|
+
}
|
|
9295
|
+
const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _429 => _429.document, 'access', _430 => _430.stickers, 'optionalAccess', _431 => _431[layerId], 'optionalAccess', _432 => _432.find, 'call', _433 => _433((x) => x.id === s.selectedSticker)]) : void 0;
|
|
8735
9296
|
if (picked) {
|
|
8736
9297
|
const r = picked.size / 2 + 2;
|
|
8737
9298
|
const a = picked.rotation * Math.PI / 180;
|
|
@@ -8775,7 +9336,7 @@ var PAPER_SLIDERS = [
|
|
|
8775
9336
|
];
|
|
8776
9337
|
function readPath(obj, path) {
|
|
8777
9338
|
let v = obj;
|
|
8778
|
-
for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess',
|
|
9339
|
+
for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _434 => _434[k]]);
|
|
8779
9340
|
return typeof v === "number" ? v : 0;
|
|
8780
9341
|
}
|
|
8781
9342
|
function patchPath(obj, path, value) {
|
|
@@ -8897,7 +9458,7 @@ function brushEngineControls(brush) {
|
|
|
8897
9458
|
impastoTool: true
|
|
8898
9459
|
};
|
|
8899
9460
|
case "wet": {
|
|
8900
|
-
const tool = _nullishCoalesce(_optionalChain([brush, 'access',
|
|
9461
|
+
const tool = _nullishCoalesce(_optionalChain([brush, 'access', _435 => _435.wet, 'optionalAccess', _436 => _436.tool]), () => ( "paint"));
|
|
8901
9462
|
const sliders = tool === "paint" ? [
|
|
8902
9463
|
{ path: "wet.water", label: "Water", min: 0, max: 1, step: 0.01 },
|
|
8903
9464
|
{ path: "wet.pigment", label: "Pigment", min: 0, max: 1, step: 0.01 },
|
|
@@ -9030,7 +9591,7 @@ function startWetClock(controller, frame, cancel) {
|
|
|
9030
9591
|
id = raf(loop);
|
|
9031
9592
|
return () => {
|
|
9032
9593
|
stopped = true;
|
|
9033
|
-
_optionalChain([caf, 'optionalCall',
|
|
9594
|
+
_optionalChain([caf, 'optionalCall', _437 => _437(id)]);
|
|
9034
9595
|
};
|
|
9035
9596
|
}
|
|
9036
9597
|
function drawWaterOverlay(controller, ctx) {
|
|
@@ -9060,6 +9621,11 @@ function toggleStamp(stamps, stamp) {
|
|
|
9060
9621
|
const next = stamps.includes(stamp) ? stamps.filter((s) => s !== stamp) : [...stamps, stamp];
|
|
9061
9622
|
return next.length ? next : [stamp];
|
|
9062
9623
|
}
|
|
9624
|
+
var STROKE_SLIDERS = [
|
|
9625
|
+
{ path: "tip.size", label: "Size", min: 1, max: 400, step: 1 },
|
|
9626
|
+
{ path: "tip.opacity", label: "Opacity", min: 0, max: 1, step: 0.01 },
|
|
9627
|
+
{ path: "tip.flow", label: "Flow", min: 0, max: 1, step: 0.01 }
|
|
9628
|
+
];
|
|
9063
9629
|
var STICKER_SLIDERS = [
|
|
9064
9630
|
{ path: "size", label: "Size", min: 2, max: 400, step: 1 },
|
|
9065
9631
|
{ path: "rotation", label: "Rotation", min: -180, max: 180, step: 1 },
|
|
@@ -9634,4 +10200,8 @@ function createPaintEditorDocument(controller, options = {}) {
|
|
|
9634
10200
|
|
|
9635
10201
|
|
|
9636
10202
|
|
|
9637
|
-
exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkOLNIPTB3cjs.BLEND_MODES; exports.BRUSH_ID = _chunkNKTNLJUJcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkNKTNLJUJcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkNKTNLJUJcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkNKTNLJUJcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunkNKTNLJUJcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkNKTNLJUJcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkNKTNLJUJcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkNKTNLJUJcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkXFYLA3ZOcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkNKTNLJUJcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkNKTNLJUJcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkNKTNLJUJcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkNKTNLJUJcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkNKTNLJUJcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkNKTNLJUJcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkXFYLA3ZOcjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunkNKTNLJUJcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkPQ3H2AANcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkPQ3H2AANcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunk7PT4RJL5cjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkNKTNLJUJcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkNKTNLJUJcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkPQ3H2AANcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkNKTNLJUJcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkOLNIPTB3cjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkNKTNLJUJcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkNKTNLJUJcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkPQ3H2AANcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkPQ3H2AANcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkNKTNLJUJcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkNKTNLJUJcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkNKTNLJUJcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkNKTNLJUJcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkPQ3H2AANcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkPQ3H2AANcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkPQ3H2AANcjs.PaperGrain; exports.ParticleStroke = _chunkNKTNLJUJcjs.ParticleStroke; exports.PenDabWalker = _chunkNKTNLJUJcjs.PenDabWalker; exports.PenSmoother = _chunkNKTNLJUJcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkNKTNLJUJcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunkNKTNLJUJcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkPQ3H2AANcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkXFYLA3ZOcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkNKTNLJUJcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkXFYLA3ZOcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkNKTNLJUJcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkPQ3H2AANcjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkNKTNLJUJcjs.brushTakesPaint; exports.brushToJSON = _chunkNKTNLJUJcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkNKTNLJUJcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunkNKTNLJUJcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunkNKTNLJUJcjs.effectPaintKey; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkPQ3H2AANcjs.grainCatch; exports.grainHeights = _chunkPQ3H2AANcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkPQ3H2AANcjs.hash2; exports.hexToPaintRgb = _chunkPQ3H2AANcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkNKTNLJUJcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunk7PT4RJL5cjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkOLNIPTB3cjs.isBlendMode; exports.isGradientPaint = _chunkPQ3H2AANcjs.isGradientPaint; exports.isPaintEffectPaint = _chunkNKTNLJUJcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunkOLNIPTB3cjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkNKTNLJUJcjs.isWetBrush; exports.isWetCapable = _chunkNKTNLJUJcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkPQ3H2AANcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkNKTNLJUJcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkNKTNLJUJcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkNKTNLJUJcjs.normalizeBehavior; exports.normalizeBristle = _chunkNKTNLJUJcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkNKTNLJUJcjs.normalizeDynamics; exports.normalizeFlow = _chunkXFYLA3ZOcjs.normalizeFlow; exports.normalizeHexColor = _chunkPQ3H2AANcjs.normalizeHexColor; exports.normalizeImpasto = _chunkNKTNLJUJcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkNKTNLJUJcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkNKTNLJUJcjs.normalizePaintBrush; exports.normalizePaper = _chunkNKTNLJUJcjs.normalizePaper; exports.normalizeParticle = _chunkNKTNLJUJcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkNKTNLJUJcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkNKTNLJUJcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkNKTNLJUJcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkXFYLA3ZOcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkPQ3H2AANcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkPQ3H2AANcjs.paintSourceColor; exports.paintSourceCss = _chunkPQ3H2AANcjs.paintSourceCss; exports.paintToMultiColor = _chunkNKTNLJUJcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkNKTNLJUJcjs.paperPreset; exports.parseBrushLibrary = _chunkNKTNLJUJcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkPQ3H2AANcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkNKTNLJUJcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkPQ3H2AANcjs.rand01; exports.randSigned = _chunkPQ3H2AANcjs.randSigned; exports.readPaintEffectPaint = _chunkNKTNLJUJcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkPQ3H2AANcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkPQ3H2AANcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkNKTNLJUJcjs.renderPaper; exports.renderStickers = _chunkNKTNLJUJcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkPQ3H2AANcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkPQ3H2AANcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleEffectAt = _chunkNKTNLJUJcjs.sampleEffectAt; exports.sampleEffectField = _chunkNKTNLJUJcjs.sampleEffectField; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkPQ3H2AANcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkPQ3H2AANcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkPQ3H2AANcjs.solidPaint; exports.stampCoverage = _chunkNKTNLJUJcjs.stampCoverage; exports.standardBlendMode = _chunkOLNIPTB3cjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = _chunkNKTNLJUJcjs.stickerAt; exports.stickerRect = _chunkNKTNLJUJcjs.stickerRect; exports.stickerSurface = _chunkNKTNLJUJcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkNKTNLJUJcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkNKTNLJUJcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkPQ3H2AANcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkNKTNLJUJcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkXFYLA3ZOcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunk7PT4RJL5cjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
|
|
10203
|
+
|
|
10204
|
+
|
|
10205
|
+
|
|
10206
|
+
|
|
10207
|
+
exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkOLNIPTB3cjs.BLEND_MODES; exports.BRUSH_ID = _chunkNKTNLJUJcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkNKTNLJUJcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkNKTNLJUJcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkNKTNLJUJcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunkNKTNLJUJcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkNKTNLJUJcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkNKTNLJUJcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkNKTNLJUJcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkXFYLA3ZOcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkNKTNLJUJcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkNKTNLJUJcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkNKTNLJUJcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkNKTNLJUJcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkNKTNLJUJcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkNKTNLJUJcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkXFYLA3ZOcjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunkNKTNLJUJcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkPQ3H2AANcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkPQ3H2AANcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunk7PT4RJL5cjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkNKTNLJUJcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkNKTNLJUJcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkPQ3H2AANcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkNKTNLJUJcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkOLNIPTB3cjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkNKTNLJUJcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkNKTNLJUJcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkPQ3H2AANcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkPQ3H2AANcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkNKTNLJUJcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkNKTNLJUJcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkNKTNLJUJcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkNKTNLJUJcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkPQ3H2AANcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkPQ3H2AANcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkPQ3H2AANcjs.PaperGrain; exports.ParticleStroke = _chunkNKTNLJUJcjs.ParticleStroke; exports.PenDabWalker = _chunkNKTNLJUJcjs.PenDabWalker; exports.PenSmoother = _chunkNKTNLJUJcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkNKTNLJUJcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunkNKTNLJUJcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkPQ3H2AANcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkXFYLA3ZOcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkNKTNLJUJcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkXFYLA3ZOcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkNKTNLJUJcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkPQ3H2AANcjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkNKTNLJUJcjs.brushTakesPaint; exports.brushToJSON = _chunkNKTNLJUJcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkNKTNLJUJcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunkNKTNLJUJcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunkNKTNLJUJcjs.effectPaintKey; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkPQ3H2AANcjs.grainCatch; exports.grainHeights = _chunkPQ3H2AANcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkPQ3H2AANcjs.hash2; exports.hexToPaintRgb = _chunkPQ3H2AANcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkNKTNLJUJcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunk7PT4RJL5cjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkOLNIPTB3cjs.isBlendMode; exports.isGradientPaint = _chunkPQ3H2AANcjs.isGradientPaint; exports.isPaintEffectPaint = _chunkNKTNLJUJcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunkOLNIPTB3cjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkNKTNLJUJcjs.isWetBrush; exports.isWetCapable = _chunkNKTNLJUJcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkPQ3H2AANcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkNKTNLJUJcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkNKTNLJUJcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkNKTNLJUJcjs.normalizeBehavior; exports.normalizeBristle = _chunkNKTNLJUJcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkNKTNLJUJcjs.normalizeDynamics; exports.normalizeFlow = _chunkXFYLA3ZOcjs.normalizeFlow; exports.normalizeHexColor = _chunkPQ3H2AANcjs.normalizeHexColor; exports.normalizeImpasto = _chunkNKTNLJUJcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkNKTNLJUJcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkNKTNLJUJcjs.normalizePaintBrush; exports.normalizePaper = _chunkNKTNLJUJcjs.normalizePaper; exports.normalizeParticle = _chunkNKTNLJUJcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkNKTNLJUJcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkNKTNLJUJcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkNKTNLJUJcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkXFYLA3ZOcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkPQ3H2AANcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkPQ3H2AANcjs.paintSourceColor; exports.paintSourceCss = _chunkPQ3H2AANcjs.paintSourceCss; exports.paintToMultiColor = _chunkNKTNLJUJcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkNKTNLJUJcjs.paperPreset; exports.parseBrushLibrary = _chunkNKTNLJUJcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkPQ3H2AANcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkNKTNLJUJcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkPQ3H2AANcjs.rand01; exports.randSigned = _chunkPQ3H2AANcjs.randSigned; exports.readPaintEffectPaint = _chunkNKTNLJUJcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkPQ3H2AANcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkPQ3H2AANcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkNKTNLJUJcjs.renderPaper; exports.renderStickers = _chunkNKTNLJUJcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkPQ3H2AANcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkPQ3H2AANcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleEffectAt = _chunkNKTNLJUJcjs.sampleEffectAt; exports.sampleEffectField = _chunkNKTNLJUJcjs.sampleEffectField; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkPQ3H2AANcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkPQ3H2AANcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkPQ3H2AANcjs.solidPaint; exports.stampCoverage = _chunkNKTNLJUJcjs.stampCoverage; exports.standardBlendMode = _chunkOLNIPTB3cjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = _chunkNKTNLJUJcjs.stickerAt; exports.stickerRect = _chunkNKTNLJUJcjs.stickerRect; exports.stickerSurface = _chunkNKTNLJUJcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkNKTNLJUJcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkNKTNLJUJcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkPQ3H2AANcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkNKTNLJUJcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkXFYLA3ZOcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunk7PT4RJL5cjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
|