mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-01 02:26:42 +00:00
Code cleaned up
This commit is contained in:
parent
21a85cd69a
commit
d0d5a1c185
@ -11,6 +11,7 @@ import { EllipseDrawingWidget } from "./drawings/ellipse-drawing";
|
|||||||
import { MapDrawing } from "../models/map/map-drawing";
|
import { MapDrawing } from "../models/map/map-drawing";
|
||||||
import { SelectionManager } from "../managers/selection-manager";
|
import { SelectionManager } from "../managers/selection-manager";
|
||||||
import { LineElement } from "../models/drawings/line-element";
|
import { LineElement } from "../models/drawings/line-element";
|
||||||
|
import { EllipseElement } from "../models/drawings/ellipse-element";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DrawingWidget implements Widget {
|
export class DrawingWidget implements Widget {
|
||||||
@ -50,8 +51,8 @@ export class DrawingWidget implements Widget {
|
|||||||
.select<SVGAElement>('line.top')
|
.select<SVGAElement>('line.top')
|
||||||
.attr('stroke', 'transparent')
|
.attr('stroke', 'transparent')
|
||||||
.attr('stroke-width', '8px')
|
.attr('stroke-width', '8px')
|
||||||
.attr('x1', '0')
|
.attr('x1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx - (drawing.element.width/10) : '0')
|
||||||
.attr('x2', (drawing) => drawing.element.width)
|
.attr('x2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx + (drawing.element.width/10) : drawing.element.width)
|
||||||
.attr('y1', '0')
|
.attr('y1', '0')
|
||||||
.attr('y2', '0')
|
.attr('y2', '0')
|
||||||
.attr('draggable', 'true')
|
.attr('draggable', 'true')
|
||||||
@ -61,8 +62,8 @@ export class DrawingWidget implements Widget {
|
|||||||
.select<SVGAElement>('line.bottom')
|
.select<SVGAElement>('line.bottom')
|
||||||
.attr('stroke', 'transparent')
|
.attr('stroke', 'transparent')
|
||||||
.attr('stroke-width', '8px')
|
.attr('stroke-width', '8px')
|
||||||
.attr('x1', '0')
|
.attr('x1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx - (drawing.element.width/10) : '0')
|
||||||
.attr('x2', (drawing) => drawing.element.width)
|
.attr('x2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx + (drawing.element.width/10) : drawing.element.width)
|
||||||
.attr('y1', (drawing) => drawing.element.height)
|
.attr('y1', (drawing) => drawing.element.height)
|
||||||
.attr('y2', (drawing) => drawing.element.height)
|
.attr('y2', (drawing) => drawing.element.height)
|
||||||
.attr('draggable', 'true')
|
.attr('draggable', 'true')
|
||||||
@ -74,8 +75,8 @@ export class DrawingWidget implements Widget {
|
|||||||
.attr('stroke-width', '8px')
|
.attr('stroke-width', '8px')
|
||||||
.attr('x1', '0')
|
.attr('x1', '0')
|
||||||
.attr('x2', '0')
|
.attr('x2', '0')
|
||||||
.attr('y1', '0')
|
.attr('y1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy - (drawing.element.height/10) : '0')
|
||||||
.attr('y2', (drawing) => drawing.element.height)
|
.attr('y2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy + (drawing.element.height/10) : drawing.element.height)
|
||||||
.attr('draggable', 'true')
|
.attr('draggable', 'true')
|
||||||
.attr("cursor", "ew-resize");
|
.attr("cursor", "ew-resize");
|
||||||
|
|
||||||
@ -85,8 +86,8 @@ export class DrawingWidget implements Widget {
|
|||||||
.attr('stroke-width', '8px')
|
.attr('stroke-width', '8px')
|
||||||
.attr('x1', (drawing) => drawing.element.width)
|
.attr('x1', (drawing) => drawing.element.width)
|
||||||
.attr('x2', (drawing) => drawing.element.width)
|
.attr('x2', (drawing) => drawing.element.width)
|
||||||
.attr('y1', '0')
|
.attr('y1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy - (drawing.element.height/10) : '0')
|
||||||
.attr('y2', (drawing) => drawing.element.height)
|
.attr('y2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy + (drawing.element.height/10) : drawing.element.height)
|
||||||
.attr('draggable', 'true')
|
.attr('draggable', 'true')
|
||||||
.attr("cursor", "ew-resize");
|
.attr("cursor", "ew-resize");
|
||||||
|
|
||||||
|
@ -288,7 +288,6 @@ export class DrawingsWidget implements Widget {
|
|||||||
})
|
})
|
||||||
.on('drag', (datum: MapDrawing) => {
|
.on('drag', (datum: MapDrawing) => {
|
||||||
const evt = event;
|
const evt = event;
|
||||||
console.log(datum);
|
|
||||||
datum.element.width += evt.dx;
|
datum.element.width += evt.dx;
|
||||||
datum.element.height += evt.dy;
|
datum.element.height += evt.dy;
|
||||||
(datum.element as LineElement).x1 += evt.dx;
|
(datum.element as LineElement).x1 += evt.dx;
|
||||||
|
@ -102,13 +102,13 @@
|
|||||||
<mat-drawer-container [ngClass]="{shadow: drawTools.visibility}" class="drawer-container">
|
<mat-drawer-container [ngClass]="{shadow: drawTools.visibility}" class="drawer-container">
|
||||||
<mat-drawer #drawer class="drawer">
|
<mat-drawer #drawer class="drawer">
|
||||||
<div class="drawer-buttons">
|
<div class="drawer-buttons">
|
||||||
<button mat-icon-button class="drawer-button" [color]="drawTools.isRectangleChosen ? 'primary': 'basic'" (click)="addDrawing('rectangle')">
|
<button matTooltip="Draw a rectangle" mat-icon-button class="drawer-button" [color]="drawTools.isRectangleChosen ? 'primary': 'basic'" (click)="addDrawing('rectangle')">
|
||||||
<mat-icon>crop_3_2</mat-icon>
|
<mat-icon>crop_3_2</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button class="drawer-button" [color]="drawTools.isEllipseChosen ? 'primary': 'basic'" (click)="addDrawing('ellipse')">
|
<button matTooltip="Draw an ellipse" mat-icon-button class="drawer-button" [color]="drawTools.isEllipseChosen ? 'primary': 'basic'" (click)="addDrawing('ellipse')">
|
||||||
<mat-icon>panorama_fish_eye</mat-icon>
|
<mat-icon>panorama_fish_eye</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button class="drawer-button" (click)="addDrawing('line')">
|
<button matTooltip="Draw line" mat-icon-button class="drawer-button" (click)="addDrawing('line')">
|
||||||
<svg height="40" width="40">
|
<svg height="40" width="40">
|
||||||
<line [ngClass]="{selected: drawTools.isLineChosen}" x1="30" y1="10" x2="10" y2="30" style="stroke:white;stroke-width:2" />
|
<line [ngClass]="{selected: drawTools.isLineChosen}" x1="30" y1="10" x2="10" y2="30" style="stroke:white;stroke-width:2" />
|
||||||
</svg>
|
</svg>
|
||||||
|
Loading…
Reference in New Issue
Block a user