mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-21 10:01:44 +00:00
Fix for selecting issue
This commit is contained in:
parent
02f42c6681
commit
3a1111c82d
@ -14,7 +14,10 @@
|
||||
[drawing]="drawings[0]"
|
||||
></app-edit-style-action>
|
||||
<app-edit-text-action
|
||||
*ngIf="!projectService.isReadOnly(project) && drawings.length===1 && hasTextCapabilities || labels.length===1 || linkNodes.length===1"
|
||||
*ngIf="!projectService.isReadOnly(project) &&
|
||||
(drawings.length===1 && hasTextCapabilities && labels.length===0 && linkNodes.length===0 ||
|
||||
labels.length===1 && linkNodes.length===0 && drawings.length===0 ||
|
||||
linkNodes.length===1 && labels.length===0 && drawings.length===0)"
|
||||
[server]="server"
|
||||
[project]="project"
|
||||
[drawing]="drawings[0]"
|
||||
@ -64,7 +67,7 @@
|
||||
[link]="links[0]"
|
||||
></app-suspend-link-action>
|
||||
<app-delete-action
|
||||
*ngIf="!projectService.isReadOnly(project) && (drawings.length>0 || nodes.length>0 || links.length>0) && linkNodes.length === 0 && labels.length===0"
|
||||
*ngIf="!projectService.isReadOnly(project) && (drawings.length>0 || nodes.length>0 || links.length>0) && linkNodes.length === 0"
|
||||
[server]="server"
|
||||
[nodes]="nodes"
|
||||
[drawings]="drawings"
|
||||
|
@ -61,11 +61,7 @@ export class TextEditorDialogComponent implements OnInit {
|
||||
rotation: new FormControl('', [Validators.required, this.rotationValidator.get])
|
||||
});
|
||||
|
||||
if (this.drawing) {
|
||||
this.isTextEditable = true;
|
||||
this.rotation = this.drawing.rotation.toString();
|
||||
this.element = this.drawing.element as TextElement;
|
||||
} else if (this.label && this.node) {
|
||||
if (this.label && this.node) {
|
||||
this.isTextEditable = false;
|
||||
this.rotation = this.label.rotation.toString();
|
||||
this.element = this.getTextElementFromLabel();
|
||||
@ -74,7 +70,11 @@ export class TextEditorDialogComponent implements OnInit {
|
||||
this.label = this.link.nodes.find(n => 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`);
|
||||
}
|
||||
|
@ -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[] = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user