added service to provide canvas all over
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user