Browse Source

UI: New map widgets - improve update bounds.

pull/13043/head
Igor Kulikov 1 year ago
parent
commit
1ae9b01bd9
  1. 8
      ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts

8
ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts

@ -937,7 +937,13 @@ export abstract class TbMap<S extends BaseMapSettings> {
bounds = new L.LatLngBounds(null, null);
dataLayersBounds.forEach(b => bounds.extend(b));
const mapBounds = this.map.getBounds();
if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || (!this.bounds.equals(bounds) || force) && this.settings.fitMapBounds && !mapBounds.contains(bounds))) {
if (bounds.isValid() &&
(
(!this.bounds || !this.bounds.isValid() || (!this.bounds.equals(bounds) || force) && this.settings.fitMapBounds)
&& !mapBounds.contains(bounds)
)
)
{
this.bounds = bounds;
if (!this.ignoreUpdateBounds && !this.isPlacingItem) {
this.fitBounds(bounds);

Loading…
Cancel
Save