Fix tslint and related errors.

This commit is contained in:
József Farkas
2016-04-13 21:30:55 +02:00
parent 9b040c6665
commit 5542b66871
10 changed files with 26 additions and 25 deletions

View File

@@ -31,4 +31,4 @@ export class KeyboardButtonGroupComponent implements OnInit {
ngOnInit() { }
}
}

View File

@@ -13,7 +13,7 @@ import { Component, OnInit, Input } from 'angular2/core';
:host {
display: flex;
}
`],
`]
})
export class KeyboardButtonComponent implements OnInit {
@Input() id: string;
@@ -27,4 +27,4 @@ export class KeyboardButtonComponent implements OnInit {
ngOnInit() { }
}
}

View File

@@ -7,4 +7,4 @@ export interface KeyboardButton {
height: string;
width: string;
fill: string;
}
}

View File

@@ -7,7 +7,11 @@ import {Module, ModuleComponent} from './module';
selector: 'keyboard',
template:
`
<module *ngIf="modules.length > 0" [case]="modules[0].case" [keyboardButtons]="modules[0].keyboardButtons" [fill]="modules[0].fill"></module>
<module *ngIf="modules.length > 0"
[case]="modules[0].case"
[keyboardButtons]="modules[0].keyboardButtons"
[fill]="modules[0].fill">
</module>
`,
styles:
[`
@@ -31,8 +35,8 @@ export class KeyboardComponent implements OnInit {
}
private loadKeyboardModules(): void {
var svg: any = this.dps.getBaseLayer();
let svg: any = this.dps.getBaseLayer();
this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill));
}
}
}

View File

@@ -30,27 +30,25 @@ export class ModuleComponent implements OnInit {
ngOnInit() {
this.getButtonGroups().forEach(buttonGroup => {
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, "row").then((bttnComponentRef: ComponentRef) => {
var group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
group.keyboardButtons = buttonGroup;
// console.log(keyboardButtonComponent);
});
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, 'row')
.then((bttnComponentRef: ComponentRef) => {
let group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
group.keyboardButtons = buttonGroup;
});
});
}
private getButtonGroups(): KeyboardButton[][] {
var buttonGroups: KeyboardButton[][] = [];
var buttonGroup: KeyboardButton[] = [];
this.keyboardButtons.forEach((keyboardButton, index) => {
let buttonGroups: KeyboardButton[][] = [];
let buttonGroup: KeyboardButton[] = [];
this.keyboardButtons.forEach(keyboardButton => {
if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) {
buttonGroups.push(buttonGroup);
buttonGroup = [];
}
buttonGroup.push(keyboardButton);
});
//console.log(buttonGroups, buttonGroup, this.keyboardButtons);
return buttonGroups;
}
}
}

View File

@@ -5,8 +5,8 @@ export class Module {
private keyboardButtons: KeyboardButton[];
constructor(obj: { rect: any[], path: any[] }, fill?: string) {
this.keyboardButtons = obj.rect.map(obj => obj.$);
this.keyboardButtons = obj.rect.map(rect => rect.$);
this.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black');
this.case = obj.path[0].$;
}
}
}

View File

@@ -1,3 +1,3 @@
import {Module} from './module.model';
import {ModuleComponent} from './module.component';
export {Module, ModuleComponent};
export {Module, ModuleComponent};