mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Fix browser hotkeys not working
CTRL+C for copying text CTRL+F for focusing search box above chat log CTRL+SHIFT+I for inspector tools
This commit is contained in:
+11
-1
@@ -175,6 +175,7 @@ export class PonyTownGame implements Game {
|
||||
shadowColor = SHADOW_COLOR;
|
||||
onChat = new Subject<void>();
|
||||
onToggleChat = new Subject<void>();
|
||||
onSearch = new Subject<void>();
|
||||
onCommand = new Subject<void>();
|
||||
onCancel = () => false;
|
||||
onClock = new BehaviorSubject<string>('');
|
||||
@@ -458,7 +459,16 @@ export class PonyTownGame implements Game {
|
||||
interact(this, this.input.isPressed(Key.SHIFT));
|
||||
});
|
||||
this.input.onPressed([Key.KEY_X, Key.GAMEPAD_BUTTON_DOWN], () => downAction(this));
|
||||
this.input.onPressed([Key.KEY_C, Key.GAMEPAD_BUTTON_UP], () => upAction(this));
|
||||
this.input.onPressed([Key.KEY_C, Key.GAMEPAD_BUTTON_UP], () => {
|
||||
if (!this.input.isPressed(Key.CTRL)) {
|
||||
upAction(this);
|
||||
}
|
||||
});
|
||||
this.input.onPressed(Key.KEY_F, () => {
|
||||
if (this.input.isPressed(Key.CTRL)) {
|
||||
this.onSearch.next();
|
||||
}
|
||||
});
|
||||
this.input.onPressed(Key.F2, () => {
|
||||
if (!this.settings.browser.disableFKeys) {
|
||||
this.hideText = !this.hideText;
|
||||
|
||||
@@ -9,7 +9,7 @@ function isKeyEventInvalid(e: KeyboardEvent) {
|
||||
}
|
||||
|
||||
function allowKey(key: number) {
|
||||
return key === Key.ESCAPE || key === Key.F5 || key === Key.F12 || key === Key.F11 || key === Key.TAB;
|
||||
return key === Key.ESCAPE || key === Key.F5 || key === Key.F12 || key === Key.F11 || key === Key.TAB || key === Key.KEY_C || key === Key.KEY_I;
|
||||
}
|
||||
|
||||
function fixKeyCode(key: number) {
|
||||
|
||||
@@ -281,6 +281,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
updateEntityId(this.party, update.old, update.new);
|
||||
updateEntityId(this.whisper, update.old, update.new);
|
||||
}),
|
||||
this.game.onSearch.subscribe(() => {
|
||||
this.focus();
|
||||
}),
|
||||
);
|
||||
}
|
||||
get linesElement() {
|
||||
@@ -457,7 +460,6 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
let value = this.filterInput.nativeElement.value;
|
||||
if (!value) {
|
||||
this.clearTimeOutAutoClear();
|
||||
this.unFocus();
|
||||
this.filterChatLogLines('', false);
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user