2
0

added service to provide canvas all over

This commit is contained in:
2018-05-23 14:18:34 +02:00
parent 1231b2de9c
commit 040782f18a
7 changed files with 70 additions and 17 deletions

View File

@@ -8,18 +8,33 @@ import * as Drag from 'd3-drag';
import { Config } from './../models/config.model';
import { Point } from './../models/point.model';
import { Param } from './../models/param.model';
import { CanvasService } from './../services/canvas.service';
@Directive({
selector: '[guilloche]'
})
export class GuillocheDirective implements OnChanges {
private canvas: any;
@Input() graph: Graph;
constructor() {
constructor(
private canvasService: CanvasService
) {
}
ngOnChanges(changes: SimpleChanges) {
console.log('guilloche directive (changes)', changes.graph);
console.log('guilloche directive (changes)', changes.graph.currentValue);
this.selectCanvas();
this.drawGraph();
}
private drawGraph(): void {
console.log('guilloche directive(drawGraph)', this.graph, this.canvas);
}
private selectCanvas(): void {
this.canvas = Selection.select(this.canvasService.get);
}
}