feat: display OS-specific modifiers (#764)
* chore: git ignore "out-tsc/" folder in uhk-web package * feat: add OperationSystem calculation to the app reducer * feat: create os specific key modifier * feat: Os specific texts * revert: KeyModifierValues and getKeyModifiers selector * refactor: remove unnecessary return * refactor: rename OperationSystem => OperatingSystem
This commit is contained in:
committed by
László Monda
parent
aba0b09109
commit
3e4d439852
@@ -43,4 +43,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,8 +29,18 @@ export class KeypressTabComponent extends Tab implements OnChanges {
|
||||
|
||||
constructor(private mapper: MapperService) {
|
||||
super();
|
||||
this.leftModifiers = ['LShift', 'LCtrl', 'LSuper', 'LAlt'];
|
||||
this.rightModifiers = ['RShift', 'RCtrl', 'RSuper', 'RAlt'];
|
||||
this.leftModifiers = [
|
||||
'LShift',
|
||||
'LCtrl',
|
||||
mapper.getOsSpecificText('LSuper'),
|
||||
mapper.getOsSpecificText('LAlt')
|
||||
];
|
||||
this.rightModifiers = [
|
||||
'RShift',
|
||||
'RCtrl',
|
||||
mapper.getOsSpecificText('RSuper'),
|
||||
mapper.getOsSpecificText('RAlt')
|
||||
];
|
||||
this.scanCodeGroups = [{
|
||||
id: '0',
|
||||
text: 'None'
|
||||
|
||||
@@ -27,6 +27,7 @@ import { MapperService } from '../../../../services/mapper.service';
|
||||
import { AppState } from '../../../../store';
|
||||
import { getMacros } from '../../../../store/reducers/user-configuration';
|
||||
import { SvgKeyCaptureEvent, SvgKeyClickEvent } from '../../../../models/svg-key-events';
|
||||
import { OperatingSystem } from '../../../../models/operating-system';
|
||||
|
||||
enum LabelTypes {
|
||||
KeystrokeKey,
|
||||
@@ -293,29 +294,32 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
} else if (keyAction.hasOnlyOneActiveModifier() && !keyAction.hasScancode()) {
|
||||
newLabelSource = [];
|
||||
switch (keyAction.modifierMask) {
|
||||
case KeyModifiers.leftCtrl:
|
||||
case KeyModifiers.rightCtrl:
|
||||
newLabelSource.push('Ctrl');
|
||||
this.labelSource = ['Ctrl'];
|
||||
break;
|
||||
case KeyModifiers.leftShift:
|
||||
case KeyModifiers.rightShift:
|
||||
newLabelSource.push('Shift');
|
||||
this.labelSource = ['Shift'];
|
||||
break;
|
||||
case KeyModifiers.leftAlt:
|
||||
case KeyModifiers.rightAlt:
|
||||
newLabelSource.push('Alt');
|
||||
this.labelSource = [this.mapper.getOsSpecificText('Alt')];
|
||||
break;
|
||||
case KeyModifiers.leftGui:
|
||||
case KeyModifiers.rightGui:
|
||||
newLabelSource.push('Super');
|
||||
if (this.mapper.getOperatingSystem() === OperatingSystem.Windows) {
|
||||
this.labelSource = this.mapper.getIcon('command');
|
||||
this.labelType = LabelTypes.SingleIcon;
|
||||
} else {
|
||||
this.labelSource = [this.mapper.getOsSpecificText('Super')];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
newLabelSource.push('Undefined');
|
||||
this.labelSource = ['Undefined'];
|
||||
break;
|
||||
}
|
||||
this.labelSource = newLabelSource;
|
||||
} else {
|
||||
this.labelType = LabelTypes.KeystrokeKey;
|
||||
this.labelSource = this.keyAction;
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
</svg>
|
||||
<svg viewBox="0 0 100 100" [attr.width]="option.width" [attr.height]="option.height" [attr.x]="option.x" [attr.y]="option.y"
|
||||
preserveAspectRatio="none" [class.disabled]="option.disabled">
|
||||
<svg:use [attr.xlink:href]="modifierIconNames.option" />
|
||||
<svg:use *ngIf="modifierIconNames.option" [attr.xlink:href]="modifierIconNames.option" />
|
||||
<svg:text *ngIf="!modifierIconNames.option" [attr.text-anchor]="'middle'" [attr.x]="50" [attr.y]="50">A</svg:text>
|
||||
</svg>
|
||||
<svg viewBox="0 0 100 100" [attr.width]="command.width" [attr.height]="command.height" [attr.x]="command.x" [attr.y]="command.y"
|
||||
preserveAspectRatio="none" [class.disabled]="command.disabled">
|
||||
<svg:use [attr.xlink:href]="modifierIconNames.command" />
|
||||
<svg:use *ngIf="modifierIconNames.command" [attr.xlink:href]="modifierIconNames.command" />
|
||||
<svg:text *ngIf="!modifierIconNames.command" [attr.text-anchor]="'middle'" [attr.x]="50" [attr.y]="50">S</svg:text>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.3 KiB |
Reference in New Issue
Block a user