diff --git a/src/components/svg-keyboard-popover.component.ts b/src/components/svg-keyboard-popover.component.ts
new file mode 100644
index 00000000..7c521400
--- /dev/null
+++ b/src/components/svg-keyboard-popover.component.ts
@@ -0,0 +1,48 @@
+import { Component, OnInit, Input} from '@angular/core';
+
+import {Module} from '../../config-serializer/config-items/Module';
+import {SvgKeyboardComponent} from './svg-keyboard.component';
+import {PopoverComponent} from './popover/popover.component';
+
+@Component({
+ selector: 'svg-keyboard-popover',
+ template:
+ `
+
+
+
+ `,
+ styles:
+ [`
+ :host {
+ display: flex;
+ width: 100%;
+ height: 100%;
+ position: relative;
+ }
+ `],
+ directives: [SvgKeyboardComponent, PopoverComponent]
+})
+export class SvgKeyboardPopoverComponent implements OnInit {
+ @Input() moduleConfig: Module[];
+
+ private popoverEnabled: boolean;
+
+ constructor() { }
+
+ ngOnInit() { }
+
+ onKeyClick(moduleId: number, keyId: number): void {
+ this.showPopover();
+ }
+
+ showPopover(): void {
+ this.popoverEnabled = true;
+ }
+
+ hidePopover(): void {
+ this.popoverEnabled = false;
+ }
+
+}
diff --git a/src/components/svg-keyboard.component.ts b/src/components/svg-keyboard.component.ts
index 7aad36c1..2d4f2845 100644
--- a/src/components/svg-keyboard.component.ts
+++ b/src/components/svg-keyboard.component.ts
@@ -1,9 +1,8 @@
-import { Component, OnInit, Input} from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
import {Module} from '../../config-serializer/config-items/Module';
import {SvgModule} from './svg-module.model';
import {SvgModuleComponent} from './svg-module.component';
-import {PopoverComponent} from './popover/popover.component';
import {DataProviderService} from '../services/data-provider.service';
@Component({
@@ -21,7 +20,6 @@ import {DataProviderService} from '../services/data-provider.service';
/>
-
`,
styles:
[`
@@ -32,13 +30,13 @@ import {DataProviderService} from '../services/data-provider.service';
position: relative;
}
`],
- directives: [SvgModuleComponent, PopoverComponent]
+ directives: [SvgModuleComponent]
})
export class SvgKeyboardComponent implements OnInit {
@Input() moduleConfig: Module[];
+ @Output() keyClick = new EventEmitter();
private modules: SvgModule[];
- private popoverEnabled: boolean;
private svgAttributes: { viewBox: string, transform: string, fill: string };
constructor(private dps: DataProviderService) {
@@ -51,15 +49,10 @@ export class SvgKeyboardComponent implements OnInit {
}
onEditKeyActionRequest(moduleId: number, keyId: number): void {
- this.showPopover();
- }
-
- showPopover(): void {
- this.popoverEnabled = true;
- }
-
- hidePopover(): void {
- this.popoverEnabled = false;
+ this.keyClick.emit({
+ moduleId,
+ keyId
+ });
}
}
diff --git a/src/main-app.component.scss b/src/main-app.component.scss
index 4ed0b28b..c1b9e65b 100644
--- a/src/main-app.component.scss
+++ b/src/main-app.component.scss
@@ -21,7 +21,7 @@ button {
position: relative;
}
-:host > div:last-child > svg-keyboard {
+:host > div:last-child > svg-keyboard-popover {
width: 80%;
position: absolute;
left: 50%;
diff --git a/src/main-app.component.ts b/src/main-app.component.ts
index ba5a3a23..f4643355 100644
--- a/src/main-app.component.ts
+++ b/src/main-app.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit, AfterViewInit, Renderer, ViewChildren, QueryList, El
import {Layers} from '../config-serializer/config-items/Layers';
-import {SvgKeyboardComponent} from './components/svg-keyboard.component';
+import {SvgKeyboardPopoverComponent} from './components/svg-keyboard-popover.component';
import {UhkConfigurationService} from './services/uhk-configuration.service';
@Component({
@@ -24,22 +24,22 @@ import {UhkConfigurationService} from './services/uhk-configuration.service';
-
-
+
`,
styles: [require('./main-app.component.scss')],
- directives: [SvgKeyboardComponent],
+ directives: [SvgKeyboardPopoverComponent],
providers: [UhkConfigurationService]
})
export class MainAppComponent implements OnInit, AfterViewInit {
@ViewChildren('baseButton,modButton,fnButton,mouseButton')
buttonsQueryList: QueryList;
- @ViewChildren(SvgKeyboardComponent, { read: ElementRef })
+ @ViewChildren(SvgKeyboardPopoverComponent, { read: ElementRef })
keyboardsQueryList: QueryList;
private buttons: ElementRef[];