diff --git a/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.html b/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.html index 00d7c0d9..76106634 100644 --- a/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.html +++ b/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.html @@ -1,19 +1,19 @@

Style editor

- +
Fill color:
- +
Border color:
- +
Border width:
- +
- +
Border style:
- +
Rotation:
diff --git a/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.ts b/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.ts index 2fc2eb16..eb1c3224 100644 --- a/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.ts +++ b/src/app/components/project-map/drawings-editors/style-editor/style-editor.component.ts @@ -7,6 +7,9 @@ import { DrawingToMapDrawingConverter } from '../../../../cartography/converters import { MapDrawingToSvgConverter } from '../../../../cartography/converters/map/map-drawing-to-svg-converter'; import { DrawingService } from '../../../../services/drawing.service'; import { DrawingsDataSource } from '../../../../cartography/datasources/drawings-datasource'; +import { EllipseElement } from '../../../../cartography/models/drawings/ellipse-element'; +import { LineElement } from '../../../../cartography/models/drawings/line-element'; +import { RectElement } from '../../../../cartography/models/drawings/rect-element'; @Component({ @@ -18,6 +21,7 @@ export class StyleEditorDialogComponent implements OnInit { server: Server; project: Project; drawing: Drawing; + element: ElementData; rotation: string; constructor( @@ -29,7 +33,19 @@ export class StyleEditorDialogComponent implements OnInit { ){} ngOnInit() { + this.element = new ElementData(); this.rotation = this.drawing.rotation.toString(); + + if (this.drawing.element instanceof RectElement || this.drawing.element instanceof EllipseElement) { + this.element.fill = this.drawing.element.fill; + this.element.stroke = this.drawing.element.stroke; + this.element.stroke_dasharray = this.drawing.element.stroke_dasharray; + this.element.stroke_width = this.drawing.element.stroke_width; + } else if (this.drawing.element instanceof LineElement) { + this.element.stroke = this.drawing.element.stroke; + this.element.stroke_dasharray = this.drawing.element.stroke_dasharray; + this.element.stroke_width = this.drawing.element.stroke_width + } } onNoClick() { @@ -38,6 +54,17 @@ export class StyleEditorDialogComponent implements OnInit { onYesClick() { this.drawing.rotation = +this.rotation; + if (this.drawing.element instanceof RectElement || this.drawing.element instanceof EllipseElement) { + this.drawing.element.fill = this.element.fill; + this.drawing.element.stroke = this.element.stroke; + this.drawing.element.stroke_dasharray = this.element.stroke_dasharray; + this.drawing.element.stroke_width = this.element.stroke_width; + } else if (this.drawing.element instanceof LineElement) { + this.drawing.element.stroke = this.element.stroke; + this.drawing.element.stroke_dasharray = this.element.stroke_dasharray; + this.drawing.element.stroke_width = this.element.stroke_width + } + let mapDrawing = this.drawingToMapDrawingConverter.convert(this.drawing); mapDrawing.element = this.drawing.element; @@ -50,3 +77,10 @@ export class StyleEditorDialogComponent implements OnInit { }); } } + +export class ElementData { + fill: string; + stroke: string; + stroke_width: number; + stroke_dasharray: string; +} diff --git a/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.html b/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.html index 4cd2e728..900a8a56 100644 --- a/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.html +++ b/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.html @@ -1,14 +1,14 @@

Text editor

Fill color:
- +
Rotation:
-
diff --git a/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.ts b/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.ts index 749d374f..adc27d51 100644 --- a/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.ts +++ b/src/app/components/project-map/drawings-editors/text-editor/text-editor.component.ts @@ -21,6 +21,7 @@ export class TextEditorDialogComponent implements OnInit { server: Server; project: Project; drawing: Drawing; + element: TextElement; rotation: string; constructor( @@ -35,11 +36,11 @@ export class TextEditorDialogComponent implements OnInit { ngOnInit() { this.rotation = this.drawing.rotation.toString(); - let textElement = this.drawing.element as TextElement; - this.renderer.setStyle(this.textArea.nativeElement, 'color', textElement.fill); - this.renderer.setStyle(this.textArea.nativeElement, 'font-family', textElement.font_family); - this.renderer.setStyle(this.textArea.nativeElement, 'font-size', `${textElement.font_size}pt`); - this.renderer.setStyle(this.textArea.nativeElement, 'font-weight', textElement.font_weight); + this.element = this.drawing.element as TextElement; + this.renderer.setStyle(this.textArea.nativeElement, 'color', this.element.fill); + this.renderer.setStyle(this.textArea.nativeElement, 'font-family', this.element.font_family); + this.renderer.setStyle(this.textArea.nativeElement, 'font-size', `${this.element.font_size}pt`); + this.renderer.setStyle(this.textArea.nativeElement, 'font-weight', this.element.font_weight); } onNoClick() { @@ -48,6 +49,8 @@ export class TextEditorDialogComponent implements OnInit { onYesClick() { this.drawing.rotation = +this.rotation; + this.drawing.element = this.element; + let mapDrawing = this.drawingToMapDrawingConverter.convert(this.drawing); mapDrawing.element = this.drawing.element;