diff --git a/src/app/app.component.html b/src/app/app.component.html index 20bd5cb..eb1d957 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -63,6 +63,12 @@ +
+ + +
-
+
- + + + + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c5fe047..e2df7cf 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -72,4 +72,8 @@ export class AppComponent implements OnInit { public updateGraphs() { this.config = {...this.configForm.value}; } + + public exportSvg() { + alert('Feature coming'); + } } diff --git a/src/app/components/graphs.component.ts b/src/app/components/graphs.component.ts index 13c31e3..5a09da3 100644 --- a/src/app/components/graphs.component.ts +++ b/src/app/components/graphs.component.ts @@ -56,7 +56,6 @@ export class GraphsComponent implements AfterViewInit, OnChanges { private updateGraphs(): void { const matrix = this.matrix; - console.log(matrix); this.graphs = [...[{ start: { @@ -67,7 +66,8 @@ export class GraphsComponent implements AfterViewInit, OnChanges { coords: { x: matrix.end.x, y: matrix.end.y }, direction: this.config.directionEnd, color: env.guilloche.colors.end - } + }, + stroke: this.config.stroke }, { start: { coords: { x: matrix.end.x, y: matrix.end.y }, @@ -77,7 +77,8 @@ export class GraphsComponent implements AfterViewInit, OnChanges { coords: { x: matrix.start.x, y: matrix.start.y }, direction: this.config.directionStart, color: env.guilloche.colors.end - } + }, + stroke: this.config.stroke }]]; } diff --git a/src/app/directives/guilloche.directive.ts b/src/app/directives/guilloche.directive.ts index c879aeb..2a724e3 100644 --- a/src/app/directives/guilloche.directive.ts +++ b/src/app/directives/guilloche.directive.ts @@ -36,6 +36,18 @@ export class GuillocheDirective implements OnChanges { private drawGraph(): void { console.log('guilloche directive(drawGraph)', this.graph); + this.group.append('path') + .attr('d', Shape.line() + .x(p => p.x) + .y(p => p.y) + .curve(Shape.curveBasis)([ + this.graph.start.coords, + this.graph.end.coords + ])) + .attr('stroke', 'url(#gradient)') + .attr('stroke-width', this.graph.stroke) + .attr('fill', 'none'); + this.group.append('circle') .attr('cx', this.graph.start.coords.x) .attr('cy', this.graph.start.coords.y) diff --git a/src/app/forms/config.form.ts b/src/app/forms/config.form.ts index 27fb5de..e7192ff 100644 --- a/src/app/forms/config.form.ts +++ b/src/app/forms/config.form.ts @@ -21,4 +21,8 @@ export let ConfigForm: FormGroup = fb.group({ Validators.min(0), Validators.max(1) ])), + stroke: fb.control('', Validators.compose([ + Validators.min(0.1), + Validators.max(10) + ])), }); diff --git a/src/app/models/graph.model.ts b/src/app/models/graph.model.ts index 3dd7014..6750d8e 100644 --- a/src/app/models/graph.model.ts +++ b/src/app/models/graph.model.ts @@ -11,5 +11,6 @@ export interface Graph { direction: number; // degree between 0 and 360 color: string; // can be set in enviroment }; + stroke: number; // stroke width nodes?: Point[]; // orientation points } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 7028bed..e09da73 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -12,6 +12,7 @@ export const environment = { directionStart: 0, directionEnd: 180, nodes: 3, + stroke: 1, scale: 0.3 } }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 995d044..36dbb81 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -16,6 +16,7 @@ export const environment = { directionStart: 0, directionEnd: 180, nodes: 3, + stroke: 1, scale: 0.3 } };