Hello, I'm using shapes/circles in Leaflet maps. Is it possible to add a label when hovering over the circle?
Hi @Francival,
On a quick look at Leaflet's documentation, I've found the tooltip functionality that allows among other things to fulfill this exact use case.
You can have two scenarios:
let circleShape = OutSystems.Maps.MapAPI.ShapeManager.GetShapeById($parameters.ShapeId); circleShape.provider.bindTooltip( "This is a circle shape!", { permanent: false, // It will only show when hovering direction: "top" }); // $parameters.ShapeId being the identifier of the Shapes\Circle block
let shapes = OutSystems.Maps.MapAPI.MapManager.GetMapById($parameters.MapId).shapes; let circles = shapes.filter(shape => shape._type === "Circle"); // Iterate over the filtered circles and bind a tooltip to each one circles.forEach(circleObj => { circleObj.provider.bindTooltip( "This is a circle shape from drawing tools!", { permanent: false, // It will only show when hovering direction: "top" }); }); // $parameters.MapId being the identifier of the Map block
Here's the result:
Hope it helps!
Cheers,GM
Hello @Francival
To make this a more efficient and collaborative process, please share an oml with what you've tried so far, and, check on the associated provider documentation if that is a support use case sharing that sample.