← All releasesReleased on
Element Editor 0.3.0
Added
- Start and stop point editing from code.
ref.setVertexEdit(id)puts a line or area in point editing, as a double-click does (it selects the feature, turns off a drawing tool and shows the circle / rectangle / route notice);ref.setVertexEdit(null)leaves it;ref.getVertexEdit()returns the id. The newonVertexEditChangeprop on<ElementEditor>and both adapters'<ElementEditorControls>fires once whenever point editing starts or ends, by the user or by your app. Points, hidden features and areadonlyeditor are refused (false, with a development warning).uiStoregainsvertexEditFeatureId(vertexEditActivefollows it). - Drawing and point editing work with a finger, on both maps. Drawing a line, area or measurement by taps finishes with Done in the drawing bar, and Undo point takes back the last point (tapping the first point still closes an area). A second tap on a selected line or area starts point editing, and the shape's action bar shows Edit points on a touch screen. While editing, every edge shows its midpoint, point and midpoint handles take a 44 px touch area (they look the same), and a long-press on a point opens the same menu as right-click. The editor decides per press, so a mouse keeps exactly today's behaviour and a touch laptop gets both.
geometryTypes: choose which geometry types the editor accepts. Pass GeoJSON type names, for examplegeometryTypes={['Polygon', 'MultiPolygon']}, to<ElementEditor />(both engines) or to either adapter's<ElementEditorControls />. The limit holds for every way a shape can get in: drawing, paste, import,initialData, merge, break apart, boolean operations, buffer, cut and slice, the GeoJSON inspector and the ref API. A refused change leaves your data untouched and reports anerrorevent with the new code'geometry-type-not-allowed'. Drawing tools that can't draw an allowed type leave the toolbar, and menu actions whose result would be refused are hidden. Imports skip the features that aren't allowed (ImportResult.refusedcounts them). See Restricting tools.replaceAtLimit: a "pick the location" field in one line. WithmaxFeatures={1}, addreplaceAtLimitand every drawing tool (point, line, area, rectangle, circle, freehand, route, picker) replaces the one feature's shape instead of being refused at the limit. The feature keeps its id and properties, undo brings the old shape back, andonFeatureUpdatefires once. Paste, duplicate, import merge andaddFeaturestill refuse. See Restricting tools.- New
coordinatesoption on<ElementEditor>and both adapters'<ElementEditorControls>:{ wrap?: boolean; precision?: number }cleans every committed coordinate (longitude wrapped into [-180, 180] per feature, x/y rounded, altitude kept), so the store,onChangeand undo history hold the same values. Off by default. Core:CoordinateOptions,dataStore.setCoordinateOptions.
Changed
updateFeatureandupdateFeaturesin the data store returnboolean(false whengeometryTypesrefused the geometry),mergeFeaturesreturnsboolean(false when nothing was merged), andimportGeoJSONalso returnsrefused. They returned nothing, or three counts, before.- Using an adapter without the stock panels now ships and fetches much less. A host that only mounts
ElementEditorControlsand drives tools through the ref no longer bundles the GeoJSON inspector, data table, layers list, drag-and-drop or boolean-operations code, and the browser no longer downloads them in the background after load (about 24 KB gzipped less in the main bundle, and roughly 290 KB gzipped of idle-time downloads gone). The drop-in and hosts that render the panels behave as before.