diff --git a/src/app/components/project-map/context-menu/context-menu.component.html b/src/app/components/project-map/context-menu/context-menu.component.html index eada6c08..844dd403 100644 --- a/src/app/components/project-map/context-menu/context-menu.component.html +++ b/src/app/components/project-map/context-menu/context-menu.component.html @@ -14,7 +14,10 @@ [drawing]="drawings[0]" > n.node_id === this.linkNode.node_id).label; this.rotation = this.label.rotation.toString(); this.element = this.getTextElementFromLabel(); - } + } else if (this.drawing) { + this.isTextEditable = true; + this.rotation = this.drawing.rotation.toString(); + this.element = this.drawing.element as TextElement; + }; this.formGroup.controls['rotation'].setValue(this.rotation); this.renderer.setStyle(this.textArea.nativeElement, 'color', this.element.fill); @@ -116,20 +116,7 @@ export class TextEditorDialogComponent implements OnInit { if (this.formGroup.valid) { this.rotation = this.formGroup.get('rotation').value; - if (this.drawing) { - this.drawing.rotation = +this.rotation; - this.drawing.element = this.element; - - let mapDrawing = this.drawingToMapDrawingConverter.convert(this.drawing); - mapDrawing.element = this.drawing.element; - - this.drawing.svg = this.mapDrawingToSvgConverter.convert(mapDrawing); - - this.drawingService.update(this.server, this.drawing).subscribe((serverDrawing: Drawing) => { - this.drawingsDataSource.update(serverDrawing); - this.dialogRef.close(); - }); - } else if (this.label && this.node) { + if (this.label && this.node) { this.node.label.style = this.getStyleFromTextElement(); this.node.label.rotation = +this.rotation; @@ -146,7 +133,20 @@ export class TextEditorDialogComponent implements OnInit { this.linksDataSource.update(link); this.dialogRef.close(); }); - } + } else if (this.drawing) { + this.drawing.rotation = +this.rotation; + this.drawing.element = this.element; + + let mapDrawing = this.drawingToMapDrawingConverter.convert(this.drawing); + mapDrawing.element = this.drawing.element; + + this.drawing.svg = this.mapDrawingToSvgConverter.convert(mapDrawing); + + this.drawingService.update(this.server, this.drawing).subscribe((serverDrawing: Drawing) => { + this.drawingsDataSource.update(serverDrawing); + this.dialogRef.close(); + }); + }; } else { this.toasterService.error(`Entered data is incorrect`); } diff --git a/src/app/components/project-map/project-map.component.ts b/src/app/components/project-map/project-map.component.ts index 4e3645f5..2cf9da98 100644 --- a/src/app/components/project-map/project-map.component.ts +++ b/src/app/components/project-map/project-map.component.ts @@ -267,7 +267,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy { const onContextMenu = this.selectionTool.contextMenuOpened.subscribe((event) => { const selectedItems = this.selectionManager.getSelected(); - if (selectedItems.length === 0 || !(event instanceof MouseEvent)) return; + if (selectedItems.length < 2 || !(event instanceof MouseEvent)) return; let drawings: Drawing[] = []; let nodes: Node[] = [];