mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-16 13:58:13 +00:00
Fix for selecting issue
This commit is contained in:
@ -14,7 +14,10 @@
|
|||||||
[drawing]="drawings[0]"
|
[drawing]="drawings[0]"
|
||||||
></app-edit-style-action>
|
></app-edit-style-action>
|
||||||
<app-edit-text-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"
|
[server]="server"
|
||||||
[project]="project"
|
[project]="project"
|
||||||
[drawing]="drawings[0]"
|
[drawing]="drawings[0]"
|
||||||
@ -64,7 +67,7 @@
|
|||||||
[link]="links[0]"
|
[link]="links[0]"
|
||||||
></app-suspend-link-action>
|
></app-suspend-link-action>
|
||||||
<app-delete-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"
|
[server]="server"
|
||||||
[nodes]="nodes"
|
[nodes]="nodes"
|
||||||
[drawings]="drawings"
|
[drawings]="drawings"
|
||||||
|
@ -61,11 +61,7 @@ export class TextEditorDialogComponent implements OnInit {
|
|||||||
rotation: new FormControl('', [Validators.required, this.rotationValidator.get])
|
rotation: new FormControl('', [Validators.required, this.rotationValidator.get])
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.drawing) {
|
if (this.label && this.node) {
|
||||||
this.isTextEditable = true;
|
|
||||||
this.rotation = this.drawing.rotation.toString();
|
|
||||||
this.element = this.drawing.element as TextElement;
|
|
||||||
} else if (this.label && this.node) {
|
|
||||||
this.isTextEditable = false;
|
this.isTextEditable = false;
|
||||||
this.rotation = this.label.rotation.toString();
|
this.rotation = this.label.rotation.toString();
|
||||||
this.element = this.getTextElementFromLabel();
|
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.label = this.link.nodes.find(n => n.node_id === this.linkNode.node_id).label;
|
||||||
this.rotation = this.label.rotation.toString();
|
this.rotation = this.label.rotation.toString();
|
||||||
this.element = this.getTextElementFromLabel();
|
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.formGroup.controls['rotation'].setValue(this.rotation);
|
||||||
this.renderer.setStyle(this.textArea.nativeElement, 'color', this.element.fill);
|
this.renderer.setStyle(this.textArea.nativeElement, 'color', this.element.fill);
|
||||||
@ -116,20 +116,7 @@ export class TextEditorDialogComponent implements OnInit {
|
|||||||
if (this.formGroup.valid) {
|
if (this.formGroup.valid) {
|
||||||
this.rotation = this.formGroup.get('rotation').value;
|
this.rotation = this.formGroup.get('rotation').value;
|
||||||
|
|
||||||
if (this.drawing) {
|
if (this.label && this.node) {
|
||||||
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) {
|
|
||||||
this.node.label.style = this.getStyleFromTextElement();
|
this.node.label.style = this.getStyleFromTextElement();
|
||||||
this.node.label.rotation = +this.rotation;
|
this.node.label.rotation = +this.rotation;
|
||||||
|
|
||||||
@ -146,7 +133,20 @@ export class TextEditorDialogComponent implements OnInit {
|
|||||||
this.linksDataSource.update(link);
|
this.linksDataSource.update(link);
|
||||||
this.dialogRef.close();
|
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 {
|
} else {
|
||||||
this.toasterService.error(`Entered data is incorrect`);
|
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 onContextMenu = this.selectionTool.contextMenuOpened.subscribe((event) => {
|
||||||
const selectedItems = this.selectionManager.getSelected();
|
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 drawings: Drawing[] = [];
|
||||||
let nodes: Node[] = [];
|
let nodes: Node[] = [];
|
||||||
|
Reference in New Issue
Block a user