Merge pull request #552 from GNS3/Option-to-show-the-grid

Option to show the grid
This commit is contained in:
piotrpekala7
2019-10-25 10:48:31 +02:00
committed by GitHub
4 changed files with 35 additions and 3 deletions

View File

@ -2,6 +2,7 @@
<app-d3-map
*ngIf="!settings.angular_map"
[server]="server"
[project]="project"
[symbols]="symbols"
[nodes]="nodes"
[links]="links"
@ -92,6 +93,9 @@
</mat-checkbox>
<mat-checkbox [ngModel]="layersVisibility" (change)="toggleLayers($event.checked)">
Show layers
</mat-checkbox><br/>
<mat-checkbox [ngModel]="gridVisibility" (change)="toggleGrid($event.checked)">
Show grid
</mat-checkbox>
</div>
</mat-menu>

View File

@ -84,6 +84,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
public isInterfaceLabelVisible: boolean = false;
public notificationsVisibility: boolean = false;
public layersVisibility: boolean = false;
public gridVisibility: boolean = false;
tools = {
selection: true,
@ -240,6 +241,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.notificationsVisibility = localStorage.getItem('notificationsVisibility') === 'true' ? true : false;
this.layersVisibility = localStorage.getItem('layersVisibility') === 'true' ? true : false;
this.gridVisibility = localStorage.getItem('gridVisibility') === 'true' ? true : false;
this.addKeyboardListeners();
}
@ -492,6 +494,16 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.mapChild.applyMapSettingsChanges();
}
public toggleGrid(visible: boolean) {
this.gridVisibility = visible;
if (this.gridVisibility) {
localStorage.setItem('gridVisibility', 'true');
} else {
localStorage.removeItem('gridVisibility');
}
this.mapChild.gridVisibility = this.gridVisibility ? 1 : 0;
}
private showMessage(msg) {
if (this.notificationsVisibility) {
if (msg.type === 'error') this.toasterService.error(msg.message);