From f171c77f9190d95650a24e3327c367601e229953 Mon Sep 17 00:00:00 2001 From: MelekTaus Date: Mon, 12 Oct 2026 18:48:18 +0200 Subject: [PATCH] Turn the own mouse pointer off again after signing out and in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI was red on d4fc425 with two checks, both from this week's work. - Signing out builds the editor anew on the same renderer. The second useCursorFiles then took the SVG pointers of the first for Pixi's own styles, so switching the option off kept them. The editor now undoes the pointers on dispose and Pixi's styles are back in place. - e2e 62d still looked for "Start recording". The menu reads "Start recording…" since ba01d14, and 62 had not run then. Tests: - e2e 45, 46 and 62 on melektaus-atx: ALL PASSED, 51 checks - Without the dispose, 46i-ii is red after 45, as it was in CI - Gate, measured together with #419 on top: 305 files, 4714 tests Co-Authored-By: Claude Opus 5.5 --- src/editor/Editor.ts | 3 ++- src/editor/editorCursors.ts | 11 ++++++++--- tools/e2e/62-device-pixels.mjs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/editor/Editor.ts b/src/editor/Editor.ts index 9a8a7eab..65bd886a 100644 --- a/src/editor/Editor.ts +++ b/src/editor/Editor.ts @@ -429,7 +429,8 @@ export class Editor implements PlayHost { showBadge: (on) => this.toolbar.showRecording(on), badgeRoom: () => this.toolbar.recordingRoom(), }); - useCursorFiles(app.renderer.events, app.canvas); + // Undone on dispose: the next session's editor shares the renderer and must find Pixi's own styles. + this.cleanups.push(useCursorFiles(app.renderer.events, app.canvas)); this.play = new PlaySession(state, this); this.editorRun = new EditorRun(state, { // The game view is the one place where no key means anything to the editor, so that is where diff --git a/src/editor/editorCursors.ts b/src/editor/editorCursors.ts index 6205d0e1..940accf1 100644 --- a/src/editor/editorCursors.ts +++ b/src/editor/editorCursors.ts @@ -10,15 +10,20 @@ import { generalSettings, onGeneralSettings } from './generalSettings'; export function useCursorFiles(events: EventSystem, canvas: HTMLCanvasElement): () => void { const own = { ...events.cursorStyles }; const files = Object.fromEntries(cursorKeywords().map((keyword) => [keyword, cursorCss(keyword)])); - const apply = (): void => { + const show = (custom: boolean): void => { const styles = events.cursorStyles; for (const keyword of Object.keys(styles)) delete styles[keyword]; - Object.assign(styles, own, generalSettings().customCursor ? files : {}); + Object.assign(styles, own, custom ? files : {}); // Pixi sets a style only when the pointer's mode changes: the one showing now changes here. const keyword = cursorKeyword(canvas.style.cursor); const style = styles[keyword]; canvas.style.cursor = typeof style === 'string' ? style : keyword; }; + const apply = (): void => show(generalSettings().customCursor); apply(); - return onGeneralSettings(apply); + const stopListening = onGeneralSettings(apply); + return () => { + stopListening(); + show(false); + }; } diff --git a/tools/e2e/62-device-pixels.mjs b/tools/e2e/62-device-pixels.mjs index f79f7f26..2f6b9baf 100644 --- a/tools/e2e/62-device-pixels.mjs +++ b/tools/e2e/62-device-pixels.mjs @@ -128,7 +128,7 @@ export async function devicePixels(t) { fixed.shown.w === 960 && fixed.shown.h === 540 && Array.isArray(rows) && - rows.includes('Start recording'), + rows.includes('Start recording…'), JSON.stringify({ fixed, menu, rows }), );