dsh-ccx 0.8.9 → 0.9.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/LICENSE +21 -21
- package/NOTICE +23 -23
- package/README.md +151 -143
- package/assets/icon.svg +27 -27
- package/cordis.patch.yml +16 -16
- package/lib/client.js +1481 -2244
- package/lib/index.js +716 -449
- package/lib/vendor/code-codex/ascii-tiles.js +145 -0
- package/lib/vendor/code-codex/aurora-ionosphere.js +7 -6
- package/lib/vendor/code-codex/black-hole.js +10 -7
- package/lib/vendor/code-codex/blinking-squares.js +6 -13
- package/lib/vendor/code-codex/cloud-train.js +9 -8
- package/lib/vendor/code-codex/galleries.json +100 -100
- package/lib/vendor/code-codex/glow-horizon.js +1 -1
- package/lib/vendor/code-codex/heavenly-cloud.js +5 -4
- package/lib/vendor/code-codex/milky-way.js +3 -2
- package/lib/vendor/code-codex/mountain.js +5 -4
- package/lib/vendor/code-codex/particle-image.js +435 -14
- package/lib/vendor/code-codex/pixel-sculpt.js +85 -5
- package/lib/vendor/code-codex/scene-defaults.json +94 -1
- package/lib/vendor/code-codex/scene-schemas.json +1008 -0
- package/lib/vendor/code-codex/shallow-ocean-thumbnails.json +12 -0
- package/lib/vendor/code-codex/shallow-ocean.js +5094 -0
- package/lib/vendor/code-codex/spectral-drape.js +172 -0
- package/package.json +70 -59
- package/src/client/api.ts +90 -0
- package/src/client/background/layer.ts +187 -0
- package/src/client/background/pixel-sculpt.ts +167 -0
- package/src/client/background/scene-runner.ts +317 -0
- package/src/client/background/shallow-ocean.ts +344 -0
- package/src/client/background/vendor-loader.ts +297 -0
- package/src/client/background/wallpaper.ts +87 -0
- package/src/client/index.ts +247 -0
- package/src/client/surfaces/corner-patch.ts +100 -0
- package/src/client/surfaces/surface-css.ts +155 -0
- package/src/client/ui/draft.ts +105 -0
- package/src/client/ui/icons.ts +47 -0
- package/src/client/ui/panel.ts +1524 -0
- package/src/client/ui/shallow-ocean-panel.ts +376 -0
- package/src/client/ui/styles.ts +1471 -0
- package/src/host/fence.ts +78 -0
- package/src/host/index.ts +26 -0
- package/src/host/routes.ts +367 -0
- package/src/host/storage.ts +109 -0
- package/src/host/window-chrome.ts +53 -0
- package/src/shared/constants.ts +239 -0
- package/src/shared/sanitize.ts +110 -0
- package/src/shared/types.ts +145 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHALLOW_OCEAN_CREATURES,
|
|
3
|
+
SHALLOW_OCEAN_EVENTS,
|
|
4
|
+
SHALLOW_OCEAN_PERF_MODES,
|
|
5
|
+
} from '../../shared/constants';
|
|
6
|
+
import { finiteNum } from '../../shared/sanitize';
|
|
7
|
+
import type { AppearanceSettings, SceneParamMap, SceneSchema } from '../../shared/types';
|
|
8
|
+
import { ensureOceanThumbs, getCachedOceanThumbs } from '../api';
|
|
9
|
+
import { getLayer } from '../background/layer';
|
|
10
|
+
import { getShallowOceanController } from '../background/shallow-ocean';
|
|
11
|
+
import { escapeHtml, fmtFieldVal } from './draft';
|
|
12
|
+
|
|
13
|
+
export interface ShallowOceanPanelHost {
|
|
14
|
+
panel: HTMLElement;
|
|
15
|
+
state: () => AppearanceSettings | null;
|
|
16
|
+
draft: () => SceneParamMap | null;
|
|
17
|
+
schema: () => SceneSchema | null;
|
|
18
|
+
commit: (sceneId: 'shallow-ocean') => void;
|
|
19
|
+
onResetAll: () => void;
|
|
20
|
+
onReplay: () => void;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
onStatus: (msg: string, isError?: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const activeFlights = new Set<{ anim: Animation; ghost: HTMLElement }>();
|
|
26
|
+
let titleClicks = 0;
|
|
27
|
+
let lastPreviewEvent: string | undefined;
|
|
28
|
+
let unsubOcean: (() => void) | null = null;
|
|
29
|
+
let dragCreature:
|
|
30
|
+
| {
|
|
31
|
+
id: string;
|
|
32
|
+
startX: number;
|
|
33
|
+
startY: number;
|
|
34
|
+
moved: boolean;
|
|
35
|
+
ghost: HTMLImageElement | null;
|
|
36
|
+
thumbSrc: string;
|
|
37
|
+
}
|
|
38
|
+
| undefined;
|
|
39
|
+
|
|
40
|
+
export function clearShallowOceanUiState(): void {
|
|
41
|
+
titleClicks = 0;
|
|
42
|
+
lastPreviewEvent = undefined;
|
|
43
|
+
dragCreature = undefined;
|
|
44
|
+
if (unsubOcean) {
|
|
45
|
+
unsubOcean();
|
|
46
|
+
unsubOcean = null;
|
|
47
|
+
}
|
|
48
|
+
for (const item of activeFlights) {
|
|
49
|
+
try {
|
|
50
|
+
item.anim.cancel();
|
|
51
|
+
item.ghost.remove();
|
|
52
|
+
} catch {
|
|
53
|
+
// Ignore
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
activeFlights.clear();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function renderShallowOceanHeaderHtml(
|
|
60
|
+
perfMode: number,
|
|
61
|
+
devMode: boolean,
|
|
62
|
+
closeSvg: string,
|
|
63
|
+
): string {
|
|
64
|
+
const curPerf = Number.isFinite(perfMode) ? Math.max(0, Math.min(3, Math.round(perfMode))) : 0;
|
|
65
|
+
const perfOptions = SHALLOW_OCEAN_PERF_MODES.map(
|
|
66
|
+
([, zh], idx) =>
|
|
67
|
+
`<option value="${idx}"${curPerf === idx ? ' selected' : ''}>${escapeHtml(zh)}</option>`,
|
|
68
|
+
).join('');
|
|
69
|
+
return (
|
|
70
|
+
'<header class="particle-settings-header">' +
|
|
71
|
+
'<div class="particle-settings-heading">' +
|
|
72
|
+
'<p>外观<span class="ocean-developer-badge" data-ocean-dev-badge' +
|
|
73
|
+
(devMode ? '' : ' hidden') +
|
|
74
|
+
'>开发者模式</span></p>' +
|
|
75
|
+
'<h3><button type="button" class="ocean-developer-trigger" data-ocean-dev-trigger>Shallow Ocean Letters Background</button></h3>' +
|
|
76
|
+
'</div>' +
|
|
77
|
+
`<label class="ocean-performance"><span>性能模式</span><select data-ocean-perf aria-label="性能模式">${perfOptions}</select></label>` +
|
|
78
|
+
'<div class="particle-settings-header-actions">' +
|
|
79
|
+
`<button class="particle-settings-close" type="button" data-act="settingsclose" title="关闭设置 (Esc)" aria-label="关闭设置">${closeSvg}</button>` +
|
|
80
|
+
'</div></header>'
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function renderShallowOceanBodyHtml(
|
|
85
|
+
sch: SceneSchema,
|
|
86
|
+
d: SceneParamMap,
|
|
87
|
+
active: boolean,
|
|
88
|
+
): string {
|
|
89
|
+
const controller = getShallowOceanController();
|
|
90
|
+
const thumbs = getCachedOceanThumbs();
|
|
91
|
+
const dev = controller.developerMode;
|
|
92
|
+
const journal = controller.eventJournal;
|
|
93
|
+
const discoveredCount = journal.discovered.length;
|
|
94
|
+
const totalEvents = SHALLOW_OCEAN_EVENTS.length;
|
|
95
|
+
const complete = discoveredCount === totalEvents;
|
|
96
|
+
|
|
97
|
+
const creatureCards = SHALLOW_OCEAN_CREATURES.map(([id, , zh]) => {
|
|
98
|
+
const src = thumbs?.[id] || '';
|
|
99
|
+
const imgHtml = src
|
|
100
|
+
? `<img src="${escapeHtml(src)}" alt="" data-ocean-thumb="${id}" loading="lazy">`
|
|
101
|
+
: `<img alt="" data-ocean-thumb="${id}" style="opacity:.2">`;
|
|
102
|
+
return (
|
|
103
|
+
`<button type="button" class="ocean-creature-card" data-ocean-creature="${id}"` +
|
|
104
|
+
(active ? '' : ' disabled') +
|
|
105
|
+
`>${imgHtml}<span>${escapeHtml(zh)}</span></button>`
|
|
106
|
+
);
|
|
107
|
+
}).join('');
|
|
108
|
+
|
|
109
|
+
const fieldMap = new Map(sch.fields.map((f) => [f.key, f]));
|
|
110
|
+
const toggleMap = new Map((sch.toggles || []).map((t) => [t.key, t]));
|
|
111
|
+
|
|
112
|
+
const groupHtml = (sch.groups || [])
|
|
113
|
+
.map((g) => {
|
|
114
|
+
const rows = g.keys
|
|
115
|
+
.map((key) => {
|
|
116
|
+
const field = fieldMap.get(key);
|
|
117
|
+
if (field) {
|
|
118
|
+
const val = finiteNum(d[key], field.min);
|
|
119
|
+
return (
|
|
120
|
+
`<div class="particle-control-row"><label for="ccx-f-${field.key}">${escapeHtml(field.zh)}</label>` +
|
|
121
|
+
`<input id="ccx-f-${field.key}" type="range" min="${field.min}" max="${field.max}" step="${field.step}" value="${val}" data-field="${field.key}">` +
|
|
122
|
+
`<span class="particle-control-value"><output data-fieldval="${field.key}">${escapeHtml(fmtFieldVal(field, val))}</output></span></div>`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const toggle = toggleMap.get(key);
|
|
126
|
+
if (toggle) {
|
|
127
|
+
const checked = Number(d[toggle.key]) === 1 || d[toggle.key] === true;
|
|
128
|
+
return (
|
|
129
|
+
`<label class="particle-toggle-row"><span>${escapeHtml(toggle.zh)}</span>` +
|
|
130
|
+
`<input type="checkbox" data-toggle="${toggle.key}"${checked ? ' checked' : ''}></label>`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
return '';
|
|
134
|
+
})
|
|
135
|
+
.join('');
|
|
136
|
+
return `<fieldset class="particle-settings-group"><legend>${escapeHtml(g.zh)}</legend>${rows}</fieldset>`;
|
|
137
|
+
})
|
|
138
|
+
.join('');
|
|
139
|
+
|
|
140
|
+
const eventButtons = SHALLOW_OCEAN_EVENTS.map(([id, , zh]) => {
|
|
141
|
+
const hidden = !dev && !journal.discovered.includes(id);
|
|
142
|
+
const disabled = dev ? !active : !complete;
|
|
143
|
+
const pressed = dev ? lastPreviewEvent === id : !journal.excluded.includes(id);
|
|
144
|
+
return (
|
|
145
|
+
`<button type="button" data-ocean-event="${id}" aria-pressed="${pressed}"` +
|
|
146
|
+
(hidden ? ' hidden' : '') +
|
|
147
|
+
(disabled ? ' disabled' : '') +
|
|
148
|
+
`>${escapeHtml(zh)}</button>`
|
|
149
|
+
);
|
|
150
|
+
}).join('');
|
|
151
|
+
|
|
152
|
+
const eventHint = dev
|
|
153
|
+
? '点击事件立即预览。自动奇遇已暂停,不影响正式收集和筛选。'
|
|
154
|
+
: complete
|
|
155
|
+
? '已集齐所有奇遇。点亮想再次遇见的事件。'
|
|
156
|
+
: `已发现奇遇 ${discoveredCount} / ${totalEvents},集齐后可选择希望再次遇见的事件。`;
|
|
157
|
+
|
|
158
|
+
if (!thumbs) {
|
|
159
|
+
void ensureOceanThumbs().catch(() => ({}));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
'<div class="particle-settings-scroll">' +
|
|
164
|
+
'<fieldset class="particle-settings-group">' +
|
|
165
|
+
`<legend>投放生物${active ? '(点击或拖拽到水面)' : '(需先启用本场景)'}</legend>` +
|
|
166
|
+
`<div class="ocean-creature-grid">${creatureCards}</div>` +
|
|
167
|
+
'</fieldset>' +
|
|
168
|
+
`<div class="ocean-parameter-grid">${groupHtml}</div>` +
|
|
169
|
+
'<fieldset class="particle-settings-group">' +
|
|
170
|
+
'<legend>奇遇收集</legend>' +
|
|
171
|
+
`<div class="ocean-actions">${eventButtons}</div>` +
|
|
172
|
+
`<p class="ocean-hint" data-ocean-event-hint>${escapeHtml(eventHint)}</p>` +
|
|
173
|
+
'</fieldset>' +
|
|
174
|
+
'<div class="ocean-actions ocean-global-actions">' +
|
|
175
|
+
`<button type="button" data-ocean-clear${active ? '' : ' disabled'}>清除所有海洋生物</button>` +
|
|
176
|
+
`<button type="button" data-act="replay"${active ? '' : ' disabled'}>重播开场</button>` +
|
|
177
|
+
'<button type="button" data-act="draftreset">重置全部参数</button>' +
|
|
178
|
+
'</div>' +
|
|
179
|
+
'<p class="particle-plugin-error" role="status" hidden></p>' +
|
|
180
|
+
'</div>'
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function launchCreatureFlight(
|
|
185
|
+
sourceBtn: HTMLElement,
|
|
186
|
+
src: string,
|
|
187
|
+
shadowRoot: ShadowRoot,
|
|
188
|
+
dropX?: number,
|
|
189
|
+
dropY?: number,
|
|
190
|
+
): void {
|
|
191
|
+
if (!src) return;
|
|
192
|
+
const rect = sourceBtn.getBoundingClientRect();
|
|
193
|
+
const w = Math.max(24, Math.min(54, rect.width || 44));
|
|
194
|
+
const h = Math.max(24, Math.min(54, rect.height || 44));
|
|
195
|
+
const fromX = rect.left + rect.width / 2 - w / 2;
|
|
196
|
+
const fromY = rect.top + rect.height / 2 - h / 2;
|
|
197
|
+
const toX = (dropX ?? window.innerWidth * 0.5) - w / 2;
|
|
198
|
+
const toY = (dropY ?? window.innerHeight * 0.5) - h / 2;
|
|
199
|
+
|
|
200
|
+
const ghost = document.createElement('img');
|
|
201
|
+
ghost.src = src;
|
|
202
|
+
ghost.className = 'ocean-creature-fly';
|
|
203
|
+
ghost.style.cssText = `left:0;top:0;width:${w}px;height:${h}px;transform:translate(${fromX}px,${fromY}px);`;
|
|
204
|
+
shadowRoot.appendChild(ghost);
|
|
205
|
+
|
|
206
|
+
const anim = ghost.animate(
|
|
207
|
+
[
|
|
208
|
+
{ transform: `translate(${fromX}px,${fromY}px) scale(1)`, opacity: 1 },
|
|
209
|
+
{
|
|
210
|
+
transform: `translate(${(fromX + toX) * 0.5}px,${Math.min(fromY, toY) - 48}px) scale(1.15)`,
|
|
211
|
+
opacity: 0.95,
|
|
212
|
+
},
|
|
213
|
+
{ transform: `translate(${toX}px,${toY}px) scale(.55)`, opacity: 0 },
|
|
214
|
+
],
|
|
215
|
+
{ duration: 480, easing: 'cubic-bezier(.22,.8,.36,1)' },
|
|
216
|
+
);
|
|
217
|
+
const entry = { anim, ghost };
|
|
218
|
+
activeFlights.add(entry);
|
|
219
|
+
anim.onfinish = () => {
|
|
220
|
+
activeFlights.delete(entry);
|
|
221
|
+
ghost.remove();
|
|
222
|
+
};
|
|
223
|
+
anim.oncancel = () => {
|
|
224
|
+
activeFlights.delete(entry);
|
|
225
|
+
ghost.remove();
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function bindShallowOceanEvents(
|
|
230
|
+
shadowRoot: ShadowRoot,
|
|
231
|
+
host: ShallowOceanPanelHost,
|
|
232
|
+
rerender: () => void,
|
|
233
|
+
): () => void {
|
|
234
|
+
const controller = getShallowOceanController();
|
|
235
|
+
if (unsubOcean) unsubOcean();
|
|
236
|
+
unsubOcean = controller.subscribe(() => {
|
|
237
|
+
const st = host.state();
|
|
238
|
+
if (st?.scene === 'shallow-ocean' && !host.panel.hidden) {
|
|
239
|
+
rerender();
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
void ensureOceanThumbs().then((map) => {
|
|
244
|
+
const imgs = host.panel.querySelectorAll<HTMLImageElement>('img[data-ocean-thumb]');
|
|
245
|
+
for (let i = 0; i < imgs.length; i++) {
|
|
246
|
+
const id = imgs[i].dataset.oceanThumb;
|
|
247
|
+
if (id && map[id] && !imgs[i].src) {
|
|
248
|
+
imgs[i].src = map[id];
|
|
249
|
+
imgs[i].style.opacity = '1';
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
host.panel.addEventListener('pointerdown', (e) => {
|
|
255
|
+
const card = (e.target as Element).closest<HTMLButtonElement>('[data-ocean-creature]');
|
|
256
|
+
if (!card || card.disabled) return;
|
|
257
|
+
const id = card.dataset.oceanCreature;
|
|
258
|
+
if (!id) return;
|
|
259
|
+
const img = card.querySelector('img');
|
|
260
|
+
dragCreature = {
|
|
261
|
+
id,
|
|
262
|
+
startX: e.clientX,
|
|
263
|
+
startY: e.clientY,
|
|
264
|
+
moved: false,
|
|
265
|
+
ghost: null,
|
|
266
|
+
thumbSrc: img?.src || '',
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
const onWinMove = (e: PointerEvent) => {
|
|
271
|
+
if (!dragCreature) return;
|
|
272
|
+
if (!dragCreature.moved && Math.hypot(e.clientX - dragCreature.startX, e.clientY - dragCreature.startY) > 6) {
|
|
273
|
+
dragCreature.moved = true;
|
|
274
|
+
if (dragCreature.thumbSrc) {
|
|
275
|
+
const ghost = document.createElement('img');
|
|
276
|
+
ghost.src = dragCreature.thumbSrc;
|
|
277
|
+
ghost.className = 'ocean-creature-fly';
|
|
278
|
+
ghost.style.cssText = 'left:0;top:0;width:44px;height:44px;';
|
|
279
|
+
shadowRoot.appendChild(ghost);
|
|
280
|
+
dragCreature.ghost = ghost;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (dragCreature.ghost) {
|
|
284
|
+
dragCreature.ghost.style.transform = `translate(${e.clientX - 22}px,${e.clientY - 22}px)`;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const onWinUp = (e: PointerEvent) => {
|
|
289
|
+
if (!dragCreature) return;
|
|
290
|
+
const cur = dragCreature;
|
|
291
|
+
dragCreature = undefined;
|
|
292
|
+
if (cur.ghost) cur.ghost.remove();
|
|
293
|
+
if (!cur.moved) return;
|
|
294
|
+
|
|
295
|
+
const rect = getLayer()?.layer.getBoundingClientRect();
|
|
296
|
+
const w = rect?.width || window.innerWidth || 1;
|
|
297
|
+
const h = rect?.height || window.innerHeight || 1;
|
|
298
|
+
const u = Math.max(0.04, Math.min(0.96, (e.clientX - (rect?.left || 0)) / w));
|
|
299
|
+
const v = Math.max(0.04, Math.min(0.96, (e.clientY - (rect?.top || 0)) / h));
|
|
300
|
+
void controller.addCreature(cur.id, u, v).catch((err) => {
|
|
301
|
+
host.onStatus(String((err as Error)?.message || err), true);
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
window.addEventListener('pointermove', onWinMove);
|
|
306
|
+
window.addEventListener('pointerup', onWinUp);
|
|
307
|
+
window.addEventListener('pointercancel', onWinUp);
|
|
308
|
+
|
|
309
|
+
host.panel.addEventListener('click', (e) => {
|
|
310
|
+
const target = e.target as Element;
|
|
311
|
+
|
|
312
|
+
if (target.closest('[data-ocean-dev-trigger]')) {
|
|
313
|
+
titleClicks += 1;
|
|
314
|
+
if (titleClicks >= 5) {
|
|
315
|
+
titleClicks = 0;
|
|
316
|
+
controller.setDeveloperMode(!controller.developerMode);
|
|
317
|
+
}
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const creatureBtn = target.closest<HTMLButtonElement>('[data-ocean-creature]');
|
|
322
|
+
if (creatureBtn && !creatureBtn.disabled) {
|
|
323
|
+
const id = creatureBtn.dataset.oceanCreature;
|
|
324
|
+
if (!id) return;
|
|
325
|
+
const src = creatureBtn.querySelector('img')?.src || '';
|
|
326
|
+
const u = 0.2 + Math.random() * 0.6;
|
|
327
|
+
const v = 0.25 + Math.random() * 0.5;
|
|
328
|
+
launchCreatureFlight(creatureBtn, src, shadowRoot, u * window.innerWidth, v * window.innerHeight);
|
|
329
|
+
void controller.addCreature(id, u, v).catch((err) => {
|
|
330
|
+
host.onStatus(String((err as Error)?.message || err), true);
|
|
331
|
+
});
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const evBtn = target.closest<HTMLButtonElement>('[data-ocean-event]');
|
|
336
|
+
if (evBtn && !evBtn.disabled) {
|
|
337
|
+
const id = evBtn.dataset.oceanEvent;
|
|
338
|
+
if (!id) return;
|
|
339
|
+
if (controller.developerMode) {
|
|
340
|
+
lastPreviewEvent = id;
|
|
341
|
+
try {
|
|
342
|
+
controller.previewEvent(id);
|
|
343
|
+
rerender();
|
|
344
|
+
} catch (err) {
|
|
345
|
+
host.onStatus(String((err as Error)?.message || err), true);
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
controller.toggleEvent(id);
|
|
349
|
+
}
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (target.closest('[data-ocean-clear]')) {
|
|
354
|
+
controller.clearCreatures();
|
|
355
|
+
host.onStatus('已清除海洋生物');
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
host.panel.addEventListener('change', (e) => {
|
|
360
|
+
const sel = e.target as HTMLSelectElement;
|
|
361
|
+
if (sel?.dataset?.oceanPerf !== undefined) {
|
|
362
|
+
const d = host.draft();
|
|
363
|
+
if (!d) return;
|
|
364
|
+
const idx = Number(sel.value);
|
|
365
|
+
d.performanceMode = Number.isFinite(idx) ? Math.max(0, Math.min(3, Math.round(idx))) : 0;
|
|
366
|
+
host.commit('shallow-ocean');
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
return () => {
|
|
371
|
+
window.removeEventListener('pointermove', onWinMove);
|
|
372
|
+
window.removeEventListener('pointerup', onWinUp);
|
|
373
|
+
window.removeEventListener('pointercancel', onWinUp);
|
|
374
|
+
clearShallowOceanUiState();
|
|
375
|
+
};
|
|
376
|
+
}
|