mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-21 04:45:54 +00:00
Merge pull request #68 from seanlowe/main
allow closing the radial or build menu with the esc key
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
} from "../../../core/game/Game";
|
||||
import { ClientID } from "../../../core/Schemas";
|
||||
import {
|
||||
CloseViewEvent,
|
||||
ContextMenuEvent,
|
||||
MouseUpEvent,
|
||||
ShowBuildMenuEvent,
|
||||
@@ -124,9 +125,22 @@ export class RadialMenu implements Layer {
|
||||
}
|
||||
this.buildMenu.showMenu(tile);
|
||||
});
|
||||
|
||||
this.eventBus.on(CloseViewEvent, () => this.closeMenu());
|
||||
|
||||
this.createMenuElement();
|
||||
}
|
||||
|
||||
private closeMenu() {
|
||||
if (this.isVisible) {
|
||||
this.hideRadialMenu();
|
||||
}
|
||||
|
||||
if (this.buildMenu.isVisible) {
|
||||
this.buildMenu.hideMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private createMenuElement() {
|
||||
this.menuElement = d3
|
||||
.select(document.body)
|
||||
|
||||
Reference in New Issue
Block a user