mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-22 02:16:37 +00:00
Getters in code instead of extended ngClass in HTML files
This commit is contained in:
parent
e11281ddf6
commit
b28f224fdd
@ -3,7 +3,7 @@
|
|||||||
mat-icon-button
|
mat-icon-button
|
||||||
class="menu-button"
|
class="menu-button"
|
||||||
(click)="addDrawing('text')">
|
(click)="addDrawing('text')">
|
||||||
<mat-icon [ngClass]="{unmarkedLight: !drawTools.isTextChosen && isLightThemeEnabled, marked: drawTools.isTextChosen}">create</mat-icon>
|
<mat-icon [ngClass]="getCssClassForIcon('text')">create</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
@ -23,14 +23,14 @@
|
|||||||
mat-icon-button
|
mat-icon-button
|
||||||
class="menu-button"
|
class="menu-button"
|
||||||
(click)="addDrawing('rectangle')">
|
(click)="addDrawing('rectangle')">
|
||||||
<mat-icon [ngClass]="{unmarkedLight: !drawTools.isRectangleChosen && isLightThemeEnabled, marked: drawTools.isRectangleChosen}">crop_3_2</mat-icon>
|
<mat-icon [ngClass]="getCssClassForIcon('rectangle')">crop_3_2</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
matTooltip="Draw an ellipse"
|
matTooltip="Draw an ellipse"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
class="menu-button"
|
class="menu-button"
|
||||||
(click)="addDrawing('ellipse')">
|
(click)="addDrawing('ellipse')">
|
||||||
<mat-icon [ngClass]="{unmarkedLight: !drawTools.isEllipseChosen && isLightThemeEnabled, marked: drawTools.isEllipseChosen}">panorama_fish_eye</mat-icon>
|
<mat-icon [ngClass]="getCssClassForIcon('ellipse')">panorama_fish_eye</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!isLightThemeEnabled"
|
<button *ngIf="!isLightThemeEnabled"
|
||||||
matTooltip="Draw a line"
|
matTooltip="Draw a line"
|
||||||
|
@ -47,6 +47,24 @@ export class ProjectMapMenuComponent implements OnInit, OnDestroy {
|
|||||||
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
|
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCssClassForIcon(type: string) {
|
||||||
|
if (type === 'text') {
|
||||||
|
return {
|
||||||
|
'unmarkedLight': !this.drawTools.isTextChosen && this.isLightThemeEnabled,
|
||||||
|
'marked': this.drawTools.isTextChosen
|
||||||
|
};
|
||||||
|
} else if (type === 'rectangle') {
|
||||||
|
return {
|
||||||
|
'unmarkedLight': !this.drawTools.isRectangleChosen && this.isLightThemeEnabled,
|
||||||
|
'marked': this.drawTools.isRectangleChosen
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
'unmarkedLight': !this.drawTools.isEllipseChosen && this.isLightThemeEnabled,
|
||||||
|
'marked': this.drawTools.isEllipseChosen
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public takeScreenshot() {
|
public takeScreenshot() {
|
||||||
const dialogRef = this.dialog.open(ScreenshotDialogComponent, {
|
const dialogRef = this.dialog.open(ScreenshotDialogComponent, {
|
||||||
width: '400px',
|
width: '400px',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user