Structural refactoring (#68)
* Moved html in scss to separate files * Moved components to designated folders * Moved logic from html to ts
This commit is contained in:
committed by
József Farkas
parent
036c2d0a70
commit
baaec669e0
11
src/components/svg/keyboard/svg-keyboard.component.html
Normal file
11
src/components/svg/keyboard/svg-keyboard.component.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" [attr.viewBox]="svgAttributes.viewBox" height="100%" width="100%">
|
||||
<svg:g [attr.transform]="svgAttributes.transform" [attr.fill]="svgAttributes.fill">
|
||||
<svg:g svg-module *ngFor="let module of modules; let i = index"
|
||||
[coverages]="module.coverages"
|
||||
[keyboardKeys]="module.keyboardKeys"
|
||||
[attr.transform]="module.attributes.transform"
|
||||
[keyActions]="moduleConfig[i].keyActions.elements"
|
||||
(editKeyActionRequest)="onEditKeyActionRequest(i, $event)"
|
||||
/>
|
||||
</svg:g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 602 B |
6
src/components/svg/keyboard/svg-keyboard.component.scss
Normal file
6
src/components/svg/keyboard/svg-keyboard.component.scss
Normal file
@@ -0,0 +1,6 @@
|
||||
:host {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
37
src/components/svg/keyboard/svg-keyboard.component.ts
Normal file
37
src/components/svg/keyboard/svg-keyboard.component.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
|
||||
|
||||
import {Module} from '../../../../config-serializer/config-items/Module';
|
||||
import {SvgModule} from '../module/svg-module.model';
|
||||
import {SvgModuleComponent} from '../module/svg-module.component';
|
||||
import {DataProviderService} from '../../../services/data-provider.service';
|
||||
|
||||
@Component({
|
||||
selector: 'svg-keyboard',
|
||||
template: require('./svg-keyboard.component.html'),
|
||||
styles: [require('./svg-keyboard.component.scss')],
|
||||
directives: [SvgModuleComponent]
|
||||
})
|
||||
export class SvgKeyboardComponent implements OnInit {
|
||||
@Input() moduleConfig: Module[];
|
||||
@Output() keyClick = new EventEmitter();
|
||||
|
||||
private modules: SvgModule[];
|
||||
private svgAttributes: { viewBox: string, transform: string, fill: string };
|
||||
|
||||
constructor(private dps: DataProviderService) {
|
||||
this.modules = [];
|
||||
this.svgAttributes = this.dps.getKeyboardSvgAttributes();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.modules = this.dps.getSvgModules();
|
||||
}
|
||||
|
||||
onEditKeyActionRequest(moduleId: number, keyId: number): void {
|
||||
this.keyClick.emit({
|
||||
moduleId,
|
||||
keyId
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user