Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(viewport): drop the redundant in-canvas Stop pill

yhh2e7055f41c42
diff --git a/desktop/src/i18n/messages/viewport.ts b/desktop/src/i18n/messages/viewport.ts
index b84309767..8a5779b9c 100644
--- a/desktop/src/i18n/messages/viewport.ts
+++ b/desktop/src/i18n/messages/viewport.ts
@@ -116,8 +116,6 @@ export const viewportMessages = defineMessages({
// — Play chrome (Play-in-viewport + Game panel) —
'vp.playFailed': { en: 'Play failed: {error}', zh: '运行失败:{error}' },
'vp.startingGame': { en: 'Starting game…', zh: '正在启动游戏…' },
- 'vp.stopTitle': { en: 'Stop (Esc)', zh: '停止(Esc)' },
- 'vp.playingStop': { en: '● Playing · Stop', zh: '● 运行中 · 停止' },
'vp.playFlag': { en: '● PLAY', zh: '● 运行中' },
'vp.pressPlay': { en: 'Press Play to run the game.', zh: '点击“运行”启动游戏。' },
'vp.starting': { en: 'Starting…', zh: '正在启动…' },
diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsx
index 5014bd97e..de072e9ed 100644
--- a/desktop/src/panels/Viewport.tsx
+++ b/desktop/src/panels/Viewport.tsx
@@ -967,7 +967,9 @@ export function Viewport() {
const dragging = TilePaintPreview.get() != null;
const hov = hoverTileRef.current;
const gesturing = dragging && (paint.tool === 'rect' || paint.tool === 'line');
- const stampSized = paint.tool === 'brush' || paint.tool === 'erase';
+ // Random brush lays ONE sampled tile per cell, so its footprint is 1×1 — only a
+ // pattern brush (or erase, which clears the whole w×h) previews at the stamp size.
+ const stampSized = paint.tool === 'erase' || (paint.tool === 'brush' && !paint.randomBrush);
const canFoot = !!(paint.tool && !gesturing && hov && cs?.cellSize && origin);
// Footprint corners in client px (fw×fh cells at the hovered cell).
let ftl: { x: number; y: number } | null = null;
@@ -1888,8 +1890,9 @@ export function Viewport() {
{/* Play In Viewport: the realm iframe fills the stage. The host stays mounted
whenever the viewport is the play target (parked when not playing) so the
- engine survives Stop for a warm re-Play; the status + stop chrome is
- play-only. */}
+ engine survives Stop for a warm re-Play; the status overlay is play-only.
+ Stop lives solely on the toolbar's play controls — no duplicate in-canvas
+ button obscuring the running game. */}
{playTarget === 'viewport' && (
<div className={`viewport__play${playInViewport ? '' : ' viewport__play--parked'}`}>
<div className="viewport__play-host" ref={playHostRef} />
@@ -1898,16 +1901,6 @@ export function Viewport() {
{realm.error ? t('vp.playFailed', { error: realm.error }) : t('vp.startingGame')}
</div>
)}
- {playInViewport && (
- <button
- type="button"
- className="viewport__play-stop"
- title={t('vp.stopTitle')}
- onClick={() => useEditorStore.getState().stop()}
- >
- {t('vp.playingStop')}
- </button>
- )}
</div>
)}
diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.css
index 972ed63c4..2474ad1b7 100644
--- a/desktop/src/theme/app.css
+++ b/desktop/src/theme/app.css
@@ -313,9 +313,8 @@
/* Cover capture (ProjectStore.captureThumbnail): for the capture frame, hide every
viewport overlay except the rendered scene itself — no gizmo icons, toolbars, or
perf HUD in a project cover. The play layer stays (a play-mode capture should
- show the game), minus its Stop badge. */
-body.thumb-capture .viewport > :not(.viewport__stage):not(.viewport__play),
-body.thumb-capture .viewport__play-stop {
+ show the game). */
+body.thumb-capture .viewport > :not(.viewport__stage):not(.viewport__play) {
visibility: hidden !important;
}
diff --git a/desktop/src/theme/viewport.css b/desktop/src/theme/viewport.css
index de85b4946..414eb98d3 100644
--- a/desktop/src/theme/viewport.css
+++ b/desktop/src/theme/viewport.css
@@ -199,26 +199,6 @@
pointer-events: none;
}
.viewport__play-status.error { color: var(--error); font-family: var(--mono); font-size: var(--fs-xs); }
-.viewport__play-stop {
- position: absolute;
- top: 10px;
- left: 50%;
- transform: translateX(-50%);
- z-index: 7;
- height: 24px;
- padding: 0 12px;
- display: inline-flex;
- align-items: center;
- gap: 6px;
- font-size: var(--fs-xs);
- font-weight: 600;
- color: var(--on-accent);
- background: var(--run);
- border-radius: var(--r-pill);
- box-shadow: var(--shadow-2);
- transition: background var(--t-fast);
-}
-.viewport__play-stop:hover { background: var(--run-hi); }
/* Play mode: the running game owns the viewport, so every edit-only overlay is hidden.
`display: none` (not just opacity) also drops the interactive UI-gizmo handles from