Fix centering map when no entities with zones

This commit is contained in:
Paulus Schoutsen 2017-02-13 23:31:44 -08:00
parent 53ecbbaa13
commit d84575e209

View File

@ -75,14 +75,14 @@ Polymer({
var bounds; var bounds;
if (this._mapItems.length === 0) { if (this._mapItems.length === 0) {
bounds = new window.L.latLngBounds( this._map.setView(new L.LatLng(this.hass.config.core.latitude,
[window.L.latLng(this.locationGPS.latitude, this.locationGPS.longitude)]); this.hass.config.core.longitude), 14);
} else { } else {
bounds = new window.L.latLngBounds( bounds = new window.L.latLngBounds(
this._mapItems.map(function (item) { return item.getLatLng(); })); this._mapItems.map(function (item) { return item.getLatLng(); }));
this._map.fitBounds(bounds.pad(0.5));
} }
this._map.fitBounds(bounds.pad(0.5));
}, },
drawEntities: function (hass) { drawEntities: function (hass) {