mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-29 23:54:11 +00:00
Resolve stroke dasharray value get undefined issue on web ui
This commit is contained in:
parent
43c689b30a
commit
1c8e56274a
@ -14,12 +14,26 @@ export class MapDrawingToSvgConverter implements Converter<MapDrawing, string> {
|
||||
let elem = ``;
|
||||
|
||||
if (mapDrawing.element instanceof RectElement) {
|
||||
elem = `<rect fill=\"${mapDrawing.element.fill}\" fill-opacity=\"${mapDrawing.element.fill_opacity}\" height=\"${mapDrawing.element.height}\" width=\"${mapDrawing.element.width}\" stroke=\"${mapDrawing.element.stroke}\" stroke-width=\"${mapDrawing.element.stroke_width}\" stroke-dasharray=\"${mapDrawing.element.stroke_dasharray}\" />`;
|
||||
elem = `<rect fill=\"${mapDrawing.element.fill}\" fill-opacity=\"${mapDrawing.element.fill_opacity}\" height=\"${
|
||||
mapDrawing.element.height
|
||||
}\" width=\"${mapDrawing.element.width}\" stroke=\"${mapDrawing.element.stroke}\" stroke-width=\"${
|
||||
mapDrawing.element.stroke_width
|
||||
}\" stroke-dasharray=\"${mapDrawing.element.stroke_dasharray ?? 'none'}\" />`;
|
||||
} else if (mapDrawing.element instanceof EllipseElement) {
|
||||
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}\" />`;
|
||||
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 ?? 'none'
|
||||
}\" />`;
|
||||
} 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 ) {
|
||||
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 ?? 'none'}\" />`;
|
||||
} 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 '';
|
||||
|
||||
|
@ -60,13 +60,13 @@ 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;
|
||||
let dasharray_value = this.drawing.element.stroke_dasharray;
|
||||
let dasharray_value = this.drawing.element.stroke_dasharray ?? 'none';
|
||||
this.borderTypes.map((_) => {
|
||||
if (_.qt == dasharray_value || _.value == dasharray_value) {
|
||||
dasharray_find_value = _.value;
|
||||
}
|
||||
});
|
||||
this.element.stroke_dasharray = dasharray_find_value ?? 'none';
|
||||
this.element.stroke_dasharray = dasharray_find_value;
|
||||
this.element.stroke_width = this.drawing.element.stroke_width;
|
||||
} else if (this.drawing.element instanceof LineElement) {
|
||||
this.element.stroke = this.drawing.element.stroke;
|
||||
|
Loading…
x
Reference in New Issue
Block a user