feat(effects): add Closing brush as inverse of Opening brush

Allow covering revealed darkness again during darkened scene sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-30 17:21:40 +08:00
parent a3a03eb9e3
commit 41b112159f
7 changed files with 108 additions and 19 deletions
+36 -1
View File
@@ -48,9 +48,10 @@ void test('SceneDarknessStore: draft синхронизируется и сбр
store.switchScene('scene_a', true);
store.dispatch({
kind: 'draft.set',
draft: { points: [{ x: 0.1, y: 0.1, tMs: 1 }], radiusN: 0.05 },
draft: { points: [{ x: 0.1, y: 0.1, tMs: 1 }], radiusN: 0.05, mode: 'cover' },
});
assert.ok(store.getState().draft);
assert.equal(store.getState().draft?.mode, 'cover');
store.dispatch({
kind: 'stroke.add',
stroke: {
@@ -59,8 +60,42 @@ void test('SceneDarknessStore: draft синхронизируется и сбр
createdAtMs: 100,
points: [{ x: 0.1, y: 0.1, tMs: 1 }],
radiusN: 0.05,
mode: 'cover',
},
});
assert.equal(store.getState().draft, null);
assert.equal(store.getState().strokes.length, 1);
});
void test('SceneDarknessStore: cover-штрих сохраняется в кэше сцены', () => {
const store = new SceneDarknessStore();
store.switchScene('scene_a', true);
store.dispatch({
kind: 'stroke.add',
stroke: {
id: 'open1',
seed: 1,
createdAtMs: 100,
points: [{ x: 0.5, y: 0.5, tMs: 100 }],
radiusN: 0.08,
mode: 'reveal',
},
});
store.dispatch({
kind: 'stroke.add',
stroke: {
id: 'close1',
seed: 2,
createdAtMs: 200,
points: [{ x: 0.5, y: 0.5, tMs: 200 }],
radiusN: 0.08,
mode: 'cover',
},
});
assert.equal(store.getState().strokes.length, 2);
assert.equal(store.getState().strokes[1]?.mode, 'cover');
store.switchScene('scene_b', true);
store.switchScene('scene_a', true);
assert.equal(store.getState().strokes.length, 2);
assert.equal(store.getState().strokes[1]?.mode, 'cover');
});