Fixes to MaplibreGL Rectangle editing #361
No reviewers
Labels
No labels
0.1
0.2
0.3
1.0
Ox
Ox.Geo
Ox.Image
Ox.UI
Ox.Unicode
critical
defect
deleteme
duplicate
enhancement
fixed
major
minor
normal
severity: major
severity: minor
severity: normal
task
trivial
wontfix
worksforme
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
0x2620/oxjs!361
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sanj/oxjs:maplibre-fix-editing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AI Generated summary of changes:
Core Issues Fixed:
Files Modified:
Result:
Rectangle editing now works completely:
Human written TODOs:
cc @j
Core Issues Fixed: 1. MapLibre GL Event Compatibility: Fixed drag event handlers in MapMarker.js and MapRectangleMarker.js to use marker.getLngLat() instead of accessing e.lngLat properties that don't exist in MapLibre GL. 2. Rectangle Handle Visibility: Replaced Ox.MapMarkerImage() with proper DOM elements for corner handles since MapLibre GL expects DOM elements, not image objects. 3. Handle Positioning: Limited corner markers to only the 4 corners (ne, nw, se, sw) instead of all 8 positions (including edges). 4. Visual Rectangle Updates: Added that.rectangle.setBounds() call in MapRectangle update method so the visual rectangle updates when handles are dragged. 5. Click Event Conflicts: Fixed map click handler to detect rectangle clicks and avoid deselecting rectangles when clicked for editing. 6. Place Editable Property: Added editable: true as default in MapPlace constructor. Files Modified: - MapPlace.js: Added editable: true default - MapRectangle.js: - Limited markers to 4 corners only - Added rectangle bounds update in update() method - MapRectangleMarker.js: - Created proper DOM elements for handles - Fixed MapLibre GL drag event handling - Improved event cleanup - MapMarker.js: Fixed MapLibre GL drag event handling - MapMarkerImage.js: Fixed rectangle marker color (kept for backward compatibility) - Map.js: Added rectangle click detection to prevent conflicts Result: Rectangle editing now works completely: - Click rectangle → shows 4 corner handles - Drag handles → resizes rectangle in real-time - No console errors - Proper event handling