@zwishing/emap 0.3.1 → 0.3.3

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 CHANGED
@@ -7,6 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.3] - 2026-05-24
11
+
12
+ ### Performance
13
+
14
+ - Slow pan/wheel navigation now reuses the previous rendered canvas frame via
15
+ CSS transform while a full redraw is deferred until interaction end. The
16
+ scheduler avoids synchronous canvas readback, preventing the zoom jank seen
17
+ with `getImageData()`-based frame timing.
18
+ - Canvas stroke batching now flushes paths every 100 arcs/paths instead of 25,
19
+ matching mapshaper's lower-overhead draw cadence for large topology renders.
20
+ - Viewport arc filtering skips per-arc checks near full extent and raises the
21
+ minimum visible path threshold to 0.35px, reducing redraw work without
22
+ changing zoomed-in detail.
23
+ - `DrawFeatureHandler._findSnapTarget` now filters candidate vertices and arc
24
+ segments by a world-space bbox derived from the cursor's pixel `snapThreshold`,
25
+ skipping `project()`/`hypot()` on points that cannot win. Removes the per-frame
26
+ O(N) cost over the entire `xx/yy` arrays on large topologies, making snapping
27
+ responsive on datasets with hundreds of thousands of vertices.
28
+
29
+ ## [0.3.2] - 2026-05-23
30
+
31
+ ### Added
32
+
33
+ - `EditToolbar` now accepts explicit `controls`, allowing examples and apps to
34
+ compose toolbar buttons directly from existing UI controls.
35
+ - Added `draw-snap-clear.html` to demonstrate that draw snapping markers clear
36
+ as soon as the cursor leaves the configured threshold.
37
+
38
+ ### Changed
39
+
40
+ - Renamed the batch snapping example from `snap.html` to `snap-layer.html` to
41
+ make its `snapLayer` purpose explicit.
42
+ - Upgraded the direct `mproj` dependency to `^0.1.2` while keeping the browser
43
+ bundle self-contained.
44
+
45
+ ### Fixed
46
+
47
+ - Draw snapping now clears stale snap overlays when the cursor moves outside the
48
+ snap threshold before the first vertex is placed.
49
+ - Vertex editing can snap dragged nodes to other features' vertices or edges,
50
+ controlled by `snapThreshold`, `snapToVertex`, and `snapToEdge`.
51
+ - `DrawFeatureControl` reapplies its own handler options when switching between
52
+ draw buttons in a shared toolbar.
53
+ - `projectLayer` normalizes common EPSG aliases (`EPSG:3857`, `EPSG:900913`,
54
+ `EPSG:102100`, `EPSG:4326`) to mapshaper's browser-safe CRS names.
55
+
10
56
  ## [0.3.1] - 2026-05-21
11
57
 
12
58
  ### Changed
@@ -336,7 +382,10 @@ Initial public release.
336
382
  - Distributed control stylesheet as `dist/emap.css` (importable via
337
383
  `@zwishing/emap/style.css`).
338
384
 
339
- [Unreleased]: https://github.com/zwishing/emap/compare/v0.3.0...HEAD
385
+ [Unreleased]: https://github.com/zwishing/emap/compare/v0.3.3...HEAD
386
+ [0.3.3]: https://github.com/zwishing/emap/compare/v0.3.2...v0.3.3
387
+ [0.3.2]: https://github.com/zwishing/emap/compare/v0.3.1...v0.3.2
388
+ [0.3.1]: https://github.com/zwishing/emap/compare/v0.3.0...v0.3.1
340
389
  [0.3.0]: https://github.com/zwishing/emap/compare/v0.2.0...v0.3.0
341
390
  [0.2.0]: https://github.com/zwishing/emap/compare/v0.1.3...v0.2.0
342
391
  [0.1.3]: https://github.com/zwishing/emap/compare/v0.1.2...v0.1.3
@@ -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
  }