mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 12:32:21 +00:00
Fix merge issues and ESlint
This commit is contained in:
@@ -683,7 +683,7 @@ export class InputHandler {
|
||||
this.eventBus.emit(new WarshipSelectionBoxCancelEvent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.isMenuModifierPressed(event, this.keybinds.buildMenuModifier)) {
|
||||
this.suppressNextTap = false;
|
||||
this.eventBus.emit(new ShowBuildMenuEvent(event.clientX, event.clientY));
|
||||
@@ -982,8 +982,11 @@ export class InputHandler {
|
||||
this.activeKeys.clear();
|
||||
}
|
||||
|
||||
private isMenuModifierPressed(event: PointerEvent, modifierBind: string): boolean {
|
||||
// Don't accept Shift: menus are meant to be modifier+click,
|
||||
private isMenuModifierPressed(
|
||||
event: PointerEvent,
|
||||
modifierBind: string,
|
||||
): boolean {
|
||||
// Don't accept Shift: menus are meant to be modifier+click,
|
||||
// but Shift+click is hardcoded for attack when leftClickOpensMenu is false.
|
||||
// Do allow other keys than strict modifier keys by definition (like "keyU"),
|
||||
// because non-modifier keys could already be assigned in UserSettingModal.
|
||||
|
||||
@@ -87,7 +87,8 @@ export class UserSettingModal extends BaseModal {
|
||||
prevValue?: string;
|
||||
}>,
|
||||
) {
|
||||
let { action, value, key, prevValue } = e.detail;
|
||||
const { action, value, prevValue } = e.detail;
|
||||
let { key } = e.detail;
|
||||
|
||||
console.info(
|
||||
"handleKeybindChange recieved value: " + value,
|
||||
@@ -631,9 +632,7 @@ export class UserSettingModal extends BaseModal {
|
||||
})}
|
||||
.defaultKey=${this.defaultKeybinds.attackRatioUp}
|
||||
.value=${this.getKeyValue(KeybindAction.attackRatioUp)}
|
||||
.display=${formatKeyForDisplay(
|
||||
this.getKeyValue(KeybindAction.attackRatioUp as KeybindAction) || "",
|
||||
)}
|
||||
.display=${this.getKeyChar(KeybindAction.attackRatioUp)}
|
||||
@change=${this.handleKeybindChange}
|
||||
></setting-keybind>
|
||||
|
||||
@@ -680,22 +679,22 @@ export class UserSettingModal extends BaseModal {
|
||||
</h2>
|
||||
|
||||
<setting-keybind
|
||||
action="requestAlliance"
|
||||
action=${KeybindAction.requestAlliance}
|
||||
label=${translateText("user_setting.request_alliance")}
|
||||
description=${translateText("user_setting.request_alliance_desc")}
|
||||
defaultKey="KeyK"
|
||||
.value=${this.getKeyValue("requestAlliance")}
|
||||
.display=${this.getKeyChar("requestAlliance")}
|
||||
.defaultKey=${this.defaultKeybinds.requestAlliance}
|
||||
.value=${this.getKeyValue(KeybindAction.requestAlliance)}
|
||||
.display=${this.getKeyChar(KeybindAction.requestAlliance)}
|
||||
@change=${this.handleKeybindChange}
|
||||
></setting-keybind>
|
||||
|
||||
<setting-keybind
|
||||
action="breakAlliance"
|
||||
action=${KeybindAction.breakAlliance}
|
||||
label=${translateText("user_setting.break_alliance")}
|
||||
description=${translateText("user_setting.break_alliance_desc")}
|
||||
defaultKey="KeyL"
|
||||
.value=${this.getKeyValue("breakAlliance")}
|
||||
.display=${this.getKeyChar("breakAlliance")}
|
||||
.defaultKey=${this.defaultKeybinds.breakAlliance}
|
||||
.value=${this.getKeyValue(KeybindAction.breakAlliance)}
|
||||
.display=${this.getKeyChar(KeybindAction.breakAlliance)}
|
||||
@change=${this.handleKeybindChange}
|
||||
></setting-keybind>
|
||||
|
||||
|
||||
+1
-1
@@ -382,7 +382,7 @@ export function formatKeyForDisplay(value: string): string {
|
||||
ShiftLeft: "Shift ⇧",
|
||||
ShiftRight: "Shift ⇧",
|
||||
Control: "Ctrl",
|
||||
// "Alt Gr" emits ControlLeft+Alt in Windows on many keyboard layouts and we catch the first code.
|
||||
// "Alt Gr" emits ControlLeft+Alt in Windows on many keyboard layouts and we catch the first code.
|
||||
// Is undiscernable normally from ControlLeft but user sees "alt gr" on the key so display it too
|
||||
ControlLeft: "Ctrl / Alt Gr",
|
||||
ControlRight: "Ctrl",
|
||||
|
||||
@@ -140,7 +140,7 @@ export class SettingKeybind extends LitElement {
|
||||
const prevValue = this.value;
|
||||
|
||||
// Temporarily set the value to the new code for validation in parent
|
||||
this.value = code;
|
||||
this.value = code;
|
||||
|
||||
const event = new CustomEvent("change", {
|
||||
detail: { action: this.action, value: code, key: displayKey, prevValue },
|
||||
|
||||
@@ -27,7 +27,7 @@ export enum KeybindAction {
|
||||
boatAttack = "boatAttack",
|
||||
groundAttack = "groundAttack",
|
||||
breakAlliance = "breakAlliance",
|
||||
swapDirection = "swapDirection",
|
||||
requestAlliance = "requestAlliance",
|
||||
swapDirection = "swapDirection",
|
||||
zoomOut = "zoomOut",
|
||||
zoomIn = "zoomIn",
|
||||
|
||||
@@ -872,6 +872,7 @@ describe("InputHandler AutoUpgrade", () => {
|
||||
expect(uiState.ghostStructure).toBe(UnitType.City);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Warship box selection (Shift+drag)", () => {
|
||||
let inputHandler: InputHandler;
|
||||
|
||||
Reference in New Issue
Block a user