add zone, add popup address, add popup zone, add remove marker, add close popup

This commit is contained in:
David Nguyen 2025-10-07 16:25:36 -04:00
parent 849a6f07a0
commit e823f060c8
Signed by: david.nguyen
GPG Key ID: D5FB5A5715829326

View File

@ -1,5 +1,5 @@
import {Map, NavigationControl, Marker, Popup} from 'maplibre-gl'; import {Map, NavigationControl, Marker, Popup} from 'maplibre-gl';
import { Map as Map$1, TileLayer, Marker as Marker$1 } from 'leaflet'; import { Map as Map$1, TileLayer, Marker as Marker$1, polygon } from 'leaflet';
import * as i0 from '@angular/core'; import * as i0 from '@angular/core';
import { inject, PLATFORM_ID, output, Directive, Injector, input, runInInjectionContext, effect, ViewChild, Component } from '@angular/core'; import { inject, PLATFORM_ID, output, Directive, Injector, input, runInInjectionContext, effect, ViewChild, Component } from '@angular/core';
import { isPlatformBrowser } from '@angular/common'; import { isPlatformBrowser } from '@angular/common';
@ -263,7 +263,7 @@ class LeafletAdapter {
if (zone.opacity) if (zone.opacity)
opacity = zone.opacity; opacity = zone.opacity;
const polygon = L.polygon(latlngs, { color, fillOpacity: opacity }) polygon(latlngs, { color, fillOpacity: opacity })
.addTo(this.map); .addTo(this.map);
} }
} }
@ -290,11 +290,10 @@ class LeafletAdapter {
${address.deliverySchedule ? `<p>Delivery time estimate ${address.deliverySchedule}</p>` : ''} ${address.deliverySchedule ? `<p>Delivery time estimate ${address.deliverySchedule}</p>` : ''}
</div>`, </div>`,
{ {
permanent: true, permanent: true,
offset: [-38, 135] offset: [-38, 135]
}) })
.openTooltip(); .openTooltip();
this.map.on('move', () => { this.map.on('move', () => {
if (this.popup) { if (this.popup) {
const newBounds = this.map.getBounds(); const newBounds = this.map.getBounds();
@ -323,17 +322,13 @@ class LeafletAdapter {
opacity: 0 opacity: 0
}) })
.addTo(this.map) .addTo(this.map)
.bindTooltip(` .bindPopup(`
<div class="delivery-zone"> <div >
${zone.name ? `<p><strong>${zone.name}</strong></p>` : ''} ${zone.name ? `<p><strong>${zone.name}</strong></p>` : ''}
${zone.shippingFee ? `<p>Shipping: ${zone.shippingFee}</p>` : ''} ${zone.shippingFee ? `<p>Shipping: ${zone.shippingFee}</p>` : ''}
${zone.deliverySchedule ? `<p>Delivery: ${zone.deliverySchedule}</p>` : ''} ${zone.deliverySchedule ? `<p>Delivery: ${zone.deliverySchedule}</p>` : ''}
</div>`, </div>`)
{ .openPopup();
permanent: true,
offset: [0, 0]
})
.openTooltip();
} }
closePopup() closePopup()
{ {