From b524133096230550cbf426f6c62a9ba8e8121191 Mon Sep 17 00:00:00 2001 From: mantou132 <709922234@qq.com> Date: Thu, 23 Nov 2023 09:32:57 +0800 Subject: [PATCH] Closed #283 --- packages/webapp/src/modules/stage.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/webapp/src/modules/stage.ts b/packages/webapp/src/modules/stage.ts index ebfd773..1ec0e82 100644 --- a/packages/webapp/src/modules/stage.ts +++ b/packages/webapp/src/modules/stage.ts @@ -10,6 +10,7 @@ import { RefObject, styleMap, attribute, + state, } from '@mantou/gem'; import JSZip from 'jszip'; import { hotkeys } from 'duoyun-ui/lib/hotkeys'; @@ -68,6 +69,9 @@ const style = createCSSSheet(css` display: block; background: black; } + :host(:where(:--playing, :state(playing))) { + cursor: none; + } .canvas { position: absolute; inset: 0; @@ -116,6 +120,7 @@ export class MStageElement extends GemElement { @refobject audioRef: RefObject; @refobject chatRef: RefObject; @attribute padding: string; + @state playing: boolean; state: State = { messages: [], @@ -443,6 +448,7 @@ export class MStageElement extends GemElement { }; #onPointerMove = (event: PointerEvent) => { + this.playing = false; if (!this.#gameInstance) return; const [x, y, dx, dy] = positionMapping(event, this.canvasRef.element!); if (this.#isHost) { @@ -453,6 +459,9 @@ export class MStageElement extends GemElement { }; #pressButton = (player: Player, button: Button) => { + if (button !== Button.PointerPrimary && button !== Button.PointerSecondary) { + this.playing = true; + } if (button === Button.Reset) { this.#gameInstance?.reset(); } else {