Add coverages of modules
This commit is contained in:
@@ -10,7 +10,7 @@ import {Module, ModuleComponent} from './module';
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" [attr.viewBox]="viewBox" height="100%" width="100%">
|
<svg xmlns="http://www.w3.org/2000/svg" [attr.viewBox]="viewBox" height="100%" width="100%">
|
||||||
<svg:g [attr.transform]="transform">
|
<svg:g [attr.transform]="transform">
|
||||||
<svg:g uhk-module *ngFor="#module of modules"
|
<svg:g uhk-module *ngFor="#module of modules"
|
||||||
[case]="module.case"
|
[coverages]="module.coverages"
|
||||||
[keyboardKeys]="module.keyboardKeys"
|
[keyboardKeys]="module.keyboardKeys"
|
||||||
[fill]="module.fill"
|
[fill]="module.fill"
|
||||||
[attr.transform]="module.attributes.transform"
|
[attr.transform]="module.attributes.transform"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {KeyboardKeyComponent} from './keyboard-key.component';
|
|||||||
selector: 'g[uhk-module]',
|
selector: 'g[uhk-module]',
|
||||||
template:
|
template:
|
||||||
`
|
`
|
||||||
|
<svg:path *ngFor="#path of coverages" [attr.d]="path.$.d"/>
|
||||||
<svg:g uhk-keyboard-key *ngFor="#key of keyboardKeys"
|
<svg:g uhk-keyboard-key *ngFor="#key of keyboardKeys"
|
||||||
[id]="key.id" [fill]="key.fill"
|
[id]="key.id" [fill]="key.fill"
|
||||||
[rx]="key.rx" [ry]="key.ry"
|
[rx]="key.rx" [ry]="key.ry"
|
||||||
@@ -17,7 +18,7 @@ import {KeyboardKeyComponent} from './keyboard-key.component';
|
|||||||
directives: [KeyboardKeyComponent]
|
directives: [KeyboardKeyComponent]
|
||||||
})
|
})
|
||||||
export class ModuleComponent implements OnInit {
|
export class ModuleComponent implements OnInit {
|
||||||
@Input() case: any;
|
@Input() coverages: any[];
|
||||||
@Input() keyboardKeys: KeyboardKey[];
|
@Input() keyboardKeys: KeyboardKey[];
|
||||||
@Input() fill: string;
|
@Input() fill: string;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import {KeyboardKey} from './keyboard-key.model';
|
import {KeyboardKey} from './keyboard-key.model';
|
||||||
|
|
||||||
export class Module {
|
export class Module {
|
||||||
private case: any;
|
private coverages: any[];
|
||||||
private keyboardKeys: KeyboardKey[];
|
private keyboardKeys: KeyboardKey[];
|
||||||
private attributes: any;
|
private attributes: any;
|
||||||
|
|
||||||
constructor(obj: { rect: any[], path: any[], $: Object }, fill?: string) {
|
constructor(obj: { rect: any[], path: any[], $: Object }, fill?: string) {
|
||||||
this.keyboardKeys = obj.rect.map(rect => rect.$);
|
this.keyboardKeys = obj.rect.map(rect => rect.$);
|
||||||
this.keyboardKeys.forEach(keyboardKey => keyboardKey.fill = fill ? fill : 'black');
|
this.keyboardKeys.forEach(keyboardKey => keyboardKey.fill = fill ? fill : 'black');
|
||||||
this.case = obj.path[0].$;
|
this.coverages = obj.path;
|
||||||
this.attributes = obj.$;
|
this.attributes = obj.$;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user