Fixed some problems with the calibration toggle
This commit is contained in:
parent
94749debc1
commit
5044531bd6
@ -47,7 +47,7 @@ export class MapComponent implements OnInit {
|
|||||||
{name: 'Sea Level Pressure', toggle: true, click: () => this.map.setWeatherLayer(WeatherLayers.SEA_LEVEL_PRESSURE)},
|
{name: 'Sea Level Pressure', toggle: true, click: () => this.map.setWeatherLayer(WeatherLayers.SEA_LEVEL_PRESSURE)},
|
||||||
{name: 'Clouds', toggle: true, click: () => this.map.setWeatherLayer(WeatherLayers.CLOUDS_NEW)},
|
{name: 'Clouds', toggle: true, click: () => this.map.setWeatherLayer(WeatherLayers.CLOUDS_NEW)},
|
||||||
]},
|
]},
|
||||||
{name: 'Calibrate', icon: 'explore', toggle: true, onEnabled: () => this.calibrate(), onDisabled: () => this.calibration.dismiss()},
|
{name: 'Calibrate', icon: 'explore', toggle: true, onEnabled: () => this.startCalibrating(), onDisabled: () => this.stopCalibrating()},
|
||||||
{name: 'Messages', icon: 'chat', hidden: true},
|
{name: 'Messages', icon: 'chat', hidden: true},
|
||||||
{name: 'Identity', icon: 'perm_identity', hidden: true},
|
{name: 'Identity', icon: 'perm_identity', hidden: true},
|
||||||
{name: 'Settings', icon: 'settings', hidden: true}
|
{name: 'Settings', icon: 'settings', hidden: true}
|
||||||
@ -77,7 +77,7 @@ export class MapComponent implements OnInit {
|
|||||||
this.snackBar.open('Compass requires calibration', 'calibrate', {
|
this.snackBar.open('Compass requires calibration', 'calibrate', {
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
panelClass: 'bg-warning,text-white'
|
panelClass: 'bg-warning,text-white'
|
||||||
}).onAction().subscribe(() => this.calibrate());
|
}).onAction().subscribe(() => this.startCalibrating());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,18 +89,21 @@ export class MapComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
calibrate() {
|
center(pos?) {
|
||||||
|
if(!pos) pos = {lat: this.position.latitude, lng: this.position.longitude};
|
||||||
|
this.map.centerOn(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
startCalibrating() {
|
||||||
this.menu[6].enabled = true;
|
this.menu[6].enabled = true;
|
||||||
this.calibration = this.bottomSheet.open(CalibrateComponent, {
|
this.calibration = this.bottomSheet.open(CalibrateComponent, {
|
||||||
hasBackdrop: false,
|
hasBackdrop: false,
|
||||||
disableClose: true
|
disableClose: true
|
||||||
});
|
});
|
||||||
this.calibration.afterDismissed().subscribe(() => this.menu[6].enabled = false);
|
this.calibration.afterDismissed().subscribe(() => {
|
||||||
}
|
this.menu[6].enabled = false;
|
||||||
|
this.calibration = null;
|
||||||
center(pos?) {
|
});
|
||||||
if(!pos) pos = {lat: this.position.latitude, lng: this.position.longitude};
|
|
||||||
this.map.centerOn(pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startDrawing() {
|
startDrawing() {
|
||||||
@ -118,6 +121,10 @@ export class MapComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopCalibrating() {
|
||||||
|
if(this.calibration) this.calibration.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
stopDrawing() {
|
stopDrawing() {
|
||||||
this.showPalette = false;
|
this.showPalette = false;
|
||||||
this.map.stopDrawing()
|
this.map.stopDrawing()
|
||||||
|
Loading…
Reference in New Issue
Block a user