Additional media keys with icons (#307)

* Add missing scancodes for media keystrokes

* Use icons for media keys

* Fix media scancodes.
This commit is contained in:
József Farkas
2017-06-12 20:46:06 +02:00
committed by László Monda
parent a8a659dadd
commit 1a456c2ced
4 changed files with 130 additions and 42 deletions

View File

@@ -567,31 +567,91 @@
},
{
"id": "128",
"text": "Volume Up"
"text": "Volume Up",
"additional": {
"type": "media",
"scancode": 233
}
},
{
"id": "129",
"text": "Volume Down"
"text": "Volume Down",
"additional": {
"type": "media",
"scancode": 234
}
},
{
"id": "",
"text": "Next Track"
"id": "130",
"text": "Next Track",
"additional": {
"type": "media",
"scancode": 181
}
},
{
"id": "",
"text": "Previous Track"
"id": "131",
"text": "Previous Track",
"additional": {
"type": "media",
"scancode": 182
}
},
{
"id": "",
"text": "Stop"
"id": "132",
"text": "Stop/Eject",
"additional": {
"type": "media",
"scancode": 204
}
},
{
"id": "",
"text": "Play/Pause"
"id": "133",
"text": "Play/Pause",
"additional": {
"type": "media",
"scancode": 205
}
},
{
"id": "",
"text": "Eject"
"id": "134",
"text": "Play",
"additional": {
"type": "media",
"scancode": 176
}
},
{
"id": "135",
"text": "Pause",
"additional": {
"type": "media",
"scancode": 177
}
},
{
"id": "136",
"text": "Stop",
"additional": {
"type": "media",
"scancode": 183
}
},
{
"id": "137",
"text": "Eject",
"additional": {
"type": "media",
"scancode": 184
}
},
{
"id": "138",
"text": "WWW",
"additional": {
"type": "media",
"scancode": 138
}
}
]
}

View File

@@ -221,8 +221,8 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
if (!keyAction.hasActiveModifier() && keyAction.hasScancode()) {
const scancode: number = keyAction.scancode;
newLabelSource = this.mapper.scanCodeToText(scancode, keyAction.type);
if (this.mapper.hasScancodeIcon(scancode)) {
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode);
if (this.mapper.hasScancodeIcon(scancode, keyAction.type)) {
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode, keyAction.type);
this.labelType = LabelTypes.SingleIcon;
} else if (newLabelSource !== undefined) {
if (newLabelSource.length === 1) {

View File

@@ -141,7 +141,7 @@ export class SvgKeystrokeKeyComponent implements OnInit, OnChanges {
this.labelType = 'two-line';
}
} else {
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode);
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode, this.keystrokeAction.type);
this.labelType = 'icon';
}
} else {