@@ -18,12 +18,9 @@ import {
1818 MapEvent ,
1919 MapEventType ,
2020} from '../../ui/map/interfaces/map.interface' ;
21- import { BehaviorSubject , Subject , takeUntil } from 'rxjs' ;
21+ import { BehaviorSubject , Subject , debounceTime , takeUntil } from 'rxjs' ;
2222import { SafeUnsubscribeComponent } from '../../utils/unsubscribe/unsubscribe.component' ;
2323import { LayerModel } from '../../../models/layer.model' ;
24- import { SafeMapLayersService } from '../../../services/map/map-layers.service' ;
25- import { SafeConfirmService } from '../../../services/confirm/confirm.service' ;
26- import { TranslateService } from '@ngx-translate/core' ;
2724import { MapComponent } from '../../ui/map' ;
2825import { extendWidgetForm } from '../common/display-settings/extendWidgetForm' ;
2926import { SafeLayoutService } from '../../../services/layout/layout.service' ;
@@ -66,16 +63,10 @@ export class SafeMapSettingsComponent
6663 /**
6764 * Class constructor
6865 *
69- * @param mapLayersService SafeMapLayersService to add/edit/remove layers
70- * @param confirmService SafeConfirmService
71- * @param translate TranslateService
7266 * @param cdr ChangeDetectorRef
7367 * @param layoutService Shared layout service
7468 */
7569 constructor (
76- private mapLayersService : SafeMapLayersService ,
77- private confirmService : SafeConfirmService ,
78- private translate : TranslateService ,
7970 private cdr : ChangeDetectorRef ,
8071 private layoutService : SafeLayoutService
8172 ) {
@@ -147,37 +138,37 @@ export class SafeMapSettingsComponent
147138 } ) ;
148139 this . tileForm
149140 . get ( 'initialState' )
150- ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) )
141+ ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) , debounceTime ( 1000 ) )
151142 . subscribe ( ( value ) =>
152143 this . updateMapSettings ( {
153144 initialState : value ,
154145 } as MapConstructorSettings )
155146 ) ;
156147 this . tileForm
157148 . get ( 'basemap' )
158- ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) )
149+ ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) , debounceTime ( 1000 ) )
159150 . subscribe ( ( value ) =>
160151 this . updateMapSettings ( { basemap : value } as MapConstructorSettings )
161152 ) ;
162153 this . tileForm
163154 . get ( 'controls' )
164- ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) )
155+ ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) , debounceTime ( 1000 ) )
165156 . subscribe ( ( value ) => {
166157 this . updateMapSettings ( {
167158 controls : value ,
168159 } as MapConstructorSettings ) ;
169160 } ) ;
170161 this . tileForm
171162 . get ( 'arcGisWebMap' )
172- ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) )
163+ ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) , debounceTime ( 1000 ) )
173164 . subscribe ( ( value ) =>
174165 this . updateMapSettings ( {
175166 arcGisWebMap : value ,
176167 } as MapConstructorSettings )
177168 ) ;
178169 this . tileForm
179170 . get ( 'layers' )
180- ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) )
171+ ?. valueChanges . pipe ( takeUntil ( this . destroy$ ) , debounceTime ( 1000 ) )
181172 . subscribe ( ( value ) =>
182173 this . updateMapSettings ( {
183174 layers : value ,
@@ -217,7 +208,6 @@ export class SafeMapSettingsComponent
217208 * @param settings new settings
218209 */
219210 private updateMapSettings ( settings : MapConstructorSettings ) {
220- console . log ( 'update' ) ;
221211 if ( this . mapSettings ) {
222212 this . mapSettings = {
223213 ...this . mapSettings ,
0 commit comments