Skip to content

Commit 9ba2ed8

Browse files
committed
Use leaflet tooltip for map
Signed-off-by: Cintia Sánchez García <[email protected]>
1 parent 2d11478 commit 9ba2ed8

File tree

1 file changed

+9
-13
lines changed
  • ocg-server/static/js/community/explore

1 file changed

+9
-13
lines changed

ocg-server/static/js/community/explore/map.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,22 @@ export class Map {
193193
// Create marker
194194
const marker = L.marker(L.latLng(item.latitude, item.longitude), {
195195
icon: icon,
196+
autoPanOnFocus: false,
196197
bubblingMouseEvents: true,
197198
});
198199

199200
if (item.popover_html) {
200201
// Add popup to marker
201-
marker.bindPopup(
202+
marker.bindTooltip(
202203
`<div class="flex flex-1 flex-row items-center min-w-[370px]">${item.popover_html}</div>`,
204+
{
205+
direction: "top",
206+
permanent: false,
207+
sticky: true,
208+
offset: [0, 0],
209+
opacity: 1,
210+
},
203211
);
204-
205-
// Open popup on hover
206-
marker.on("mouseover", () => {
207-
this.enabledMoveEnd = false;
208-
marker.openPopup();
209-
});
210-
211-
// Close popup on mouseout
212-
marker.on("mouseout", () => {
213-
this.enabledMoveEnd = true;
214-
marker.closePopup();
215-
});
216212
}
217213

218214
// Add marker to the marker cluster group

0 commit comments

Comments
 (0)