@zwishing/emap 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/core/handlers/vertex-edit.d.ts +11 -0
- package/dist/emap-worker.js +1 -1
- package/dist/emap.js +4 -4
- package/dist/emap.mjs +1 -1
- package/dist/mapshaper-vendor.js +1 -1
- package/dist/mapshaper-vendor.mjs +1 -1
- package/dist/ui/draw-feature-control.d.ts +2 -0
- package/dist/ui/edit-toolbar.d.ts +6 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.2] - 2026-05-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `EditToolbar` now accepts explicit `controls`, allowing examples and apps to
|
|
15
|
+
compose toolbar buttons directly from existing UI controls.
|
|
16
|
+
- Added `draw-snap-clear.html` to demonstrate that draw snapping markers clear
|
|
17
|
+
as soon as the cursor leaves the configured threshold.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Renamed the batch snapping example from `snap.html` to `snap-layer.html` to
|
|
22
|
+
make its `snapLayer` purpose explicit.
|
|
23
|
+
- Upgraded the direct `mproj` dependency to `^0.1.2` while keeping the browser
|
|
24
|
+
bundle self-contained.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Draw snapping now clears stale snap overlays when the cursor moves outside the
|
|
29
|
+
snap threshold before the first vertex is placed.
|
|
30
|
+
- Vertex editing can snap dragged nodes to other features' vertices or edges,
|
|
31
|
+
controlled by `snapThreshold`, `snapToVertex`, and `snapToEdge`.
|
|
32
|
+
- `DrawFeatureControl` reapplies its own handler options when switching between
|
|
33
|
+
draw buttons in a shared toolbar.
|
|
34
|
+
- `projectLayer` normalizes common EPSG aliases (`EPSG:3857`, `EPSG:900913`,
|
|
35
|
+
`EPSG:102100`, `EPSG:4326`) to mapshaper's browser-safe CRS names.
|
|
36
|
+
|
|
10
37
|
## [0.3.1] - 2026-05-21
|
|
11
38
|
|
|
12
39
|
### Changed
|
|
@@ -3,6 +3,12 @@ import { Emap } from '../../map/map';
|
|
|
3
3
|
export interface VertexEditOptions {
|
|
4
4
|
/** Polygon hover fill. Default 'rgba(0,0,0,0.15)'. */
|
|
5
5
|
polygonFillColor?: string;
|
|
6
|
+
/** Pixel threshold for snapping a dragged vertex to another feature. Default 10. */
|
|
7
|
+
snapThreshold?: number;
|
|
8
|
+
/** Snap dragged vertices to other features' existing vertices. Default true. */
|
|
9
|
+
snapToVertex?: boolean;
|
|
10
|
+
/** Snap dragged vertices to other features' edges. Default true. */
|
|
11
|
+
snapToEdge?: boolean;
|
|
6
12
|
}
|
|
7
13
|
export declare class VertexEditHandler implements Handler<VertexEditOptions> {
|
|
8
14
|
readonly name = "vertexEdit";
|
|
@@ -23,6 +29,9 @@ export declare class VertexEditHandler implements Handler<VertexEditOptions> {
|
|
|
23
29
|
private _neighborShapes;
|
|
24
30
|
/** Coordinate of the dragged node before mouse-down, captured for VertexMoveCommand. */
|
|
25
31
|
private _dragFromCoords;
|
|
32
|
+
private _snapThreshold;
|
|
33
|
+
private _snapToVertex;
|
|
34
|
+
private _snapToEdge;
|
|
26
35
|
private _onMapMoveBound;
|
|
27
36
|
constructor(map: Emap, opts?: VertexEditOptions);
|
|
28
37
|
isEnabled(): boolean;
|
|
@@ -94,5 +103,7 @@ export declare class VertexEditHandler implements Handler<VertexEditOptions> {
|
|
|
94
103
|
private _onMouseDown;
|
|
95
104
|
private _pushVertexInsertCommand;
|
|
96
105
|
private _handleDrag;
|
|
106
|
+
private _resolveDragCoords;
|
|
107
|
+
private _findDragSnapTarget;
|
|
97
108
|
private _finishDrag;
|
|
98
109
|
}
|