homeflowjs 0.13.5 → 0.13.6
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.
package/package.json
CHANGED
@@ -252,6 +252,18 @@ export default class GeonamesMap extends DraggableMap {
|
|
252
252
|
this.propertiesLayer.addTo(this.map);
|
253
253
|
}
|
254
254
|
|
255
|
+
popup(marker) {
|
256
|
+
const formatter = Intl.NumberFormat('en', { notation: 'compact' });
|
257
|
+
const priceValue = marker?.property?.price_value;
|
258
|
+
const formattedPrice = priceValue ? formatter.format(priceValue) : null;
|
259
|
+
|
260
|
+
if (!priceValue) return;
|
261
|
+
|
262
|
+
return `
|
263
|
+
<div class="geomap__property-popup">£${formattedPrice}</div>
|
264
|
+
`;
|
265
|
+
}
|
266
|
+
|
255
267
|
generateMarker(propertyOrGeoname) {
|
256
268
|
const marker = L.marker(
|
257
269
|
[propertyOrGeoname.lat, propertyOrGeoname.lng],
|
@@ -268,6 +280,15 @@ export default class GeonamesMap extends DraggableMap {
|
|
268
280
|
}
|
269
281
|
});
|
270
282
|
|
283
|
+
marker.on('mouseover', (e) => {
|
284
|
+
if (!marker?.property) return;
|
285
|
+
|
286
|
+
L.popup({ closeButton: false, offset: [0, -40] })
|
287
|
+
.setLatLng(e.latlng)
|
288
|
+
.setContent(this.popup(marker))
|
289
|
+
.openOn(this.map)
|
290
|
+
});
|
291
|
+
|
271
292
|
if (Homeflow.get('show_geoname_polygon_on_mouseover') && propertyOrGeoname.polygon?.length) {
|
272
293
|
marker.on('mouseover', () => this.geonameMarkerMouseOver(marker));
|
273
294
|
marker.on('mouseout', () => this.geonameMarkerMouseOut(marker));
|