From 3e767d733917d669e8ac08d8b25633de6f3877fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zsef=20Farkas?= Date: Sun, 22 May 2016 23:32:59 +0200 Subject: [PATCH] Move svg processing from main to service. --- src/components/svg-keyboard.component.ts | 12 ++++++++---- src/main-app.component.ts | 18 ------------------ src/services/data-provider.service.ts | 24 ++++++++++++++++++++---- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/components/svg-keyboard.component.ts b/src/components/svg-keyboard.component.ts index 3d464845..7aad36c1 100644 --- a/src/components/svg-keyboard.component.ts +++ b/src/components/svg-keyboard.component.ts @@ -4,6 +4,7 @@ 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({ selector: 'svg-keyboard', @@ -34,17 +35,20 @@ import {PopoverComponent} from './popover/popover.component'; directives: [SvgModuleComponent, PopoverComponent] }) export class SvgKeyboardComponent implements OnInit { - @Input() svgAttributes: { viewBox: string, transform: string, fill: string }; - @Input() modules: SvgModule[]; @Input() moduleConfig: Module[]; + private modules: SvgModule[]; private popoverEnabled: boolean; + private svgAttributes: { viewBox: string, transform: string, fill: string }; - constructor() { + constructor(private dps: DataProviderService) { this.modules = []; + this.svgAttributes = this.dps.getKeyboardSvgAttributes(); } - ngOnInit() { } + ngOnInit() { + this.modules = this.dps.getSvgModules(); + } onEditKeyActionRequest(moduleId: number, keyId: number): void { this.showPopover(); diff --git a/src/main-app.component.ts b/src/main-app.component.ts index 7fb51424..ba5a3a23 100644 --- a/src/main-app.component.ts +++ b/src/main-app.component.ts @@ -3,9 +3,6 @@ import { Component, OnInit, AfterViewInit, Renderer, ViewChildren, QueryList, El import {Layers} from '../config-serializer/config-items/Layers'; import {SvgKeyboardComponent} from './components/svg-keyboard.component'; -import {SvgModule} from './components/svg-module.model'; - -import {DataProviderService} from './services/data-provider.service'; import {UhkConfigurationService} from './services/uhk-configuration.service'; @Component({ @@ -28,8 +25,6 @@ import {UhkConfigurationService} from './services/uhk-configuration.service';