@zwishing/emap 0.3.0 → 0.3.1
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 +14 -0
- package/FEATURES.md +1 -1
- package/README.md +4 -4
- package/dist/core/handlers/box-select.d.ts +2 -3
- package/dist/core/handlers/drag-pan.d.ts +8 -1
- package/dist/core/handlers/transform-feature.d.ts +6 -0
- package/dist/emap.js +2 -2
- package/dist/emap.mjs +1 -1
- package/dist/ui/box-select-control.d.ts +9 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-05-21
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `boxSelect` now behaves like an active selection tool by default: plain
|
|
15
|
+
left-drag starts a rectangular selection and replaces the previous selection,
|
|
16
|
+
while `Shift`+drag adds to the existing selection and `Shift`+`Alt`+drag
|
|
17
|
+
toggles matching features.
|
|
18
|
+
- `transform` edit mode keeps map panning available outside already-selected
|
|
19
|
+
features; dragging selected features still starts a transform session.
|
|
20
|
+
- When pan or translate-transform mode is active and the pointer hovers an
|
|
21
|
+
already-selected feature, the canvas cursor now switches to `move`; active
|
|
22
|
+
map dragging still uses `grabbing`.
|
|
23
|
+
|
|
10
24
|
## [0.3.0] - 2026-05-21
|
|
11
25
|
|
|
12
26
|
### Added
|
package/FEATURES.md
CHANGED
|
@@ -134,7 +134,7 @@ these directly without using bundled UI controls.
|
|
|
134
134
|
| `map.dragPan` | Pointer drag map panning |
|
|
135
135
|
| `map.scrollZoom` | Wheel zoom |
|
|
136
136
|
| `map.clickSelect` | Click selection |
|
|
137
|
-
| `map.boxSelect` |
|
|
137
|
+
| `map.boxSelect` | Active-tool rectangular selection |
|
|
138
138
|
| `map.lassoSelect` | Free-form lasso selection |
|
|
139
139
|
| `map.vertexEdit` | Topology-aware vertex editing |
|
|
140
140
|
| `map.drawFeature` | Point, polyline, and polygon drawing |
|
package/README.md
CHANGED
|
@@ -189,7 +189,6 @@ them directly from your own UI instead of adding `BoxSelectControl`,
|
|
|
189
189
|
```ts
|
|
190
190
|
map.boxSelect.setOptions({
|
|
191
191
|
layers: ['district-fill'],
|
|
192
|
-
dragActivator: 'shift',
|
|
193
192
|
dragThreshold: 4,
|
|
194
193
|
});
|
|
195
194
|
map.boxSelect.enable();
|
|
@@ -229,7 +228,7 @@ Available named handlers:
|
|
|
229
228
|
| `map.dragPan` | Pointer drag map panning |
|
|
230
229
|
| `map.scrollZoom` | Wheel zoom |
|
|
231
230
|
| `map.clickSelect` | Click selection |
|
|
232
|
-
| `map.boxSelect` |
|
|
231
|
+
| `map.boxSelect` | Active-tool rectangular selection |
|
|
233
232
|
| `map.lassoSelect` | Free-form lasso selection |
|
|
234
233
|
| `map.vertexEdit` | Topology-aware vertex editing |
|
|
235
234
|
| `map.drawFeature` | Point, polyline, and polygon drawing |
|
|
@@ -282,11 +281,12 @@ const clearButton = document.querySelector<HTMLButtonElement>('[data-tool="clear
|
|
|
282
281
|
|
|
283
282
|
map.boxSelect.setOptions({
|
|
284
283
|
layers: ['district-fill'],
|
|
285
|
-
dragActivator: 'shift',
|
|
286
284
|
dragThreshold: 4,
|
|
287
|
-
mode: 'replace',
|
|
288
285
|
});
|
|
289
286
|
|
|
287
|
+
// Plain drag replaces the current selection. Shift+drag adds to it;
|
|
288
|
+
// Shift+Alt+drag toggles matching features.
|
|
289
|
+
|
|
290
290
|
function activateBoxSelect() {
|
|
291
291
|
map.lassoSelect.disable();
|
|
292
292
|
map.vertexEdit.disable();
|
|
@@ -15,7 +15,7 @@ export interface BoxSelectStyle {
|
|
|
15
15
|
export interface BoxSelectHandlerOptions extends SelectHandlerOptions {
|
|
16
16
|
/** Min drag diagonal (px) before a release counts as a box. Default 4. */
|
|
17
17
|
dragThreshold?: number;
|
|
18
|
-
/** Combo that must be held at pointerdown to start. Default '
|
|
18
|
+
/** Combo that must be held at pointerdown to start. Default 'none'. */
|
|
19
19
|
dragActivator?: ModifierCombo;
|
|
20
20
|
style?: BoxSelectStyle;
|
|
21
21
|
}
|
|
@@ -25,8 +25,7 @@ export interface BoxSelectHandlerOptions extends SelectHandlerOptions {
|
|
|
25
25
|
* `_canvasContainer`, and on release past `dragThreshold` runs
|
|
26
26
|
* `queryFeatures(bbox)` → `select(mode)`. Mode is resolved by stripping the
|
|
27
27
|
* activator then matching `modifiers` — reproducing the legacy
|
|
28
|
-
*
|
|
29
|
-
* (enforced in HandlerManager — a later task).
|
|
28
|
+
* active-tool selection behavior. Mutually exclusive with `lassoSelect`.
|
|
30
29
|
*/
|
|
31
30
|
export declare class BoxSelectHandler extends EventDispatcher implements Handler<BoxSelectHandlerOptions> {
|
|
32
31
|
private _map;
|
|
@@ -4,6 +4,10 @@ export interface DragPanOptions {
|
|
|
4
4
|
/** Reserve shift+drag for higher-level handlers (P2b selection). Default true. */
|
|
5
5
|
skipShiftDrag: boolean;
|
|
6
6
|
}
|
|
7
|
+
type Point = {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
7
11
|
/**
|
|
8
12
|
* Named `dragPan` handler. Phase 2a: pan logic lives in `handlePointer`,
|
|
9
13
|
* driven by HandlerManager's single pointer-listener arbiter — the handler
|
|
@@ -16,8 +20,10 @@ export declare class DragPanHandler extends EventDispatcher implements Handler<D
|
|
|
16
20
|
private _enabled;
|
|
17
21
|
private _dragging;
|
|
18
22
|
private _last;
|
|
23
|
+
private _hoverPoint;
|
|
19
24
|
private _onGestureStart?;
|
|
20
|
-
|
|
25
|
+
private _isHoveringSelected?;
|
|
26
|
+
constructor(opts?: Partial<DragPanOptions>, onGestureStart?: () => void, isHoveringSelected?: (point: Point) => boolean);
|
|
21
27
|
enable(): void;
|
|
22
28
|
disable(): void;
|
|
23
29
|
isEnabled(): boolean;
|
|
@@ -26,3 +32,4 @@ export declare class DragPanHandler extends EventDispatcher implements Handler<D
|
|
|
26
32
|
getCursor(): string | null;
|
|
27
33
|
handlePointer(ev: NormalizedPointerEvent): HandlerResult;
|
|
28
34
|
}
|
|
35
|
+
export {};
|
|
@@ -24,6 +24,11 @@ export declare class TransformFeatureHandler implements Handler<TransformFeature
|
|
|
24
24
|
private _translate;
|
|
25
25
|
private _affine;
|
|
26
26
|
private _lastMap;
|
|
27
|
+
private _hoveringSelected;
|
|
28
|
+
/** Injected by HandlerManager.register (cursor recompute on mode flips). */
|
|
29
|
+
_manager?: {
|
|
30
|
+
refreshCursor(): void;
|
|
31
|
+
};
|
|
27
32
|
private _prevAngle;
|
|
28
33
|
private _prevDist;
|
|
29
34
|
private _onKeyDownBound;
|
|
@@ -35,6 +40,7 @@ export declare class TransformFeatureHandler implements Handler<TransformFeature
|
|
|
35
40
|
isEnabled(): boolean;
|
|
36
41
|
setOptions(o: Partial<TransformFeatureOptions>): void;
|
|
37
42
|
getOptions(): Readonly<TransformFeatureOptions>;
|
|
43
|
+
getCursor(): string | null;
|
|
38
44
|
private _cancelSession;
|
|
39
45
|
private _onKeyDown;
|
|
40
46
|
handlePointer(ev: NormalizedPointerEvent): HandlerResult;
|