mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-09 11:31:15 +00:00
Resolve missing border style options dash dot dot and invisible for links between devices
This commit is contained in:
parent
85f60fbc1c
commit
f338a2e33d
@ -19,7 +19,7 @@ export class MapDrawingToSvgConverter implements Converter<MapDrawing, string> {
|
||||
elem = `<ellipse fill=\"${mapDrawing.element.fill}\" fill-opacity=\"${mapDrawing.element.fill_opacity}\" cx=\"${mapDrawing.element.cx}\" cy=\"${mapDrawing.element.cy}\" rx=\"${mapDrawing.element.rx}\" ry=\"${mapDrawing.element.ry}\" stroke=\"${mapDrawing.element.stroke}\" stroke-width=\"${mapDrawing.element.stroke_width}\" stroke-dasharray=\"${mapDrawing.element.stroke_dasharray}\" />`;
|
||||
} else if (mapDrawing.element instanceof LineElement) {
|
||||
elem = `<line stroke=\"${mapDrawing.element.stroke}\" stroke-width=\"${mapDrawing.element.stroke_width}\" x1=\"${mapDrawing.element.x1}\" x2=\"${mapDrawing.element.x2}\" y1=\"${mapDrawing.element.y1}\" y2=\"${mapDrawing.element.y2}\" stroke-dasharray=\"${mapDrawing.element.stroke_dasharray}\" />`;
|
||||
} else if (mapDrawing.element instanceof TextElement) {
|
||||
} else if (mapDrawing.element instanceof TextElement ) {
|
||||
elem = `<text fill=\"${mapDrawing.element.fill}\" fill-opacity=\"1.0\" font-family=\"${mapDrawing.element.font_family}\" font-size=\"${mapDrawing.element.font_size}\" font-weight=\"${mapDrawing.element.font_weight}\">${mapDrawing.element.text}</text>`;
|
||||
} else return '';
|
||||
|
||||
|
@ -8,8 +8,8 @@ import { Drawing } from '../../../../cartography/models/drawing';
|
||||
import { EllipseElement } from '../../../../cartography/models/drawings/ellipse-element';
|
||||
import { LineElement } from '../../../../cartography/models/drawings/line-element';
|
||||
import { RectElement } from '../../../../cartography/models/drawings/rect-element';
|
||||
import { Controller } from '../../../../models/controller';
|
||||
import { Project } from '../../../../models/project';
|
||||
import{ Controller } from '../../../../models/controller';
|
||||
import { DrawingService } from '../../../../services/drawing.service';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
import { NonNegativeValidator } from '../../../../validators/non-negative-validator';
|
||||
@ -21,16 +21,18 @@ import { RotationValidator } from '../../../../validators/rotation-validator';
|
||||
styleUrls: ['./style-editor.component.scss'],
|
||||
})
|
||||
export class StyleEditorDialogComponent implements OnInit {
|
||||
controller:Controller ;
|
||||
controller: Controller;
|
||||
project: Project;
|
||||
drawing: Drawing;
|
||||
element: ElementData;
|
||||
formGroup: FormGroup;
|
||||
borderTypes = [
|
||||
{value:"none",name:"Solid"},
|
||||
{value:"5",name:"Dash"},
|
||||
{value:"15",name:"Dot"},
|
||||
{value:"5 15",name:"Dash Dot"}
|
||||
borderTypes = [
|
||||
{ value: '', name: 'Invisible' },
|
||||
{ value: 'none', name: 'Solid' },
|
||||
{ value: '5', name: 'Dash' },
|
||||
{ value: '15', name: 'Dot' },
|
||||
{ value: '5 15', name: 'Dash Dot' },
|
||||
{ value: '10 5 5', name: 'Dash Dot Dot' },
|
||||
];
|
||||
|
||||
constructor(
|
||||
@ -55,7 +57,7 @@ export class StyleEditorDialogComponent implements OnInit {
|
||||
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 ?? 'none'
|
||||
this.element.stroke_dasharray = this.drawing.element.stroke_dasharray ?? 'none';
|
||||
this.element.stroke_width = this.drawing.element.stroke_width;
|
||||
} else if (this.drawing.element instanceof LineElement) {
|
||||
this.element.stroke = this.drawing.element.stroke;
|
||||
@ -74,7 +76,11 @@ export class StyleEditorDialogComponent implements OnInit {
|
||||
|
||||
onYesClick() {
|
||||
if (this.formGroup.valid) {
|
||||
this.element.stroke_width = this.formGroup.get('borderWidth').value;
|
||||
if (this.element.stroke_dasharray == '') {
|
||||
this.element.stroke_width = 0;
|
||||
} else {
|
||||
this.element.stroke_width = this.formGroup.get('borderWidth').value === 0 ? 2 : this.formGroup.get('borderWidth').value
|
||||
}
|
||||
this.drawing.rotation = this.formGroup.get('rotation').value;
|
||||
|
||||
if (this.drawing.element instanceof RectElement || this.drawing.element instanceof EllipseElement) {
|
||||
@ -84,12 +90,12 @@ export class StyleEditorDialogComponent implements OnInit {
|
||||
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;
|
||||
this.drawing.element.stroke_dasharray = this.element.stroke_dasharray === '' ? 'none': this.element.stroke_dasharray ;
|
||||
this.drawing.element.stroke_width = this.element.stroke_width === 0 ? 2 :this.element.stroke_width;
|
||||
}
|
||||
let mapDrawing = this.drawingToMapDrawingConverter.convert(this.drawing);
|
||||
mapDrawing.element = this.drawing.element;
|
||||
|
||||
|
||||
this.drawing.svg = this.mapDrawingToSvgConverter.convert(mapDrawing);
|
||||
|
||||
this.drawingService.update(this.controller, this.drawing).subscribe((controllerDrawing: Drawing) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user