@foodmarketmaker/mapag 0.0.6 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14106,6 +14106,8 @@ class MapComponent {
14106
14106
  mapper = input(new MapboxMapperGroup(), ...(ngDevMode ? [{ debugName: "mapper" }] : []));
14107
14107
  mapContainer = viewChild('map', ...(ngDevMode ? [{ debugName: "mapContainer" }] : []));
14108
14108
  id = input('mapid', ...(ngDevMode ? [{ debugName: "id" }] : []));
14109
+ onMapReady = output();
14110
+ mapReady = signal(undefined, ...(ngDevMode ? [{ debugName: "mapReady" }] : []));
14109
14111
  // accessToken = input.required<string>();
14110
14112
  // FontAwesome icons
14111
14113
  faPrint = faPrint;
@@ -14135,7 +14137,7 @@ class MapComponent {
14135
14137
  // style = 'https://demotiles.maplibre.org/style.json'
14136
14138
  if (container) {
14137
14139
  // @ts-ignore - Type conflict between different maplibre-gl versions
14138
- this.map = new maplibregl.Map({
14140
+ const map = new maplibregl.Map({
14139
14141
  container: container.nativeElement,
14140
14142
  // style: this.basemap(),
14141
14143
  style: this.styles.style().url, // Default style
@@ -14143,37 +14145,44 @@ class MapComponent {
14143
14145
  minZoom: 1,
14144
14146
  zoom: 3,
14145
14147
  });
14148
+ this.map = map;
14146
14149
  // disable map rotation using right click + drag
14147
- if (this.map) {
14148
- this.map.dragRotate.disable();
14149
- this.map.on('styledata', (e) => {
14150
- console.log('= MAP STYLE DATA ===', e);
14151
- if (!this.map)
14152
- return;
14153
- this.mapper().onStyleChange(this.map, this.svc);
14150
+ map.dragRotate.disable();
14151
+ // Forward style change events to the mapper
14152
+ map.on('styledata', (e) => {
14153
+ this.zone.runOutsideAngular(() => {
14154
+ this.mapper().onStyleChange(map, this.svc);
14154
14155
  });
14155
- this.map.on('idle', () => {
14156
- console.log('= MAP IDLE ===');
14157
- if (!this.map)
14158
- return;
14159
- this.mapper().onStyleChange(this.map, this.svc);
14156
+ });
14157
+ // Forward style change events to the mapper
14158
+ this.map.on('idle', () => {
14159
+ this.zone.runOutsideAngular(() => {
14160
+ this.mapper().onStyleChange(map, this.svc);
14160
14161
  });
14161
- this.map.on('load', () => {
14162
- if (!this.map)
14163
- return;
14164
- console.log('Map loaded successfully');
14165
- this.styles.initializeMap(this.map);
14166
- // Setup the mapper
14167
- const mapper = this.mapper();
14168
- // Set the map in the services
14169
- this.svc.setMap(this.map);
14170
- this.svc.setMapper(mapper);
14171
- this.selectionSvc.setMap(this.map);
14172
- this.selectionSvc.setMapper(mapper);
14173
- this.mapper().onReady(this.map, this.svc);
14174
- this.map.addControl(new maplibregl.NavigationControl());
14162
+ });
14163
+ // Process when the map has finished loading
14164
+ this.map.on('load', () => {
14165
+ this.styles.initializeMap(map);
14166
+ // Setup the mapper
14167
+ const mapper = this.mapper();
14168
+ // Set the map in the services
14169
+ this.svc.setMap(map);
14170
+ this.svc.setMapper(mapper);
14171
+ this.selectionSvc.setMap(map);
14172
+ this.selectionSvc.setMapper(mapper);
14173
+ // Just create our standard Layers
14174
+ const std = new StandardLayersMapper();
14175
+ std.onReady(map, this.svc);
14176
+ // Notify that the map is ready
14177
+ this.zone.runOutsideAngular(() => {
14178
+ this.onMapReady.emit(map);
14179
+ this.mapReady.set(map);
14175
14180
  });
14176
- }
14181
+ // Initialize the mapper(s)
14182
+ this.zone.runOutsideAngular(() => {
14183
+ this.mapper().onReady(map, this.svc);
14184
+ });
14185
+ });
14177
14186
  }
14178
14187
  });
14179
14188
  }
@@ -14193,7 +14202,7 @@ class MapComponent {
14193
14202
  this.map.triggerRepaint();
14194
14203
  }
14195
14204
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: MapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
14196
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", type: MapComponent, isStandalone: true, selector: "mapag-map", inputs: { mapper: { classPropertyName: "mapper", publicName: "mapper", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mapContainer", first: true, predicate: ["map"], descendants: true, isSignal: true }], ngImport: i0, template: `
14205
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", type: MapComponent, isStandalone: true, selector: "mapag-map", inputs: { mapper: { classPropertyName: "mapper", publicName: "mapper", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onMapReady: "onMapReady" }, viewQueries: [{ propertyName: "mapContainer", first: true, predicate: ["map"], descendants: true, isSignal: true }], ngImport: i0, template: `
14197
14206
  <div class="mapcontainer" #map>
14198
14207
  @if (mapper().legends.length) { @for (legend of mapper().legends; track
14199
14208
  legend) {
@@ -14244,7 +14253,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
14244
14253
  </div>
14245
14254
  <ng-content></ng-content>
14246
14255
  `, styles: [":host{height:100%;position:relative;overflow:hidden}.mapcontainer{margin:0;padding:0;height:100%;width:100%}.legend{position:absolute;top:10px;right:10px;background:#fff;padding:10px;border-radius:5px;box-shadow:0 2px 4px #0003;z-index:1000}.buttons{position:absolute;top:10px;left:10px;z-index:1000}.buttons>button{border-radius:5px;border:1px solid #ccc;background:#fff;color:#333;padding:8px 12px;cursor:pointer;box-shadow:0 2px 4px #0003}.buttons>button:hover{background-color:#f0f0f0}.legend-row{display:grid;grid-template-columns:auto 1fr;gap:8px;padding:4px 0;align-items:center}.legend-title{font-weight:700;text-align:center;margin-bottom:8px}.legend-item{height:15px;width:15px;border:1px solid #ccc}\n"] }]
14247
- }], ctorParameters: () => [], propDecorators: { mapper: [{ type: i0.Input, args: [{ isSignal: true, alias: "mapper", required: false }] }], mapContainer: [{ type: i0.ViewChild, args: ['map', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
14256
+ }], ctorParameters: () => [], propDecorators: { mapper: [{ type: i0.Input, args: [{ isSignal: true, alias: "mapper", required: false }] }], mapContainer: [{ type: i0.ViewChild, args: ['map', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], onMapReady: [{ type: i0.Output, args: ["onMapReady"] }] } });
14248
14257
  // Define map styles
14249
14258
  const mapStyles = {
14250
14259
  'carto-positron': {
@@ -14634,7 +14643,8 @@ class HardinessMapper {
14634
14643
  constructor() {
14635
14644
  const _ = effect(() => {
14636
14645
  const settings = this.settings();
14637
- this._update(settings);
14646
+ // this._update(settings);
14647
+ this.create();
14638
14648
  }, ...(ngDevMode ? [{ debugName: "_" }] : []));
14639
14649
  }
14640
14650
  async create() {