refactor: enum for keyboards
This commit is contained in:
@@ -64,12 +64,10 @@ pub fn run() {
|
|||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
|
#![allow(deprecated)]
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
||||||
use windows::Win32::Foundation::HWND;
|
use windows::Win32::Foundation::HWND;
|
||||||
use windows::Win32::UI::WindowsAndMessaging::{
|
use windows::Win32::UI::WindowsAndMessaging::{GetWindowLongPtrW, SetWindowLongPtrW, GWL_EXSTYLE, WS_EX_NOACTIVATE,};
|
||||||
GetWindowLongPtrW, SetWindowLongPtrW, SetWindowPos, GWL_EXSTYLE, HWND_TOPMOST,
|
|
||||||
SWP_NOACTIVATE, WS_EX_NOACTIVATE,
|
|
||||||
};
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if let Ok(RawWindowHandle::Win32(handle)) = window.raw_window_handle() {
|
if let Ok(RawWindowHandle::Win32(handle)) = window.raw_window_handle() {
|
||||||
|
|||||||
@@ -2,27 +2,27 @@
|
|||||||
<!-- Layout Switcher -->
|
<!-- Layout Switcher -->
|
||||||
<div class="layout-controls">
|
<div class="layout-controls">
|
||||||
<button (click)="switchLayout()" class="layout-button">
|
<button (click)="switchLayout()" class="layout-button">
|
||||||
Switch Layout: {{ currentLayout.toUpperCase() }}
|
Switch Layout: {{ currentLayout.toString() }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Conditional Rendering basierend auf currentLayout -->
|
<!-- Conditional Rendering basierend auf currentLayout -->
|
||||||
<app-qwerty-keyboard
|
<app-qwerty-keyboard
|
||||||
*ngIf="currentLayout === 'qwerty'"
|
*ngIf="currentLayout === Keyboards.QWERTY"
|
||||||
[shiftActive]="shiftActive"
|
[shiftActive]="shiftActive"
|
||||||
(keyPressed)="handleKeyPress($event)"
|
(keyPressed)="handleKeyPress($event)"
|
||||||
(shiftToggled)="toggleShift()">
|
(shiftToggled)="toggleShift()">
|
||||||
</app-qwerty-keyboard>
|
</app-qwerty-keyboard>
|
||||||
|
|
||||||
<app-dvorak-keyboard
|
<app-dvorak-keyboard
|
||||||
*ngIf="currentLayout === 'dvorak'"
|
*ngIf="currentLayout === Keyboards.DVORAK"
|
||||||
[shiftActive]="shiftActive"
|
[shiftActive]="shiftActive"
|
||||||
(keyPressed)="handleKeyPress($event)"
|
(keyPressed)="handleKeyPress($event)"
|
||||||
(shiftToggled)="toggleShift()">
|
(shiftToggled)="toggleShift()">
|
||||||
</app-dvorak-keyboard>
|
</app-dvorak-keyboard>
|
||||||
|
|
||||||
<app-circle-keyboard
|
<app-circle-keyboard
|
||||||
*ngIf="currentLayout === 'circle'"
|
*ngIf="currentLayout === Keyboards.CIRCLE"
|
||||||
[shiftActive]="shiftActive"
|
[shiftActive]="shiftActive"
|
||||||
(keyPressed)="handleKeyPress($event)"
|
(keyPressed)="handleKeyPress($event)"
|
||||||
(shiftToggled)="toggleShift()">
|
(shiftToggled)="toggleShift()">
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ import { CircleKeyboardComponent } from './keyboards/circle-keyboard.component';
|
|||||||
styleUrl: './app.component.css',
|
styleUrl: './app.component.css',
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
async ngOnInit() {
|
Keyboards = Keyboards;
|
||||||
const matches = await getMatches();
|
currentLayout: Keyboards = Keyboards.QWERTY;
|
||||||
console.log(matches);
|
|
||||||
}
|
|
||||||
greetingMessage = "";
|
|
||||||
currentLayout: 'qwerty' | 'dvorak' | 'circle' = 'qwerty';
|
|
||||||
shiftActive = false;
|
shiftActive = false;
|
||||||
|
async ngOnInit() {
|
||||||
|
|
||||||
|
const cli = await getMatches();
|
||||||
|
}
|
||||||
|
|
||||||
@ViewChild('greetInput') inputElement!: ElementRef;
|
@ViewChild('greetInput') inputElement!: ElementRef;
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switchLayout(): void {
|
switchLayout(): void {
|
||||||
if (this.currentLayout == 'qwerty'){
|
if (this.currentLayout === Keyboards.QWERTY){
|
||||||
this.currentLayout = 'dvorak';
|
this.currentLayout = Keyboards.DVORAK;
|
||||||
} else if (this.currentLayout == 'dvorak'){
|
} else if (this.currentLayout === Keyboards.DVORAK){
|
||||||
this.currentLayout = 'circle';
|
this.currentLayout = Keyboards.CIRCLE;
|
||||||
} else if (this.currentLayout == 'circle'){
|
} else if (this.currentLayout === Keyboards.CIRCLE){
|
||||||
this.currentLayout = 'qwerty';
|
this.currentLayout = Keyboards.QWERTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,3 +59,8 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
enum Keyboards{
|
||||||
|
QWERTY,
|
||||||
|
DVORAK,
|
||||||
|
CIRCLE
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user