@foodmarketmaker/mapag 0.0.6 → 0.0.8

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,7 @@ 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
+ onMap = output();
14109
14110
  // accessToken = input.required<string>();
14110
14111
  // FontAwesome icons
14111
14112
  faPrint = faPrint;
@@ -14135,7 +14136,7 @@ class MapComponent {
14135
14136
  // style = 'https://demotiles.maplibre.org/style.json'
14136
14137
  if (container) {
14137
14138
  // @ts-ignore - Type conflict between different maplibre-gl versions
14138
- this.map = new maplibregl.Map({
14139
+ const map = new maplibregl.Map({
14139
14140
  container: container.nativeElement,
14140
14141
  // style: this.basemap(),
14141
14142
  style: this.styles.style().url, // Default style
@@ -14143,37 +14144,43 @@ class MapComponent {
14143
14144
  minZoom: 1,
14144
14145
  zoom: 3,
14145
14146
  });
14147
+ this.map = map;
14146
14148
  // 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);
14149
+ map.dragRotate.disable();
14150
+ // Forward style change events to the mapper
14151
+ map.on('styledata', (e) => {
14152
+ this.zone.runOutsideAngular(() => {
14153
+ this.mapper().onStyleChange(map, this.svc);
14154
14154
  });
14155
- this.map.on('idle', () => {
14156
- console.log('= MAP IDLE ===');
14157
- if (!this.map)
14158
- return;
14159
- this.mapper().onStyleChange(this.map, this.svc);
14155
+ });
14156
+ // Forward style change events to the mapper
14157
+ this.map.on('idle', () => {
14158
+ this.zone.runOutsideAngular(() => {
14159
+ this.mapper().onStyleChange(map, this.svc);
14160
14160
  });
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());
14161
+ });
14162
+ // Process when the map has finished loading
14163
+ this.map.on('load', () => {
14164
+ this.styles.initializeMap(map);
14165
+ // Setup the mapper
14166
+ const mapper = this.mapper();
14167
+ // Set the map in the services
14168
+ this.svc.setMap(map);
14169
+ this.svc.setMapper(mapper);
14170
+ this.selectionSvc.setMap(map);
14171
+ this.selectionSvc.setMapper(mapper);
14172
+ // Just create our standard Layers
14173
+ const std = new StandardLayersMapper();
14174
+ std.onReady(map, this.svc);
14175
+ // Notify that the map is ready
14176
+ this.zone.runOutsideAngular(() => {
14177
+ this.onMap.emit(map);
14175
14178
  });
14176
- }
14179
+ // Initialize the mapper(s)
14180
+ this.zone.runOutsideAngular(() => {
14181
+ this.mapper().onReady(map, this.svc);
14182
+ });
14183
+ });
14177
14184
  }
14178
14185
  });
14179
14186
  }
@@ -14193,7 +14200,7 @@ class MapComponent {
14193
14200
  this.map.triggerRepaint();
14194
14201
  }
14195
14202
  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: `
14203
+ 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: { onMap: "onMap" }, viewQueries: [{ propertyName: "mapContainer", first: true, predicate: ["map"], descendants: true, isSignal: true }], ngImport: i0, template: `
14197
14204
  <div class="mapcontainer" #map>
14198
14205
  @if (mapper().legends.length) { @for (legend of mapper().legends; track
14199
14206
  legend) {
@@ -14244,7 +14251,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
14244
14251
  </div>
14245
14252
  <ng-content></ng-content>
14246
14253
  `, 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 }] }] } });
14254
+ }], 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 }] }], onMap: [{ type: i0.Output, args: ["onMap"] }] } });
14248
14255
  // Define map styles
14249
14256
  const mapStyles = {
14250
14257
  'carto-positron': {
@@ -14634,7 +14641,8 @@ class HardinessMapper {
14634
14641
  constructor() {
14635
14642
  const _ = effect(() => {
14636
14643
  const settings = this.settings();
14637
- this._update(settings);
14644
+ // this._update(settings);
14645
+ this.create();
14638
14646
  }, ...(ngDevMode ? [{ debugName: "_" }] : []));
14639
14647
  }
14640
14648
  async create() {