From 05d3c3d25c3f493a7381e69368a9b8513eea4afc Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Mon, 16 Dec 2024 12:45:14 -0700 Subject: [PATCH] add redraw --- .../geo-disagg/geo-disagg.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/nshmp-apps/src/app/hazard/disagg/components/geo-disagg/geo-disagg.component.ts b/projects/nshmp-apps/src/app/hazard/disagg/components/geo-disagg/geo-disagg.component.ts index 2c42ce64b..697ec4c5d 100644 --- a/projects/nshmp-apps/src/app/hazard/disagg/components/geo-disagg/geo-disagg.component.ts +++ b/projects/nshmp-apps/src/app/hazard/disagg/components/geo-disagg/geo-disagg.component.ts @@ -1,4 +1,3 @@ -import {AsyncPipe} from '@angular/common'; import {Component, computed, effect, ViewEncapsulation} from '@angular/core'; import {LeafletModule} from '@bluehalo/ngx-leaflet'; import { @@ -8,6 +7,7 @@ import { import {baseLayer, MapBaseLayer} from '@ghsc/nshmp-utils-ts/libs/leaflet'; import {DisaggResponse} from '@ghsc/nshmp-utils-ts/libs/nshmp-haz/www/disagg-service'; import * as L from 'leaflet'; +import {} from 'rxjs'; import {AppService} from '../../services/app.service'; @@ -23,7 +23,7 @@ const maxBounds = new L.LatLngBounds(southWestBounds, northEastBounds); */ @Component({ encapsulation: ViewEncapsulation.None, - imports: [LeafletModule, AsyncPipe, NshmpLibNgMapBaseLayersControlComponent], + imports: [LeafletModule, NshmpLibNgMapBaseLayersControlComponent], selector: 'app-geo-disagg', styleUrl: './geo-disagg.component.scss', templateUrl: './geo-disagg.component.html', @@ -70,6 +70,8 @@ export class GeoDisaggComponent { this.siteLayer().bounds, ]); } + + this.mapRedraw(); }); } @@ -80,6 +82,7 @@ export class GeoDisaggComponent { */ onBaseLayerChange(layer: MapBaseLayer) { this.baseLayer = baseLayer(layer); + this.mapRedraw(); } /** @@ -96,6 +99,8 @@ export class GeoDisaggComponent { new mapUtils.MousePosition().addTo(map); } L.control.scale({position: 'bottomleft'}).addTo(map); + + this.mapRedraw(); } /** @@ -202,6 +207,8 @@ export class GeoDisaggComponent { }); }); + this.mapRedraw(); + return barLayers; } @@ -227,6 +234,8 @@ export class GeoDisaggComponent { }); }); + this.mapRedraw(); + return faultLayer; } @@ -309,6 +318,10 @@ export class GeoDisaggComponent { this.createBarLayers(serviceResponse); } + private mapRedraw(): void { + setTimeout(() => this.map.invalidateSize(true), 0); + } + /** * Set the bounds. * -- GitLab