fix: scene clear race, path editor anchors, avatar cover, team color crash
Clear scene now patches traps/tokens/npcTokens atomically and updateScene merges against a fresh scene snapshot. Align NPC path-editor previews on token center, default new paths to fixed facing, size avatars by natural aspect for cover, and read team color synchronously from the picker. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -700,10 +700,25 @@ export function SceneEditorApp() {
|
||||
!sceneId || (localTraps.length === 0 && localTokens.length === 0 && localNpcTokens.length === 0)
|
||||
}
|
||||
onClick={() => {
|
||||
persistTraps([]);
|
||||
persistTokens([]);
|
||||
persistNpcTokens([]);
|
||||
if (!sceneId) return;
|
||||
if (saveTrapsTimerRef.current) window.clearTimeout(saveTrapsTimerRef.current);
|
||||
if (saveTokensTimerRef.current) window.clearTimeout(saveTokensTimerRef.current);
|
||||
if (saveNpcTokensTimerRef.current) window.clearTimeout(saveNpcTokensTimerRef.current);
|
||||
saveTrapsTimerRef.current = 0;
|
||||
saveTokensTimerRef.current = 0;
|
||||
saveNpcTokensTimerRef.current = 0;
|
||||
setLocalTraps([]);
|
||||
setLocalTokens([]);
|
||||
setLocalNpcTokens([]);
|
||||
trapsRef.current = [];
|
||||
tokensRef.current = [];
|
||||
npcTokensRef.current = [];
|
||||
setSelected(null);
|
||||
// Single atomic patch — separate persist* calls raced and restored tokens/traps.
|
||||
void api.invoke(ipcChannels.project.updateScene, {
|
||||
sceneId,
|
||||
patch: { traps: [], tokens: [], npcTokens: [] },
|
||||
});
|
||||
}}
|
||||
>
|
||||
Очистить сцену
|
||||
|
||||
Reference in New Issue
Block a user