mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-15 15:02:49 +00:00
Small clean
This commit is contained in:
parent
6002ebacdf
commit
607e8c199a
@ -1,5 +0,0 @@
|
|||||||
import { DrawingElement } from "../../../shared/models/drawings/drawing-element";
|
|
||||||
|
|
||||||
export interface SvgConverter {
|
|
||||||
convert(node: Node): DrawingElement;
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgToDrawingConverter } from "./svg-to-drawing-converter";
|
import { SvgToDrawingConverter } from "./svg-to-drawing-converter";
|
||||||
import { TextElement } from "../../shared/models/drawings/text-element";
|
import { TextElement } from "../models/drawings/text-element";
|
||||||
|
|
||||||
|
|
||||||
describe('SvgToDrawingHelper', () => {
|
describe('SvgToDrawingHelper', () => {
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { DrawingElement } from "../../shared/models/drawings/drawing-element";
|
import { DrawingElement } from "../models/drawings/drawing-element";
|
||||||
import { SvgConverter } from "./svg-to-drawing-converter/svg-converter";
|
import { SvgConverter } from "./svg-to-drawing-converter/svg-converter";
|
||||||
import { TextConverter } from "./svg-to-drawing-converter/text-converter";
|
import { TextConverter } from "./svg-to-drawing-converter/text-converter";
|
||||||
import { ImageConverter } from "./svg-to-drawing-converter/image-converter";
|
import { ImageConverter } from "./svg-to-drawing-converter/image-converter";
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgConverter } from "./svg-converter";
|
import { SvgConverter } from "./svg-converter";
|
||||||
import { EllipseElement } from "../../../shared/models/drawings/ellipse-element";
|
import { EllipseElement } from "../../models/drawings/ellipse-element";
|
||||||
|
|
||||||
|
|
||||||
export class EllipseConverter implements SvgConverter {
|
export class EllipseConverter implements SvgConverter {
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgConverter } from "./svg-converter";
|
import { SvgConverter } from "./svg-converter";
|
||||||
import { ImageElement } from "../../../shared/models/drawings/image-element";
|
import { ImageElement } from "../../models/drawings/image-element";
|
||||||
|
|
||||||
|
|
||||||
export class ImageConverter implements SvgConverter {
|
export class ImageConverter implements SvgConverter {
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgConverter } from "./svg-converter";
|
import { SvgConverter } from "./svg-converter";
|
||||||
import { LineElement } from "../../../shared/models/drawings/line-element";
|
import { LineElement } from "../../models/drawings/line-element";
|
||||||
|
|
||||||
|
|
||||||
export class LineConverter implements SvgConverter {
|
export class LineConverter implements SvgConverter {
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgConverter } from "./svg-converter";
|
import { SvgConverter } from "./svg-converter";
|
||||||
import { RectElement } from "../../../shared/models/drawings/rect-element";
|
import { RectElement } from "../../models/drawings/rect-element";
|
||||||
|
|
||||||
|
|
||||||
export class RectConverter implements SvgConverter {
|
export class RectConverter implements SvgConverter {
|
@ -0,0 +1,5 @@
|
|||||||
|
import { DrawingElement } from "../../models/drawings/drawing-element";
|
||||||
|
|
||||||
|
export interface SvgConverter {
|
||||||
|
convert(node: Node): DrawingElement;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { SvgConverter } from "./svg-converter";
|
import { SvgConverter } from "./svg-converter";
|
||||||
import { TextElement } from "../../../shared/models/drawings/text-element";
|
import { TextElement } from "../../models/drawings/text-element";
|
||||||
|
|
||||||
|
|
||||||
export class TextConverter implements SvgConverter {
|
export class TextConverter implements SvgConverter {
|
@ -1,9 +1,9 @@
|
|||||||
import {Widget} from "./widget";
|
import { Widget } from "./widget";
|
||||||
import {Drawing} from "../models/drawing";
|
import { Drawing } from "../models/drawing";
|
||||||
import {SVGSelection} from "../models/types";
|
import { SVGSelection } from "../models/types";
|
||||||
import {Layer} from "../models/layer";
|
import { Layer } from "../models/layer";
|
||||||
import { TextDrawingWidget } from "./drawings/text-drawing";
|
import { TextDrawingWidget } from "./drawings/text-drawing";
|
||||||
import { SvgToDrawingConverter } from "../../map/helpers/svg-to-drawing-converter";
|
import { SvgToDrawingConverter } from "../helpers/svg-to-drawing-converter";
|
||||||
import { ImageDrawingWidget } from "./drawings/image-drawing";
|
import { ImageDrawingWidget } from "./drawings/image-drawing";
|
||||||
import { RectDrawingWidget } from "./drawings/rect-drawing";
|
import { RectDrawingWidget } from "./drawings/rect-drawing";
|
||||||
import { LineDrawingWidget } from "./drawings/line-drawing";
|
import { LineDrawingWidget } from "./drawings/line-drawing";
|
||||||
@ -37,38 +37,6 @@ export class DrawingsWidget implements Widget {
|
|||||||
.append<SVGGElement>('g')
|
.append<SVGGElement>('g')
|
||||||
.attr('class', 'drawing');
|
.attr('class', 'drawing');
|
||||||
|
|
||||||
// const parser = new DOMParser();
|
|
||||||
|
|
||||||
// const drawing_image = drawing_enter.append<SVGImageElement>('image')
|
|
||||||
// .attr('xlink:href', (d: Drawing) => {
|
|
||||||
// let svg = d.svg;
|
|
||||||
// if (svg.indexOf("xmlns") < 0) {
|
|
||||||
// svg = svg.replace('svg', 'svg xmlns="http://www.w3.org/2000/svg"');
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return 'data:image/svg+xml;base64,' + btoa(svg);
|
|
||||||
// })
|
|
||||||
// .attr('width', (d: Drawing) => {
|
|
||||||
// const svg_dom = parser.parseFromString(d.svg, 'text/xml');
|
|
||||||
// const roots = svg_dom.getElementsByTagName('svg');
|
|
||||||
// if (roots.length > 0) {
|
|
||||||
// if (roots[0].hasAttribute('width')) {
|
|
||||||
// return roots[0].getAttribute('width');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return 0;
|
|
||||||
// })
|
|
||||||
// .attr('height', (d: Drawing) => {
|
|
||||||
// const svg_dom = parser.parseFromString(d.svg, 'text/xml');
|
|
||||||
// const roots = svg_dom.getElementsByTagName('svg');
|
|
||||||
// if (roots.length > 0) {
|
|
||||||
// if (roots[0].hasAttribute('height')) {
|
|
||||||
// return roots[0].getAttribute('height');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
const drawing_merge = drawing.merge(drawing_enter)
|
const drawing_merge = drawing.merge(drawing_enter)
|
||||||
.attr('transform', (d: Drawing) => {
|
.attr('transform', (d: Drawing) => {
|
||||||
return `translate(${d.x},${d.y})`;
|
return `translate(${d.x},${d.y})`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user