mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 13:27:22 +00:00
Normalize longitude to the range between -180 to +180 degrees (#3872)
* normalize longitude to the range between -180 to +180 degrees * only normalize longitude if out of valid range
This commit is contained in:
parent
efb28d337a
commit
7494a49238
@ -77,7 +77,12 @@ class LocationEditor extends LitElement {
|
||||
}
|
||||
|
||||
private _updateLocation(latlng: LatLng) {
|
||||
this.location = this._ignoreFitToMap = [latlng.lat, latlng.lng];
|
||||
let longitude = latlng.lng;
|
||||
if (Math.abs(longitude) > 180.0) {
|
||||
// Normalize longitude if map provides values beyond -180 to +180 degrees.
|
||||
longitude = (((longitude % 360.0) + 540.0) % 360.0) - 180.0;
|
||||
}
|
||||
this.location = this._ignoreFitToMap = [latlng.lat, longitude];
|
||||
fireEvent(this, "change", undefined, { bubbles: false });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user