fix: uncheck 'Remap on all keyboard' and 'Remap on all layer' checkbox by default (#754)
* fix: uncheck 'Remap on all keyboard' and 'Remap on all layer' checkbox by default * fix: popover checkbox checked state
This commit is contained in:
committed by
László Monda
parent
b5cff2fa93
commit
475ec71983
@@ -81,14 +81,14 @@
|
|||||||
<label>
|
<label>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="remapOnAllKeymap"
|
name="remapOnAllKeymap"
|
||||||
[(ngModel)]="remapOnAllKeymap"> Remap on all keymaps
|
[(ngModel)]="remapInfo.remapOnAllKeymap"> Remap on all keymaps
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="remapOnAllLayer"
|
name="remapOnAllLayer"
|
||||||
[(ngModel)]="remapOnAllLayer"> Remap on all layers
|
[(ngModel)]="remapInfo.remapOnAllLayer"> Remap on all layers
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-inline-block">
|
<div class="d-inline-block">
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { Tab } from './tab';
|
|||||||
import { AppState } from '../../store';
|
import { AppState } from '../../store';
|
||||||
import { getKeymaps } from '../../store/reducers/user-configuration';
|
import { getKeymaps } from '../../store/reducers/user-configuration';
|
||||||
import { KeyActionRemap } from '../../models/key-action-remap';
|
import { KeyActionRemap } from '../../models/key-action-remap';
|
||||||
|
import { RemapInfo } from '../../models/remap-info';
|
||||||
|
|
||||||
enum TabName {
|
enum TabName {
|
||||||
Keypress,
|
Keypress,
|
||||||
@@ -84,8 +85,7 @@ export class PopoverComponent implements OnChanges {
|
|||||||
@Input() wrapPosition: any;
|
@Input() wrapPosition: any;
|
||||||
@Input() visible: boolean;
|
@Input() visible: boolean;
|
||||||
@Input() allowLayerDoubleTap: boolean;
|
@Input() allowLayerDoubleTap: boolean;
|
||||||
@Input() remapOnAllKeymap: boolean;
|
@Input() remapInfo: RemapInfo;
|
||||||
@Input() remapOnAllLayer: boolean;
|
|
||||||
|
|
||||||
@Output() cancel = new EventEmitter<any>();
|
@Output() cancel = new EventEmitter<any>();
|
||||||
@Output() remap = new EventEmitter<KeyActionRemap>();
|
@Output() remap = new EventEmitter<KeyActionRemap>();
|
||||||
@@ -160,8 +160,8 @@ export class PopoverComponent implements OnChanges {
|
|||||||
if (this.keyActionValid) {
|
if (this.keyActionValid) {
|
||||||
try {
|
try {
|
||||||
this.remap.emit({
|
this.remap.emit({
|
||||||
remapOnAllKeymap: this.remapOnAllKeymap,
|
remapOnAllKeymap: this.remapInfo.remapOnAllKeymap,
|
||||||
remapOnAllLayer: this.remapOnAllLayer,
|
remapOnAllLayer: this.remapInfo.remapOnAllLayer,
|
||||||
action: this.selectedTab.toKeyAction()
|
action: this.selectedTab.toKeyAction()
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
shiftPressed: this.pressedShiftLocation > -1,
|
shiftPressed: this.pressedShiftLocation > -1,
|
||||||
altPressed: this.pressedAltLocation > -1
|
altPressed: this.pressedAltLocation > -1
|
||||||
});
|
});
|
||||||
|
this.pressedShiftLocation = -1;
|
||||||
|
this.pressedAltLocation = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('mousedown', ['$event'])
|
@HostListener('mousedown', ['$event'])
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
[currentKeymap]="keymap"
|
[currentKeymap]="keymap"
|
||||||
[currentLayer]="currentLayer"
|
[currentLayer]="currentLayer"
|
||||||
[allowLayerDoubleTap]="allowLayerDoubleTap"
|
[allowLayerDoubleTap]="allowLayerDoubleTap"
|
||||||
[remapOnAllKeymap]="remapOnAllKeymap"
|
[remapInfo]="remapInfo"
|
||||||
[remapOnAllLayer]="remapOnAllLayer"
|
|
||||||
(cancel)="hidePopover()"
|
(cancel)="hidePopover()"
|
||||||
(remap)="onRemap($event)"></popover>
|
(remap)="onRemap($event)"></popover>
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import {
|
|||||||
SvgKeyboardKeyClickEvent,
|
SvgKeyboardKeyClickEvent,
|
||||||
SvgKeyHoverEvent
|
SvgKeyHoverEvent
|
||||||
} from '../../../models/svg-key-events';
|
} from '../../../models/svg-key-events';
|
||||||
|
import { RemapInfo } from '../../../models/remap-info';
|
||||||
|
|
||||||
interface NameValuePair {
|
interface NameValuePair {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -87,8 +88,10 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
layers: Layer[];
|
layers: Layer[];
|
||||||
keyPosition: ClientRect;
|
keyPosition: ClientRect;
|
||||||
wrapPosition: ClientRect;
|
wrapPosition: ClientRect;
|
||||||
remapOnAllKeymap: boolean;
|
remapInfo: RemapInfo = {
|
||||||
remapOnAllLayer: boolean;
|
remapOnAllKeymap: false,
|
||||||
|
remapOnAllLayer: false
|
||||||
|
};
|
||||||
|
|
||||||
private wrapHost: HTMLElement;
|
private wrapHost: HTMLElement;
|
||||||
private keyElement: HTMLElement;
|
private keyElement: HTMLElement;
|
||||||
@@ -156,8 +159,10 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
this.selectedKey = {layerId: this.currentLayer, moduleId: event.moduleId, keyId: event.keyId};
|
this.selectedKey = {layerId: this.currentLayer, moduleId: event.moduleId, keyId: event.keyId};
|
||||||
const keyActionToEdit: KeyAction = this.layers[this.currentLayer].modules[event.moduleId].keyActions[event.keyId];
|
const keyActionToEdit: KeyAction = this.layers[this.currentLayer].modules[event.moduleId].keyActions[event.keyId];
|
||||||
this.keyElement = event.keyTarget;
|
this.keyElement = event.keyTarget;
|
||||||
this.remapOnAllKeymap = event.shiftPressed;
|
this.remapInfo = {
|
||||||
this.remapOnAllLayer = event.altPressed;
|
remapOnAllKeymap: event.shiftPressed,
|
||||||
|
remapOnAllLayer: event.altPressed
|
||||||
|
};
|
||||||
this.showPopover(keyActionToEdit);
|
this.showPopover(keyActionToEdit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
packages/uhk-web/src/app/models/remap-info.ts
Normal file
4
packages/uhk-web/src/app/models/remap-info.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export interface RemapInfo {
|
||||||
|
remapOnAllKeymap: boolean;
|
||||||
|
remapOnAllLayer: boolean;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user