From 290dc17c0fea4fdb07f50fa0a7526eb1192c3ccc Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 2 Jan 2026 19:31:51 -0600 Subject: [PATCH 1/2] handles small window vertical --- play.pokemonshowdown.com/src/panel-battle.tsx | 54 +++++++++--- play.pokemonshowdown.com/style/client2.css | 85 +++++++++++++++++++ 2 files changed, 129 insertions(+), 10 deletions(-) diff --git a/play.pokemonshowdown.com/src/panel-battle.tsx b/play.pokemonshowdown.com/src/panel-battle.tsx index e0a7b623858..82d201d68cc 100644 --- a/play.pokemonshowdown.com/src/panel-battle.tsx +++ b/play.pokemonshowdown.com/src/panel-battle.tsx @@ -245,6 +245,8 @@ class BattlePanel extends PSRoomPanel { static readonly id = 'battle'; static readonly routes = ['battle-*', 'game-*']; static readonly Model = BattleRoom; + private controlsMode: 'move' | 'switch' | null = null; + private overlayMode = false; static handleDrop(ev: DragEvent) { const file = ev.dataTransfer?.files?.[0]; if (file?.type === 'text/html') { @@ -364,17 +366,27 @@ class BattlePanel extends PSRoomPanel { battle.subscribe(() => this.forceUpdate()); } battleHeight = 360; + controlTop = 370; updateLayout() { if (!this.base) return; const room = this.props.room; + this.overlayMode = (window.innerHeight <= 570 && window.innerWidth >= 440); + if (!this.overlayMode) this.controlsMode = null; const width = this.base.offsetWidth; + const classList = this.base.classList; + if (classList) { + classList.toggle('small-layout', !!width && width < 830); + classList.toggle('tiny-layout', !!width && width < 640); + } if (width && width < 640) { const scale = (width / 640); room.battle?.scene.$frame!.css('transform', `scale(${scale})`); this.battleHeight = Math.round(360 * scale); + this.controlTop = Math.round(360 * scale) + 10; } else { room.battle?.scene.$frame!.css('transform', 'none'); this.battleHeight = 360; + this.controlTop = 370; } } override receiveLine(args: Args) { @@ -895,6 +907,7 @@ class BattlePanel extends PSRoomPanel { case 'move': { const index = choices.index(); const pokemon = request.side.pokemon[index]; + if (this.overlayMode && this.controlsMode === null) this.controlsMode = null; if (choices.current.move) { const moveName = choices.currentMove()?.name; @@ -912,23 +925,38 @@ class BattlePanel extends PSRoomPanel { } const canShift = room.battle.gameType === 'triples' && index !== 1; + const showMoves = !this.overlayMode || this.controlsMode === 'move'; + const showSwitches = !this.overlayMode || this.controlsMode === 'switch'; + const overlayClass = (this.overlayMode && this.controlsMode) ? ` ${this.controlsMode}-controls` : ''; - return
+ return
{this.renderOldChoices(request, choices)} What will {pokemon.name} do?
-

Attack

- {this.renderMoveMenu(choices)} + + {showMoves && this.renderMoveMenu(choices)}
{canShift && [

Shift

, , ]} -

Switch

- {this.renderSwitchMenu(request, choices)} + + {showSwitches && this.renderSwitchMenu(request, choices)}
; } case 'switch': { @@ -1051,12 +1079,18 @@ class BattlePanel extends PSRoomPanel { return {hardcoreStyle} - -