From 15cdc77eeacb28f241aa48affcd98f3006b81d03 Mon Sep 17 00:00:00 2001 From: lukasadrion Date: Mon, 1 Dec 2025 16:53:52 +0100 Subject: [PATCH] add DVORAK keyboard --- src/app/app.component.css | 2 +- src/app/app.component.html | 14 +++++++++++--- src/app/app.component.ts | 25 +++++++++++++++++++++---- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/app/app.component.css b/src/app/app.component.css index 20354c4..d6bf8c6 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -140,7 +140,7 @@ button { .key-button:hover { background: #979797; - border-color: #999; + border-color: #3d3d3d; } .key-button:active { diff --git a/src/app/app.component.html b/src/app/app.component.html index e654b54..f641c00 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -5,7 +5,7 @@

{{ greetingMessage }}

- +
- +
- +
+ + +
+ +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5f66c57..9c357c2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -29,16 +29,33 @@ export class AppComponent implements AfterViewInit { }); } - // Keyboard Layout - row1 = ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P']; - row2 = ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L']; - row3 = ['Z', 'X', 'C', 'V', 'B', 'N', 'M']; + // Keyboard Layout State + currentLayout: 'qwerty' | 'dvorak' = 'qwerty'; + + // QWERTY Layout + qwertyRow1 = ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P']; + qwertyRow2 = ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L']; + qwertyRow3 = ['Z', 'X', 'C', 'V', 'B', 'N', 'M', ",", "."]; + + // DVORAK Layout + dvorakRow1 = [',', '.', 'P', 'Y', 'F', 'G', 'C', 'R', 'L']; + dvorakRow2 = ['A', 'O', 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S']; + dvorakRow3 = ['Q', 'J', 'K', 'X', 'B', 'M', 'W', 'V', 'Z']; shiftActive = false; + + // Getters for current layout + get row1() { return this.currentLayout === 'qwerty' ? this.qwertyRow1 : this.dvorakRow1; } + get row2() { return this.currentLayout === 'qwerty' ? this.qwertyRow2 : this.dvorakRow2; } + get row3() { return this.currentLayout === 'qwerty' ? this.qwertyRow3 : this.dvorakRow3; } toggleShift(): void { this.shiftActive = !this.shiftActive; } + + switchLayout(): void { + this.currentLayout = this.currentLayout === 'qwerty' ? 'dvorak' : 'qwerty'; + } async sendKey(key: string): Promise { this.inputElement.nativeElement.focus();