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.

fix(tilemap): painter toolbar clipped buttons at narrow panel widths

yhhe60091988e7a
diff --git a/desktop/src/panels/TilemapPainter.tsx b/desktop/src/panels/TilemapPainter.tsx
index fa0648c7a..30075b6d2 100644
--- a/desktop/src/panels/TilemapPainter.tsx
+++ b/desktop/src/panels/TilemapPainter.tsx
@@ -510,15 +510,6 @@ export function TilemapPainter() {
>
<Dices size={15} />
</IconButton>
- <span className="tp-grow" />
- <span className="tp-brush">
- {tool === 'terrain' ? t('tile.terrainBrush') : (
- <>
- <BrushThumbnail stamp={stamp} atlas={localAtlas} />
- {stamp.w}×{stamp.h}
- </>
- )}
- </span>
</div>
{tool !== 'terrain' && (
<div className="tp-stamps">
@@ -609,6 +600,13 @@ export function TilemapPainter() {
<>
{texUrl && (
<div className="tp-palbar">
+ {/* Active-brush preview lives with the palette it's picked from + the zoom it
+ scales with — always visible (the tools row above no longer steals it). */}
+ <span className="tp-brush">
+ <BrushThumbnail stamp={stamp} atlas={localAtlas} />
+ {stamp.w}×{stamp.h}
+ </span>
+ <span className="tp-grow" />
<button type="button" className="tp-zbtn" title={t('tile.zoomOut')} onClick={() => setZoom((z) => clamp(z / 1.25, 0.25, 8))}>
<ZoomOut size={13} />
</button>
diff --git a/desktop/src/theme/tilemap.css b/desktop/src/theme/tilemap.css
index a94325ac8..830a4e5e8 100644
--- a/desktop/src/theme/tilemap.css
+++ b/desktop/src/theme/tilemap.css
@@ -14,7 +14,9 @@
.tp-tools {
display: flex;
align-items: center;
+ flex-wrap: wrap;
gap: 4px;
+ row-gap: 5px;
padding: 6px 10px;
border-bottom: 1px solid var(--line);
background: var(--srf-2);
@@ -82,7 +84,10 @@
width: 110px;
outline: none;
}
-.tp-layer-op { width: 44px; margin: 0 4px; align-self: center; accent-color: var(--acc); cursor: pointer; }
+/* Opacity slider is contextual to the ACTIVE layer (the one you're painting) — inactive
+ chips stay compact (eye · name · lock) so more layers fit the narrow strip. */
+.tp-layer-op { display: none; width: 44px; margin: 0 4px; align-self: center; accent-color: var(--acc); cursor: pointer; }
+.tp-layer.is-active .tp-layer-op { display: inline-block; }
.tp-grow { flex: 1 1 auto; }
.tp-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.tp-brush {
@@ -111,12 +116,16 @@
.tp-palbar {
display: flex;
align-items: center;
+ flex-wrap: wrap;
gap: 4px;
+ row-gap: 4px;
padding: 4px 8px;
background: var(--srf-0);
border-bottom: 1px solid var(--line);
flex: 0 0 auto;
}
+/* Brush preview sits with the palette + zoom; keep it from being squeezed to nothing. */
+.tp-palbar .tp-brush { flex: 0 0 auto; }
.tp-zbtn {
display: inline-flex;
align-items: center;