Issue 201 - Mark selected key with blue (#290)
* issue-201: initial try * revert: remove first solution related changes * feature: change the colour of selected key to blue (empty key selection case not covered) * typescript: prevent errors in editors due to missing tsconfig for shared * cleanup: remove unused import * fix: solve empty key case, pass down selected layerId, moduleId and keyId * cleanup: remove console.log statement * cleanup: remove extra line * review: animation delay shorter, exactly as short as the animation delay of the popover * review: prevent remaining signature blue when click twice on a key in rapid succession * review: right signature colour after blending (http://colorblendy.com/#!/multiply/4099e5/cccccc) * review comments fixes * review: use simplified condition with help of ‘?’
@@ -3,6 +3,8 @@
|
|||||||
[moduleConfig]="layer.modules"
|
[moduleConfig]="layer.modules"
|
||||||
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
||||||
[capturingEnabled]="capturingEnabled"
|
[capturingEnabled]="capturingEnabled"
|
||||||
|
[selectedKey]="selectedKey"
|
||||||
|
[selected]="selectedKey?.layerId === index"
|
||||||
(keyClick)="keyClick.emit($event)"
|
(keyClick)="keyClick.emit($event)"
|
||||||
(keyHover)="keyHover.emit($event)"
|
(keyHover)="keyHover.emit($event)"
|
||||||
(capture)="capture.emit($event)"
|
(capture)="capture.emit($event)"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 478 B |
@@ -80,6 +80,7 @@ export class KeyboardSliderComponent implements OnChanges {
|
|||||||
@Input() currentLayer: number;
|
@Input() currentLayer: number;
|
||||||
@Input() keybindAnimationEnabled: boolean;
|
@Input() keybindAnimationEnabled: boolean;
|
||||||
@Input() capturingEnabled: boolean;
|
@Input() capturingEnabled: boolean;
|
||||||
|
@Input() selectedKey: { layerId: number, moduleId: number, keyId: number };
|
||||||
@Output() keyClick = new EventEmitter();
|
@Output() keyClick = new EventEmitter();
|
||||||
@Output() keyHover = new EventEmitter();
|
@Output() keyHover = new EventEmitter();
|
||||||
@Output() capture = new EventEmitter();
|
@Output() capture = new EventEmitter();
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
[capturingEnabled]="capturingEnabled"
|
[capturingEnabled]="capturingEnabled"
|
||||||
[attr.transform]="module.attributes.transform"
|
[attr.transform]="module.attributes.transform"
|
||||||
[keyActions]="moduleConfig[i].keyActions"
|
[keyActions]="moduleConfig[i].keyActions"
|
||||||
|
[selectedKey]="selectedKey"
|
||||||
|
[selected]="selectedKey?.moduleId === i"
|
||||||
(keyClick)="onKeyClick(i, $event.index, $event.keyTarget)"
|
(keyClick)="onKeyClick(i, $event.index, $event.keyTarget)"
|
||||||
(keyHover)="onKeyHover($event.index, $event.event, $event.over, i)"
|
(keyHover)="onKeyHover($event.index, $event.event, $event.over, i)"
|
||||||
(capture)="onCapture(i, $event.index, $event.captured)"
|
(capture)="onCapture(i, $event.index, $event.captured)"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 806 B |
@@ -18,6 +18,8 @@ export class SvgKeyboardComponent implements OnInit {
|
|||||||
@Input() moduleConfig: Module[];
|
@Input() moduleConfig: Module[];
|
||||||
@Input() keybindAnimationEnabled: boolean;
|
@Input() keybindAnimationEnabled: boolean;
|
||||||
@Input() capturingEnabled: boolean;
|
@Input() capturingEnabled: boolean;
|
||||||
|
@Input() selectedKey: { layerId: number, moduleId: number, keyId: number };
|
||||||
|
@Input() selected: boolean;
|
||||||
@Output() keyClick = new EventEmitter();
|
@Output() keyClick = new EventEmitter();
|
||||||
@Output() keyHover = new EventEmitter();
|
@Output() keyHover = new EventEmitter();
|
||||||
@Output() capture = new EventEmitter();
|
@Output() capture = new EventEmitter();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<svg:rect [@change]="changeAnimation"
|
<svg:rect [@change]="changeAnimation"
|
||||||
(@change.done)="onChangeAnimationDone()"
|
(@change.done)="onChangeAnimationDone()"
|
||||||
|
[@active]="active"
|
||||||
[id]="id" [attr.rx]="rx" [attr.ry]="ry"
|
[id]="id" [attr.rx]="rx" [attr.ry]="ry"
|
||||||
[attr.height]="height" [attr.width]="width"
|
[attr.height]="height" [attr.width]="width"
|
||||||
[attr.fill]="fill"
|
[attr.fill]="fill"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.5 KiB |
@@ -48,6 +48,12 @@ enum LabelTypes {
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
trigger('active', [
|
||||||
|
// http://colorblendy.com/#!/multiply/4099e5/cccccc
|
||||||
|
state('1', style({ fill: '#4099e5' })), // Signature blue color blending
|
||||||
|
transition('1 => *', animate('200ms')),
|
||||||
|
transition('* => 1', animate('0ms')) // Instant color to blue
|
||||||
|
]),
|
||||||
trigger('recording', [
|
trigger('recording', [
|
||||||
state('inactive', style({
|
state('inactive', style({
|
||||||
fill: 'rgba(204, 0, 0, 1)'
|
fill: 'rgba(204, 0, 0, 1)'
|
||||||
@@ -71,6 +77,8 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
@Input() keyAction: KeyAction;
|
@Input() keyAction: KeyAction;
|
||||||
@Input() keybindAnimationEnabled: boolean;
|
@Input() keybindAnimationEnabled: boolean;
|
||||||
@Input() capturingEnabled: boolean;
|
@Input() capturingEnabled: boolean;
|
||||||
|
@Input() active: boolean;
|
||||||
|
|
||||||
@Output() keyClick = new EventEmitter();
|
@Output() keyClick = new EventEmitter();
|
||||||
@Output() capture = new EventEmitter();
|
@Output() capture = new EventEmitter();
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
[attr.transform]="'translate(' + key.x + ' ' + key.y + ')'"
|
[attr.transform]="'translate(' + key.x + ' ' + key.y + ')'"
|
||||||
[attr.fill]="key.fill"
|
[attr.fill]="key.fill"
|
||||||
[keyAction]="keyActions[i]"
|
[keyAction]="keyActions[i]"
|
||||||
|
[active]="selected && i == selectedKey.keyId"
|
||||||
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
||||||
[capturingEnabled]="capturingEnabled"
|
[capturingEnabled]="capturingEnabled"
|
||||||
(keyClick)="onKeyClick(i, $event)"
|
(keyClick)="onKeyClick(i, $event)"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 884 B |
@@ -14,6 +14,8 @@ export class SvgModuleComponent {
|
|||||||
@Input() coverages: any[];
|
@Input() coverages: any[];
|
||||||
@Input() keyboardKeys: SvgKeyboardKey[];
|
@Input() keyboardKeys: SvgKeyboardKey[];
|
||||||
@Input() keyActions: KeyAction[];
|
@Input() keyActions: KeyAction[];
|
||||||
|
@Input() selectedKey: { layerId: number, moduleId: number, keyId: number };
|
||||||
|
@Input() selected: boolean;
|
||||||
@Input() keybindAnimationEnabled: boolean;
|
@Input() keybindAnimationEnabled: boolean;
|
||||||
@Input() capturingEnabled: boolean;
|
@Input() capturingEnabled: boolean;
|
||||||
@Output() keyClick = new EventEmitter();
|
@Output() keyClick = new EventEmitter();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
[currentLayer]="currentLayer"
|
[currentLayer]="currentLayer"
|
||||||
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
[keybindAnimationEnabled]="keybindAnimationEnabled"
|
||||||
[capturingEnabled]="popoverEnabled"
|
[capturingEnabled]="popoverEnabled"
|
||||||
|
[selectedKey]="selectedKey"
|
||||||
(keyClick)="onKeyClick($event.moduleId, $event.keyId, $event.keyTarget)"
|
(keyClick)="onKeyClick($event.moduleId, $event.keyId, $event.keyTarget)"
|
||||||
(keyHover)="onKeyHover($event.moduleId, $event.event, $event.over, $event.keyId)"
|
(keyHover)="onKeyHover($event.moduleId, $event.event, $event.over, $event.keyId)"
|
||||||
(capture)="onCapture($event.moduleId, $event.keyId, $event.captured)"
|
(capture)="onCapture($event.moduleId, $event.keyId, $event.captured)"
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
private popoverShown: boolean;
|
private popoverShown: boolean;
|
||||||
private keyEditConfig: { moduleId: number, keyId: number };
|
private keyEditConfig: { moduleId: number, keyId: number };
|
||||||
|
private selectedKey: { layerId: number, moduleId: number, keyId: number };
|
||||||
private popoverInitKeyAction: KeyAction;
|
private popoverInitKeyAction: KeyAction;
|
||||||
private keybindAnimationEnabled: boolean;
|
private keybindAnimationEnabled: boolean;
|
||||||
private currentLayer: number = 0;
|
private currentLayer: number = 0;
|
||||||
@@ -136,7 +137,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
moduleId,
|
moduleId,
|
||||||
keyId
|
keyId
|
||||||
};
|
};
|
||||||
|
this.selectedKey = { layerId: this.currentLayer, moduleId, keyId };
|
||||||
const keyActionToEdit: KeyAction = this.layers[this.currentLayer].modules[moduleId].keyActions[keyId];
|
const keyActionToEdit: KeyAction = this.layers[this.currentLayer].modules[moduleId].keyActions[keyId];
|
||||||
this.keyElement = keyTarget;
|
this.keyElement = keyTarget;
|
||||||
this.showPopover(keyActionToEdit);
|
this.showPopover(keyActionToEdit);
|
||||||
@@ -224,6 +225,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
hidePopover(): void {
|
hidePopover(): void {
|
||||||
this.popoverShown = false;
|
this.popoverShown = false;
|
||||||
|
this.selectedKey = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectLayer(index: number): void {
|
selectLayer(index: number): void {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"sourceMap": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"removeComments": false,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"../../node_modules/@types"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"jquery",
|
||||||
|
"core-js",
|
||||||
|
"select2",
|
||||||
|
"file-saver"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"config-serializer"
|
||||||
|
]
|
||||||
|
}
|
||||||