mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-19 13:07:52 +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 { SelectionManager } from "../managers/selection-manager";
|
||||
import { LineElement } from "../models/drawings/line-element";
|
||||
import { EllipseElement } from "../models/drawings/ellipse-element";
|
||||
|
||||
@Injectable()
|
||||
export class DrawingWidget implements Widget {
|
||||
@ -50,8 +51,8 @@ export class DrawingWidget implements Widget {
|
||||
.select<SVGAElement>('line.top')
|
||||
.attr('stroke', 'transparent')
|
||||
.attr('stroke-width', '8px')
|
||||
.attr('x1', '0')
|
||||
.attr('x2', (drawing) => drawing.element.width)
|
||||
.attr('x1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx - (drawing.element.width/10) : '0')
|
||||
.attr('x2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx + (drawing.element.width/10) : drawing.element.width)
|
||||
.attr('y1', '0')
|
||||
.attr('y2', '0')
|
||||
.attr('draggable', 'true')
|
||||
@ -61,8 +62,8 @@ export class DrawingWidget implements Widget {
|
||||
.select<SVGAElement>('line.bottom')
|
||||
.attr('stroke', 'transparent')
|
||||
.attr('stroke-width', '8px')
|
||||
.attr('x1', '0')
|
||||
.attr('x2', (drawing) => drawing.element.width)
|
||||
.attr('x1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx - (drawing.element.width/10) : '0')
|
||||
.attr('x2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cx + (drawing.element.width/10) : drawing.element.width)
|
||||
.attr('y1', (drawing) => drawing.element.height)
|
||||
.attr('y2', (drawing) => drawing.element.height)
|
||||
.attr('draggable', 'true')
|
||||
@ -74,8 +75,8 @@ export class DrawingWidget implements Widget {
|
||||
.attr('stroke-width', '8px')
|
||||
.attr('x1', '0')
|
||||
.attr('x2', '0')
|
||||
.attr('y1', '0')
|
||||
.attr('y2', (drawing) => drawing.element.height)
|
||||
.attr('y1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy - (drawing.element.height/10) : '0')
|
||||
.attr('y2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy + (drawing.element.height/10) : drawing.element.height)
|
||||
.attr('draggable', 'true')
|
||||
.attr("cursor", "ew-resize");
|
||||
|
||||
@ -85,8 +86,8 @@ export class DrawingWidget implements Widget {
|
||||
.attr('stroke-width', '8px')
|
||||
.attr('x1', (drawing) => drawing.element.width)
|
||||
.attr('x2', (drawing) => drawing.element.width)
|
||||
.attr('y1', '0')
|
||||
.attr('y2', (drawing) => drawing.element.height)
|
||||
.attr('y1', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy - (drawing.element.height/10) : '0')
|
||||
.attr('y2', (drawing) => drawing.element instanceof EllipseElement ? drawing.element.cy + (drawing.element.height/10) : drawing.element.height)
|
||||
.attr('draggable', 'true')
|
||||
.attr("cursor", "ew-resize");
|
||||
|
||||
|
@ -288,7 +288,6 @@ export class DrawingsWidget implements Widget {
|
||||
})
|
||||
.on('drag', (datum: MapDrawing) => {
|
||||
const evt = event;
|
||||
console.log(datum);
|
||||
datum.element.width += evt.dx;
|
||||
datum.element.height += evt.dy;
|
||||
(datum.element as LineElement).x1 += evt.dx;
|
||||
|
@ -102,13 +102,13 @@
|
||||
<mat-drawer-container [ngClass]="{shadow: drawTools.visibility}" class="drawer-container">
|
||||
<mat-drawer #drawer class="drawer">
|
||||
<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>
|
||||
</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>
|
||||
</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">
|
||||
<line [ngClass]="{selected: drawTools.isLineChosen}" x1="30" y1="10" x2="10" y2="30" style="stroke:white;stroke-width:2" />
|
||||
</svg>
|
||||
|
Loading…
Reference in New Issue
Block a user