geoproject-app/public/site/blueprints/pages/marker.yml
isUnknown cc44a68e66
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 19s
fix: implement form-based coordinate sync for single mode map
Fixed marker display and centering in single mode (marker pages) by
changing from props-based to form-based coordinate synchronization.

Issues Fixed:
- Kirby blueprint query syntax {{ page.field }} passed literal strings
  instead of values to component props
- Invalid coordinates (NaN, NaN) caused map initialization errors
- Marker not displaying in marker page position tab
- Map not centering on marker location

Solution:
- Remove latitude/longitude props from marker.yml blueprint
- Read coordinates directly from Panel form fields via DOM
- Add event listeners to sync form changes with map
- Bidirectional sync: drag marker → updates form fields
- Robust coordinate validation (check for NaN, null, 0)

Changes:
- MapEditor.vue: Add form field reading and event listeners
- MapEditor.vue: Replace props-based coords with reactive refs
- MapEditor.vue: Update marker drag handler to modify form inputs
- marker.yml: Remove non-functional query string props
- routes.php: Use data() instead of body() for all routes

Single Mode Flow:
1. Component reads latitude/longitude from form inputs on mount
2. Creates marker and centers map on valid coordinates
3. Form changes → updates marker position
4. Marker drag → updates form fields (triggers save on user action)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-29 14:17:01 +01:00

61 lines
1.4 KiB
YAML

title: Marqueur
icon: location
tabs:
content:
label: Contenu
columns:
main:
width: 1/1
sections:
fields:
type: fields
fields:
title:
label: Titre du marqueur
type: text
required: true
content:
label: Contenu
type: blocks
fieldsets:
- heading
- text
- image
- list
- quote
position:
label: Position
columns:
left:
width: 1/3
sections:
coordinates:
type: fields
fields:
latitude:
label: Latitude
type: number
step: 0.000001
min: -90
max: 90
required: true
longitude:
label: Longitude
type: number
step: 0.000001
min: -180
max: 180
required: true
right:
width: 2/3
sections:
map:
type: fields
fields:
mapPreview:
label: Position sur la carte
type: map-editor
mode: single
help: Déplacez le marqueur ou recherchez une adresse