fix: draggable pin writeback and click-to-place event collision

Three related bugs in the maplibre reactive signal plumbing:

1. Draggable marker coordinates never updated because dragendHandlerJS
   queries for hidden inputs matching LngSignal/LatSignal IDs, but
   Element() never rendered those inputs. Add them after the marker
   data-effect divs.

2. Click-to-place marker didn't appear until moveend because Element()
   rendered a bare hidden input for each event signal, colliding with
   the user's action-bearing input (same data-bind, querySelector finds
   the bare one first). Remove the internal event inputs — the user
   provides their own via MapEvent.Input().

3. The moveend handler dispatched 'input' on ALL data-bind inputs in
   the wrapper, accidentally triggering event inputs. Add an else-return
   so only the 5 viewport signal inputs get dispatched.
This commit is contained in:
Ryan Hamamura
2026-02-20 07:25:18 -10:00
parent 7eb86999b2
commit b2474bf79d
2 changed files with 9 additions and 5 deletions

View File

@@ -140,6 +140,7 @@ func initScript(m *Map) string {
`else if(sig===%[4]s)inp.value=map.getZoom();`+
`else if(sig===%[5]s)inp.value=map.getBearing();`+
`else if(sig===%[6]s)inp.value=map.getPitch();`+
`else return;`+
`inp.dispatchEvent(new Event('input',{bubbles:true}));`+
`});`+
`});`,