Re-implement and fix detail side section
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
<div class="map-wrapper">
|
||||
<div
|
||||
class="map-container"
|
||||
[ngClass]="isFullscreen ? 'map-fullscreen' : 'map-details'"
|
||||
leaflet
|
||||
[leafletOptions]="options"
|
||||
(leafletMapReady)="onMapReady($event)"
|
||||
></div>
|
||||
@if (!isFullscreen && details) {
|
||||
<div class="details">
|
||||
<h2>{{ details.name }}</h2>
|
||||
<p>{{ details.building }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.map-container {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 54px;
|
||||
height: calc(100vh - 54px);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
}
|
||||
|
||||
.map-details {
|
||||
left: 10%;
|
||||
width: 90%;
|
||||
left: 25%;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.details {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 54px;
|
||||
left: 0;
|
||||
width: 10%;
|
||||
left: 25px;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, signal, OnInit } from '@angular/core';
|
||||
import { Component, signal, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { LeafletModule } from '@bluehalo/ngx-leaflet';
|
||||
import { center } from '@turf/turf';
|
||||
@@ -19,6 +19,7 @@ export class OSMMap implements OnInit {
|
||||
|
||||
protected readonly title = signal('HKA-OSM');
|
||||
map?: L.Map;
|
||||
details?: D.Details;
|
||||
|
||||
osm?: L.TileLayer;
|
||||
options: L.MapOptions = {};
|
||||
@@ -27,7 +28,8 @@ export class OSMMap implements OnInit {
|
||||
isFullscreen = true;
|
||||
|
||||
constructor(
|
||||
private overpass: Overpass
|
||||
private overpass: Overpass,
|
||||
private cdr: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -73,6 +75,7 @@ export class OSMMap implements OnInit {
|
||||
this.map?.setView(this.getCenter(feature.geometry), 20);
|
||||
this.buildingLayer = this.queryBuildings(feature.properties.name);
|
||||
this.buildingLayer.addTo(this.map!);
|
||||
this.details = new D.Details(feature.properties.name, feature.properties.building)
|
||||
} else {
|
||||
this.map?.setView(this.getCenter(), 18);
|
||||
if (this.buildingLayer) {
|
||||
@@ -81,6 +84,7 @@ export class OSMMap implements OnInit {
|
||||
}
|
||||
console.log('Set isFullscreen to:', this.isFullscreen);
|
||||
console.log('Clicked on feature:', feature.properties?.name);
|
||||
this.cdr.detectChanges();
|
||||
},
|
||||
});
|
||||
if (feature.properties && feature.properties.name) {
|
||||
|
||||
Reference in New Issue
Block a user