feat: complete Tier 4 marker/popup options, events, and live drag (#1)
Add missing marker options (offset, scale, opacity, opacityWhenCovered, className) and popup options (closeOnClick, closeOnMove, anchor, offset, className). Return MarkerHandle from AddMarker with OnClick, OnDragStart, OnDrag, OnDragEnd event methods. Return PopupHandle from ShowPopup with OnOpen, OnClose event methods. Upgrade drag signal writeback to fire during drag (throttled via requestAnimationFrame) in addition to dragend, enabling real-time position sync across clients.
This commit is contained in:
@@ -158,15 +158,21 @@ func main() {
|
||||
m.AddMarker("sf", maplibre.Marker{
|
||||
LngLat: maplibre.LngLat{Lng: -122.4194, Lat: 37.7749},
|
||||
Color: "#e74c3c",
|
||||
Scale: 1.3,
|
||||
Popup: &maplibre.Popup{
|
||||
Content: "<strong>San Francisco</strong><p>The Golden City</p>",
|
||||
},
|
||||
})
|
||||
noCloseOnClick := false
|
||||
m.AddMarker("oak", maplibre.Marker{
|
||||
LngLat: maplibre.LngLat{Lng: -122.2711, Lat: 37.8044},
|
||||
Color: "#2ecc71",
|
||||
LngLat: maplibre.LngLat{Lng: -122.2711, Lat: 37.8044},
|
||||
Color: "#2ecc71",
|
||||
Opacity: 0.7,
|
||||
Popup: &maplibre.Popup{
|
||||
Content: "<strong>Oakland</strong>",
|
||||
Content: "<strong>Oakland</strong>",
|
||||
Anchor: "bottom",
|
||||
Offset: [2]float64{0, -10},
|
||||
CloseOnClick: &noCloseOnClick,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user