Single draw plugin - #422
Merged
Merged
Conversation
…e shared utility Moved touch target SVG generation out of individual adapters into a centralized utility (/src/utils/touchTarget.js) that generates the SVG dynamically based on SIZES config. Both adapters now import and use the same createTouchTarget, applyTouchTargetColors, showTouchTarget, hideTouchTarget, and isOnTouchTarget functions. This eliminates duplicate SVG strings and makes touch target sizing configuration-driven, allowing coordinated changes across frameworks by updating SIZES.touchTargetSize or SIZES.touchIndicatorRadius in a single location. Changes: - Created /src/utils/touchTarget.js with dynamic SVG generation - Updated maplibre touchHandlers.js to use shared utility - Updated openlayers touchTarget.js to re-export shared utility - Fixed selector in mapboxDraw.js to use data-im-draw-touch-target Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The function needs to be exported since mapboxDraw.js imports it. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Move hardcoded keyboard movement amounts (NUDGE=1, STEP=5 pixels) from individual adapters to a centralized KEYBOARD config in defaults.js alongside COLORS, SIZES, and TOLERANCES. Both MapLibre and OpenLayers now import from the same source, ensuring consistent keyboard behavior across adapters. This makes it easy to adjust keyboard movement sensitivity globally if needed, and maintains consistency with the plugin's other configuration patterns. Changes: - Added KEYBOARD export to /src/defaults.js with nudgeAmount and stepAmount - Updated maplibre/modes/editVertex/vertexOperations.js to use KEYBOARD config - Updated openlayers/edit/keyboardHandler.js to use KEYBOARD config Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
dannyleech
marked this pull request as ready for review
August 5, 2026 12:48
markfee
approved these changes
Aug 5, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The unified plugins/draw package replaces the separate draw-ml and draw-ol betas with a single plugin built on a shared adapter mechanism (MapLibre and OpenLayers implementations behind one interface), mirroring the pattern already used by the datasets plugin — draw-es remains a separate, unaffected plugin. It consolidates the drawing/editing API into a consistent set of methods (newPolygon, newLine, editFeature, addFeature, deleteFeature) and adds two new ones, split and merge, for turf-based polygon geometry operations. Validation is unified across both adapters via a shared built-in rule set (minimum vertices, self-intersection, non-zero area) plus an onGeometryChange callback contract with well-defined lifecycle phases, and shape/vertex/snap colours and sizes now resolve identically on both providers instead of being adapter-specific. It also wires in Move control D-pad support for nudging a selected vertex, brings substantial shared test coverage across both adapters, fixes a number of pre-existing bugs along the way (including a MapLibre edit-cancel regression that failed to revert a moved vertex), and adds full plugin documentation and an updated demo/docs example.