mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 07:50:45 +00:00
restore alt-view (space hold) toggle
InputHandler still emits AlternateViewEvent on space down/up, and the renderer still has setAltView. The bridge between them lived in MapInteraction's applyAltView, which got deleted with the rest of MapInteraction — nothing was wiring the event to the view anymore. Expose view.setAltView and have ClientGameRunner subscribe.
This commit is contained in:
@@ -37,6 +37,7 @@ import {
|
||||
import { WorkerClient } from "../core/worker/WorkerClient";
|
||||
import { getPersistentID } from "./Auth";
|
||||
import {
|
||||
AlternateViewEvent,
|
||||
AutoUpgradeEvent,
|
||||
DoBoatAttackEvent,
|
||||
DoBreakAllianceEvent,
|
||||
@@ -445,6 +446,11 @@ async function createClientGame(
|
||||
(e) => applyDayNightMode((e as CustomEvent<string>).detail === "true"),
|
||||
);
|
||||
|
||||
// Space-hold (and the settings-modal toggle) drives the affiliation
|
||||
// recolor. InputHandler emits AlternateViewEvent; the WebGL view needs
|
||||
// setAltView called to switch passes into alt mode.
|
||||
eventBus.on(AlternateViewEvent, (e) => view.setAltView(e.alternateView));
|
||||
|
||||
const gameRenderer = createRenderer(
|
||||
inputOverlay,
|
||||
gameView,
|
||||
|
||||
@@ -321,6 +321,9 @@ export class GameView {
|
||||
setLocalPlayerID(id: number): void {
|
||||
this.renderer.setLocalPlayerID(id);
|
||||
}
|
||||
setAltView(active: boolean): void {
|
||||
this.renderer.setAltView(active);
|
||||
}
|
||||
setHighlightOwner(ownerID: number): void {
|
||||
this.renderer.setHighlightOwner(ownerID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user