Switch to control shift for now

main
Talon 2024-08-30 16:33:06 +02:00
parent 0e90614009
commit 4ab828ea2b
2 changed files with 34 additions and 31 deletions

View File

@ -26,12 +26,14 @@ export class Container extends UINode {
this.children.push(node); this.children.push(node);
node._onConnect(); node._onConnect();
this.containerElement.appendChild(node.render()); this.containerElement.appendChild(node.render());
return this;
} }
public remove(node: UINode) { public remove(node: UINode) {
this.children.splice(this.children.indexOf(node), 1); this.children.splice(this.children.indexOf(node), 1);
node._onDisconnect(); node._onDisconnect();
this.containerElement.removeChild(node.render()); this.containerElement.removeChild(node.render());
return this;
} }
public render() { public render() {

View File

@ -84,38 +84,38 @@ export class MainView extends View {
} }
public onCreate(): void { public onCreate(): void {
this.settingsButton = new Button("Settings"); this.settingsButton = new Button("Settings")
this.settingsButton.setPosition(0, 0, 10, 10); .setPosition(0, 0, 10, 10)
this.settingsButton.onClick(() => this.openSettingsDialog()); .onClick(() => this.openSettingsDialog());
this.channelSwitcher = new Dropdown("Channel", []); this.channelSwitcher = new Dropdown("Channel", [])
this.channelSwitcher.setPosition(30, 10, 30, 10); .setPosition(30, 10, 30, 10);
this.channelInfoButton = new Button("Channel info"); this.channelInfoButton = new Button("Channel info")
this.channelInfoButton.setPosition(60, 10, 30, 10); .setPosition(60, 10, 30, 10);
this.searchButton = new Button("Search"); this.searchButton = new Button("Search")
this.searchButton.setPosition(90, 10, 10, 10); .setPosition(90, 10, 10, 10)
this.searchButton.onClick(async () => this.openSearchDialog()); .onClick(async () => this.openSearchDialog());
this.fileInput = new FileInput("Upload file"); this.fileInput = new FileInput("Upload file")
this.fileInput.setPosition(0, 90, 15, 10); .setPosition(0, 90, 15, 10);
this.imageInput = new Button("Image"); this.imageInput = new Button("Image")
this.imageInput.setPosition(15, 90, 15, 10); .setPosition(15, 90, 15, 10);
this.messageInput = new MultilineInput("New message"); this.messageInput = new MultilineInput("New message")
this.messageInput.setPosition(30, 90, 60, 10); .setPosition(30, 90, 60, 10);
this.messageInput.getElement().autofocus = true; this.messageInput.getElement().autofocus = true;
this.voiceMessageInput = new Button("Voice message"); this.voiceMessageInput = new Button("Voice message")
this.voiceMessageInput.setPosition(70, 90, 30, 10); .setPosition(70, 90, 30, 10);
this.messageList = new List("Messages"); this.messageList = new List("Messages")
this.messageList.setPosition(30, 30, 60, 50); .setPosition(30, 30, 60, 50);
this.window.add(this.settingsButton); this.window.add(this.settingsButton)
this.window.add(this.channelSwitcher); .add(this.channelSwitcher)
this.window.add(this.channelInfoButton); .add(this.channelInfoButton)
this.window.add(this.searchButton); .add(this.searchButton)
this.window.add(this.messageList); .add(this.messageList)
this.window.add(this.messageInput); .add(this.messageInput)
this.window.add(this.fileInput); .add(this.fileInput)
this.window.add(this.imageInput); .add(this.imageInput)
this.window.add(this.voiceMessageInput); .add(this.voiceMessageInput);
this.channelSwitcher.getElement().addEventListener("change", (e) => this.handleChannelSwitcher(e)); this.channelSwitcher.getElement().addEventListener("change", (e) => this.handleChannelSwitcher(e));
this.voiceMessageInput.onClick(async () => this.handleVoiceMessageButton()); this.voiceMessageInput.onClick(async () => this.handleVoiceMessageButton());
@ -581,8 +581,9 @@ export class MainView extends View {
} }
private handleHotkey(e: KeyboardEvent) { private handleHotkey(e: KeyboardEvent) {
if (e.ctrlKey || e.metaKey) {
const action = this.hotkeyMap.get(e.key); if (e.ctrlKey && e.shiftKey) {
const action = this.hotkeyMap.get(e.key.toLowerCase());
if (action) { if (action) {
e.preventDefault(); e.preventDefault();
action(); action();