Removed unnecessary services (#125)

They have been replaced with Store.
This commit is contained in:
Nejc Zdovc
2016-10-21 16:36:41 +02:00
committed by József Farkas
parent b16e83fc30
commit a653333c9b
8 changed files with 78 additions and 102 deletions
@@ -3,8 +3,6 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Module } from '../../../config-serializer/config-items/Module';
import { SvgModule } from '../module';
import { DataProviderService } from '../../../services/data-provider.service';
@Component({
selector: 'svg-keyboard',
template: require('./svg-keyboard.component.html'),
@@ -18,13 +16,13 @@ export class SvgKeyboardComponent implements OnInit {
private modules: SvgModule[];
private svgAttributes: { viewBox: string, transform: string, fill: string };
constructor(private dps: DataProviderService) {
constructor() {
this.modules = [];
this.svgAttributes = this.dps.getKeyboardSvgAttributes();
this.svgAttributes = this.getKeyboardSvgAttributes();
}
ngOnInit() {
this.modules = this.dps.getSvgModules();
this.modules = this.getSvgModules();
}
onKeyClick(moduleId: number, keyId: number): void {
@@ -43,4 +41,22 @@ export class SvgKeyboardComponent implements OnInit {
});
}
private getKeyboardSvgAttributes(): { viewBox: string, transform: string, fill: string } {
let svg: any = this.getBaseLayer();
return {
viewBox: svg.$.viewBox,
transform: svg.g[0].$.transform,
fill: svg.g[0].$.fill
};
}
private getSvgModules(): SvgModule[] {
let modules = this.getBaseLayer().g[0].g.map((obj: any) => new SvgModule(obj));
return [modules[1], modules[0]]; // TODO: remove if the svg will be correct
}
private getBaseLayer(): any {
return require('xml!../../../../images/base-layer.svg').svg;
}
}