@molecule/app-map-drawing-vue 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +550 -2
- package/dist/MapDrawing.d.ts +163 -0
- package/dist/MapDrawing.d.ts.map +1 -0
- package/dist/MapDrawing.js +533 -0
- package/dist/MapDrawing.js.map +1 -0
- package/dist/MapDrawingToolbar.d.ts +111 -0
- package/dist/MapDrawingToolbar.d.ts.map +1 -0
- package/dist/MapDrawingToolbar.js +110 -0
- package/dist/MapDrawingToolbar.js.map +1 -0
- package/dist/geometry.d.ts +50 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +94 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +140 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -4
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue map-drawing surface: a drawing toolbar over an interaction layer that
|
|
3
|
+
* authors geofence shapes (polygons, circles, pins, lines).
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-map-drawing-react`'s `MapDrawing` — the
|
|
6
|
+
* same props (React names), the same ClassMap classes and inline styles, the
|
|
7
|
+
* same SVG overlay, the same pointer semantics, and the same callback calls.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { computed, defineComponent, h, ref, watch, } from 'vue';
|
|
12
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
13
|
+
import { useTranslation } from '@molecule/app-vue';
|
|
14
|
+
import { closeRing, identityBackend, pointInRect } from './geometry.js';
|
|
15
|
+
import { MapDrawingToolbar } from './MapDrawingToolbar.js';
|
|
16
|
+
/** Default drawing tools shown in the toolbar. */
|
|
17
|
+
const DEFAULT_TOOLS = ['polygon', 'circle', 'pin', 'line'];
|
|
18
|
+
/**
|
|
19
|
+
* Stable id generator. Falls back to `Math.random()` so the component
|
|
20
|
+
* works in environments without `crypto.randomUUID` (older Node test
|
|
21
|
+
* runners, embedded WebViews).
|
|
22
|
+
*
|
|
23
|
+
* @returns A reasonably unique string id.
|
|
24
|
+
*/
|
|
25
|
+
function makeShapeId() {
|
|
26
|
+
if (typeof globalThis.crypto !== 'undefined' &&
|
|
27
|
+
typeof globalThis.crypto.randomUUID === 'function') {
|
|
28
|
+
return globalThis.crypto.randomUUID();
|
|
29
|
+
}
|
|
30
|
+
return `shape-${Math.random().toString(36).slice(2, 10)}-${Date.now().toString(36)}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves a node-valued prop that may also arrive as a same-named slot: the
|
|
34
|
+
* slot wins, and an absent pair contributes nothing.
|
|
35
|
+
*
|
|
36
|
+
* @param slot - The slot render function, when the caller passed the slot.
|
|
37
|
+
* @param prop - The prop value, when the caller passed the prop.
|
|
38
|
+
* @returns The children to render.
|
|
39
|
+
*/
|
|
40
|
+
const slotOrProp = (slot, prop) => {
|
|
41
|
+
if (slot)
|
|
42
|
+
return slot();
|
|
43
|
+
return prop != null ? [prop] : [];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Map-drawing surface for geofence editing. Renders a toolbar plus an
|
|
47
|
+
* interaction layer overlaid on top of the (optional) map slot. The
|
|
48
|
+
* component handles four drawing tools — polygon, circle, pin, line —
|
|
49
|
+
* plus a select / delete action group.
|
|
50
|
+
*
|
|
51
|
+
* Drawing semantics:
|
|
52
|
+
* - **polygon / line**: click adds vertices; double-click finalises.
|
|
53
|
+
* - **circle**: pointer-down sets the center; pointer-up commits with
|
|
54
|
+
* radius equal to the great-circle distance from center to release.
|
|
55
|
+
* - **pin**: each pointer-down adds one new pin shape.
|
|
56
|
+
* - **select**: pointer-drag draws a marquee; any shape whose anchor
|
|
57
|
+
* point lies inside the marquee is added to the selection.
|
|
58
|
+
*
|
|
59
|
+
* @param props - Component props (see {@link MapDrawingProps}).
|
|
60
|
+
* @returns The map-drawing component.
|
|
61
|
+
*/
|
|
62
|
+
export const MapDrawing = defineComponent({
|
|
63
|
+
name: 'MapDrawing',
|
|
64
|
+
props: {
|
|
65
|
+
/** Initial shapes to seed the surface with. */
|
|
66
|
+
initialShapes: { type: Array, default: undefined },
|
|
67
|
+
/** Called whenever the shape list changes. */
|
|
68
|
+
onChange: { type: Function, required: true },
|
|
69
|
+
/** Drawing tools to expose. */
|
|
70
|
+
tools: { type: Array, default: () => DEFAULT_TOOLS },
|
|
71
|
+
/** Externally controlled active tool. */
|
|
72
|
+
activeTool: { type: String, default: undefined },
|
|
73
|
+
/** Called when the active tool changes. */
|
|
74
|
+
onActiveToolChange: {
|
|
75
|
+
type: Function,
|
|
76
|
+
default: undefined,
|
|
77
|
+
},
|
|
78
|
+
/** Map backend used to project between geographic and screen coordinates. */
|
|
79
|
+
mapBackend: { type: Object, default: undefined },
|
|
80
|
+
/** Optional content for the map background, prop or slot. */
|
|
81
|
+
mapSlot: null,
|
|
82
|
+
/** Width of the surface (CSS). */
|
|
83
|
+
width: { type: [Number, String], default: '100%' },
|
|
84
|
+
/** Height of the surface (CSS). */
|
|
85
|
+
height: { type: [Number, String], default: 400 },
|
|
86
|
+
/** Extra classes merged onto the root element. */
|
|
87
|
+
className: { type: String, default: undefined },
|
|
88
|
+
},
|
|
89
|
+
setup(props, { slots }) {
|
|
90
|
+
const cm = getClassMap();
|
|
91
|
+
const { t } = useTranslation();
|
|
92
|
+
const shapes = ref(props.initialShapes?.slice() ?? []);
|
|
93
|
+
const internalActive = ref(props.tools[0] ?? 'polygon');
|
|
94
|
+
const activeTool = computed(() => props.activeTool ?? internalActive.value);
|
|
95
|
+
const selection = ref(new Set());
|
|
96
|
+
const draftPath = ref(null);
|
|
97
|
+
const draftCircle = ref(null);
|
|
98
|
+
const draftSelection = ref(null);
|
|
99
|
+
const surfaceEl = ref(null);
|
|
100
|
+
/**
|
|
101
|
+
* Push shape changes upward.
|
|
102
|
+
*
|
|
103
|
+
* @param next - The new shape list.
|
|
104
|
+
*/
|
|
105
|
+
const commitShapes = (next) => {
|
|
106
|
+
shapes.value = next;
|
|
107
|
+
props.onChange(next);
|
|
108
|
+
};
|
|
109
|
+
/** Reset all three draft states. */
|
|
110
|
+
const clearDrafts = () => {
|
|
111
|
+
draftPath.value = null;
|
|
112
|
+
draftCircle.value = null;
|
|
113
|
+
draftSelection.value = null;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Switch the active tool, discarding any in-progress draft.
|
|
117
|
+
*
|
|
118
|
+
* @param next - The next active tool.
|
|
119
|
+
*/
|
|
120
|
+
const setActiveTool = (next) => {
|
|
121
|
+
clearDrafts();
|
|
122
|
+
if (props.activeTool === undefined)
|
|
123
|
+
internalActive.value = next;
|
|
124
|
+
props.onActiveToolChange?.(next);
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Convert a pointer event's client coords to a screen-space point
|
|
128
|
+
* relative to the drawing surface.
|
|
129
|
+
*
|
|
130
|
+
* @param event - Native pointer event.
|
|
131
|
+
* @returns Screen-space point.
|
|
132
|
+
*/
|
|
133
|
+
const pointForEvent = (event) => {
|
|
134
|
+
const node = surfaceEl.value;
|
|
135
|
+
if (!node)
|
|
136
|
+
return { x: event.clientX, y: event.clientY };
|
|
137
|
+
const rect = node.getBoundingClientRect();
|
|
138
|
+
return { x: event.clientX - rect.left, y: event.clientY - rect.top };
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Handle a pointer press on the surface.
|
|
142
|
+
*
|
|
143
|
+
* @param event - Native pointer event.
|
|
144
|
+
*/
|
|
145
|
+
const handlePointerDown = (event) => {
|
|
146
|
+
const screen = pointForEvent(event);
|
|
147
|
+
const backend = props.mapBackend ?? identityBackend;
|
|
148
|
+
const lngLat = backend.unproject(screen);
|
|
149
|
+
if (activeTool.value === 'select') {
|
|
150
|
+
draftSelection.value = { start: screen, current: screen };
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (activeTool.value === 'circle') {
|
|
154
|
+
draftCircle.value = { center: lngLat, pointer: lngLat };
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (activeTool.value === 'pin') {
|
|
158
|
+
const pin = {
|
|
159
|
+
id: makeShapeId(),
|
|
160
|
+
kind: 'pin',
|
|
161
|
+
geometry: { type: 'Point', coordinates: lngLat },
|
|
162
|
+
};
|
|
163
|
+
commitShapes([...shapes.value, pin]);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// polygon / line: pointer-down adds a vertex to the open draft.
|
|
167
|
+
if (activeTool.value === 'polygon' || activeTool.value === 'line') {
|
|
168
|
+
if (draftPath.value && draftPath.value.kind !== activeTool.value) {
|
|
169
|
+
// Tool flipped mid-draft via external control — drop the stale draft.
|
|
170
|
+
draftPath.value = { vertices: [lngLat], kind: activeTool.value };
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const next = draftPath.value
|
|
174
|
+
? { ...draftPath.value, vertices: [...draftPath.value.vertices, lngLat] }
|
|
175
|
+
: { vertices: [lngLat], kind: activeTool.value };
|
|
176
|
+
draftPath.value = next;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Handle a pointer move during a circle or marquee drag.
|
|
181
|
+
*
|
|
182
|
+
* @param event - Native pointer event.
|
|
183
|
+
*/
|
|
184
|
+
const handlePointerMove = (event) => {
|
|
185
|
+
if (!draftCircle.value && !draftSelection.value)
|
|
186
|
+
return;
|
|
187
|
+
const screen = pointForEvent(event);
|
|
188
|
+
const backend = props.mapBackend ?? identityBackend;
|
|
189
|
+
if (draftCircle.value) {
|
|
190
|
+
draftCircle.value = { ...draftCircle.value, pointer: backend.unproject(screen) };
|
|
191
|
+
}
|
|
192
|
+
if (draftSelection.value) {
|
|
193
|
+
draftSelection.value = { ...draftSelection.value, current: screen };
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
/** Handle a pointer release that commits a circle or a marquee selection. */
|
|
197
|
+
const handlePointerUp = () => {
|
|
198
|
+
const backend = props.mapBackend ?? identityBackend;
|
|
199
|
+
if (draftCircle.value) {
|
|
200
|
+
const radius = backend.distanceMeters(draftCircle.value.center, draftCircle.value.pointer);
|
|
201
|
+
if (radius > 0) {
|
|
202
|
+
const circle = {
|
|
203
|
+
id: makeShapeId(),
|
|
204
|
+
kind: 'circle',
|
|
205
|
+
geometry: {
|
|
206
|
+
type: 'Point',
|
|
207
|
+
coordinates: draftCircle.value.center,
|
|
208
|
+
},
|
|
209
|
+
properties: { radiusMeters: radius },
|
|
210
|
+
};
|
|
211
|
+
commitShapes([...shapes.value, circle]);
|
|
212
|
+
}
|
|
213
|
+
draftCircle.value = null;
|
|
214
|
+
}
|
|
215
|
+
if (draftSelection.value) {
|
|
216
|
+
const next = new Set();
|
|
217
|
+
for (const shape of shapes.value) {
|
|
218
|
+
const anchor = anchorScreenPoint(shape, backend);
|
|
219
|
+
if (anchor &&
|
|
220
|
+
pointInRect(anchor, draftSelection.value.start, draftSelection.value.current)) {
|
|
221
|
+
next.add(shape.id);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
selection.value = next;
|
|
225
|
+
draftSelection.value = null;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
/** Finalise the open polygon or line draft on a double click. */
|
|
229
|
+
const handleDoubleClick = () => {
|
|
230
|
+
if (!draftPath.value)
|
|
231
|
+
return;
|
|
232
|
+
if (draftPath.value.kind === 'polygon') {
|
|
233
|
+
const ring = closeRing(draftPath.value.vertices);
|
|
234
|
+
if (ring) {
|
|
235
|
+
const polygon = {
|
|
236
|
+
id: makeShapeId(),
|
|
237
|
+
kind: 'polygon',
|
|
238
|
+
geometry: { type: 'Polygon', coordinates: [ring] },
|
|
239
|
+
};
|
|
240
|
+
commitShapes([...shapes.value, polygon]);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else if (draftPath.value.vertices.length >= 2) {
|
|
244
|
+
const line = {
|
|
245
|
+
id: makeShapeId(),
|
|
246
|
+
kind: 'line',
|
|
247
|
+
geometry: {
|
|
248
|
+
type: 'LineString',
|
|
249
|
+
coordinates: draftPath.value.vertices.slice(),
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
commitShapes([...shapes.value, line]);
|
|
253
|
+
}
|
|
254
|
+
draftPath.value = null;
|
|
255
|
+
};
|
|
256
|
+
/** Remove every selected shape and clear the selection. */
|
|
257
|
+
const deleteSelected = () => {
|
|
258
|
+
if (selection.value.size === 0)
|
|
259
|
+
return;
|
|
260
|
+
const next = shapes.value.filter((shape) => !selection.value.has(shape.id));
|
|
261
|
+
selection.value = new Set();
|
|
262
|
+
commitShapes(next);
|
|
263
|
+
};
|
|
264
|
+
// Keep the drafts clear when the controlled active tool changes.
|
|
265
|
+
watch(() => props.activeTool, (value) => {
|
|
266
|
+
if (value !== undefined)
|
|
267
|
+
clearDrafts();
|
|
268
|
+
});
|
|
269
|
+
return () => {
|
|
270
|
+
const backend = props.mapBackend ?? identityBackend;
|
|
271
|
+
const active = activeTool.value;
|
|
272
|
+
const hasDraft = draftPath.value !== null || draftCircle.value !== null || draftSelection.value !== null;
|
|
273
|
+
const ariaLabel = t('mapDrawing.surface.aria', {}, { defaultValue: 'Map drawing surface' });
|
|
274
|
+
const widthValue = typeof props.width === 'number' ? `${props.width}px` : props.width;
|
|
275
|
+
const heightValue = typeof props.height === 'number' ? `${props.height}px` : props.height;
|
|
276
|
+
const surfaceStyle = {
|
|
277
|
+
position: 'relative',
|
|
278
|
+
width: widthValue,
|
|
279
|
+
height: heightValue,
|
|
280
|
+
overflow: 'hidden',
|
|
281
|
+
touchAction: 'none',
|
|
282
|
+
};
|
|
283
|
+
const overlayStyle = {
|
|
284
|
+
position: 'absolute',
|
|
285
|
+
inset: '0px',
|
|
286
|
+
cursor: active === 'select' ? 'cell' : 'crosshair',
|
|
287
|
+
};
|
|
288
|
+
const overlayChildren = buildOverlayElements(shapes.value, draftPath.value, draftCircle.value, backend, selection.value);
|
|
289
|
+
if (draftSelection.value) {
|
|
290
|
+
const start = draftSelection.value.start;
|
|
291
|
+
const current = draftSelection.value.current;
|
|
292
|
+
overlayChildren.push(h('rect', {
|
|
293
|
+
'data-mol-id': 'map-drawing-selection-rect',
|
|
294
|
+
x: Math.min(start.x, current.x),
|
|
295
|
+
y: Math.min(start.y, current.y),
|
|
296
|
+
width: Math.abs(current.x - start.x),
|
|
297
|
+
height: Math.abs(current.y - start.y),
|
|
298
|
+
fill: 'currentColor',
|
|
299
|
+
'fill-opacity': 0.1,
|
|
300
|
+
stroke: 'currentColor',
|
|
301
|
+
'stroke-opacity': 0.6,
|
|
302
|
+
'stroke-dasharray': '4 2',
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
const slotChildren = slotOrProp(slots.mapSlot, props.mapSlot);
|
|
306
|
+
const surfaceChildren = [];
|
|
307
|
+
if (slotChildren.length > 0) {
|
|
308
|
+
surfaceChildren.push(h('div', { 'data-mol-id': 'map-drawing-slot', style: { position: 'absolute', inset: '0px' } }, slotChildren));
|
|
309
|
+
}
|
|
310
|
+
surfaceChildren.push(h('svg', {
|
|
311
|
+
'data-mol-id': 'map-drawing-overlay',
|
|
312
|
+
width: '100%',
|
|
313
|
+
height: '100%',
|
|
314
|
+
style: overlayStyle,
|
|
315
|
+
preserveAspectRatio: 'none',
|
|
316
|
+
}, overlayChildren));
|
|
317
|
+
return h('div', { 'data-mol-id': 'map-drawing', class: cm.cn(cm.stack(2), props.className) }, [
|
|
318
|
+
h(MapDrawingToolbar, {
|
|
319
|
+
tools: props.tools,
|
|
320
|
+
activeTool: active,
|
|
321
|
+
onActiveToolChange: setActiveTool,
|
|
322
|
+
onDeleteSelected: deleteSelected,
|
|
323
|
+
hasSelection: selection.value.size > 0,
|
|
324
|
+
hasDraft,
|
|
325
|
+
onCancelDraft: clearDrafts,
|
|
326
|
+
}),
|
|
327
|
+
h('div', {
|
|
328
|
+
ref: surfaceEl,
|
|
329
|
+
role: 'img',
|
|
330
|
+
'aria-label': ariaLabel,
|
|
331
|
+
'data-mol-id': 'map-drawing-surface',
|
|
332
|
+
'data-active-tool': active,
|
|
333
|
+
onPointerdown: handlePointerDown,
|
|
334
|
+
onPointermove: handlePointerMove,
|
|
335
|
+
onPointerup: handlePointerUp,
|
|
336
|
+
onDblclick: handleDoubleClick,
|
|
337
|
+
class: cm.cn(cm.surface, cm.borderBPrimary),
|
|
338
|
+
style: surfaceStyle,
|
|
339
|
+
}, surfaceChildren),
|
|
340
|
+
]);
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
/**
|
|
345
|
+
* Compute the anchor (representative) screen-space point for a shape
|
|
346
|
+
* — used by drag-to-select to decide whether a shape lies inside the
|
|
347
|
+
* marquee. Polygons/lines anchor on their first vertex; circles and
|
|
348
|
+
* pins anchor on their center/position.
|
|
349
|
+
*
|
|
350
|
+
* @param shape - Shape to anchor.
|
|
351
|
+
* @param backend - Map backend for projection.
|
|
352
|
+
* @returns Screen-space anchor point or `null` if the geometry is empty.
|
|
353
|
+
*/
|
|
354
|
+
function anchorScreenPoint(shape, backend) {
|
|
355
|
+
const geometry = shape.geometry;
|
|
356
|
+
if (geometry.type === 'Point') {
|
|
357
|
+
return backend.project(geometry.coordinates);
|
|
358
|
+
}
|
|
359
|
+
if (geometry.type === 'LineString') {
|
|
360
|
+
const first = geometry.coordinates[0];
|
|
361
|
+
return first ? backend.project(first) : null;
|
|
362
|
+
}
|
|
363
|
+
const ring = geometry.coordinates[0];
|
|
364
|
+
const first = ring?.[0];
|
|
365
|
+
return first ? backend.project(first) : null;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Build the SVG overlay elements (paths, markers, drafts) for the
|
|
369
|
+
* current shape list.
|
|
370
|
+
*
|
|
371
|
+
* @param shapes - Committed shapes.
|
|
372
|
+
* @param draftPath - Open polygon/line draft, or `null`.
|
|
373
|
+
* @param draftCircle - Open circle drag, or `null`.
|
|
374
|
+
* @param backend - Map backend for projection.
|
|
375
|
+
* @param selection - Shape selection set.
|
|
376
|
+
* @returns The SVG children for the overlay.
|
|
377
|
+
*/
|
|
378
|
+
function buildOverlayElements(shapes, draftPath, draftCircle, backend, selection) {
|
|
379
|
+
const out = [];
|
|
380
|
+
for (const shape of shapes) {
|
|
381
|
+
const selected = selection.has(shape.id);
|
|
382
|
+
const stroke = 'currentColor';
|
|
383
|
+
const opacity = selected ? 1 : 0.7;
|
|
384
|
+
out.push(renderShape(shape, backend, stroke, opacity));
|
|
385
|
+
}
|
|
386
|
+
if (draftPath && draftPath.vertices.length > 0) {
|
|
387
|
+
const points = draftPath.vertices
|
|
388
|
+
.map((coords) => backend.project(coords))
|
|
389
|
+
.map((p) => `${p.x},${p.y}`)
|
|
390
|
+
.join(' ');
|
|
391
|
+
out.push(h('polyline', {
|
|
392
|
+
key: draftPath.kind === 'polygon' ? '__draft_polygon' : '__draft_line',
|
|
393
|
+
'data-mol-id': draftPath.kind === 'polygon' ? 'map-drawing-draft-polygon' : 'map-drawing-draft-line',
|
|
394
|
+
points,
|
|
395
|
+
fill: 'none',
|
|
396
|
+
stroke: 'currentColor',
|
|
397
|
+
'stroke-width': 2,
|
|
398
|
+
'stroke-dasharray': '4 4',
|
|
399
|
+
}));
|
|
400
|
+
for (let i = 0; i < draftPath.vertices.length; i += 1) {
|
|
401
|
+
const screen = backend.project(draftPath.vertices[i]);
|
|
402
|
+
out.push(h('circle', {
|
|
403
|
+
key: `__draft_vertex_${i}`,
|
|
404
|
+
'data-mol-id': 'map-drawing-draft-vertex',
|
|
405
|
+
cx: screen.x,
|
|
406
|
+
cy: screen.y,
|
|
407
|
+
r: 3,
|
|
408
|
+
fill: 'currentColor',
|
|
409
|
+
}));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (draftCircle) {
|
|
413
|
+
const center = backend.project(draftCircle.center);
|
|
414
|
+
const edge = backend.project(draftCircle.pointer);
|
|
415
|
+
const dx = edge.x - center.x;
|
|
416
|
+
const dy = edge.y - center.y;
|
|
417
|
+
const r = Math.sqrt(dx * dx + dy * dy);
|
|
418
|
+
out.push(h('circle', {
|
|
419
|
+
key: '__draft_circle',
|
|
420
|
+
'data-mol-id': 'map-drawing-draft-circle',
|
|
421
|
+
cx: center.x,
|
|
422
|
+
cy: center.y,
|
|
423
|
+
r,
|
|
424
|
+
fill: 'currentColor',
|
|
425
|
+
'fill-opacity': 0.15,
|
|
426
|
+
stroke: 'currentColor',
|
|
427
|
+
'stroke-width': 2,
|
|
428
|
+
'stroke-dasharray': '4 4',
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
return out;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Render a single committed shape as an SVG element.
|
|
435
|
+
*
|
|
436
|
+
* @param shape - Shape to render.
|
|
437
|
+
* @param backend - Map backend for projection.
|
|
438
|
+
* @param stroke - Stroke color.
|
|
439
|
+
* @param opacity - Fill/stroke opacity.
|
|
440
|
+
* @returns An SVG group element, or `null` when the kind and geometry disagree.
|
|
441
|
+
*/
|
|
442
|
+
function renderShape(shape, backend, stroke, opacity) {
|
|
443
|
+
const geometry = shape.geometry;
|
|
444
|
+
if (shape.kind === 'pin' && geometry.type === 'Point') {
|
|
445
|
+
const p = backend.project(geometry.coordinates);
|
|
446
|
+
return h('g', {
|
|
447
|
+
key: shape.id,
|
|
448
|
+
'data-mol-id': 'map-drawing-shape',
|
|
449
|
+
'data-shape-id': shape.id,
|
|
450
|
+
'data-shape-kind': 'pin',
|
|
451
|
+
opacity,
|
|
452
|
+
}, [h('circle', { cx: p.x, cy: p.y, r: 6, fill: stroke })]);
|
|
453
|
+
}
|
|
454
|
+
if (shape.kind === 'circle' && geometry.type === 'Point') {
|
|
455
|
+
const center = backend.project(geometry.coordinates);
|
|
456
|
+
const radiusMeters = typeof shape.properties?.radiusMeters === 'number' ? shape.properties.radiusMeters : 0;
|
|
457
|
+
const eastLng = geometry.coordinates[0] + radiusMetersToDegreesLng(radiusMeters, geometry.coordinates[1]);
|
|
458
|
+
const edge = backend.project([eastLng, geometry.coordinates[1]]);
|
|
459
|
+
const r = Math.abs(edge.x - center.x);
|
|
460
|
+
return h('g', {
|
|
461
|
+
key: shape.id,
|
|
462
|
+
'data-mol-id': 'map-drawing-shape',
|
|
463
|
+
'data-shape-id': shape.id,
|
|
464
|
+
'data-shape-kind': 'circle',
|
|
465
|
+
opacity,
|
|
466
|
+
}, [
|
|
467
|
+
h('circle', {
|
|
468
|
+
cx: center.x,
|
|
469
|
+
cy: center.y,
|
|
470
|
+
r,
|
|
471
|
+
fill: stroke,
|
|
472
|
+
'fill-opacity': 0.15,
|
|
473
|
+
stroke,
|
|
474
|
+
'stroke-width': 2,
|
|
475
|
+
}),
|
|
476
|
+
]);
|
|
477
|
+
}
|
|
478
|
+
if (shape.kind === 'line' && geometry.type === 'LineString') {
|
|
479
|
+
const points = geometry.coordinates
|
|
480
|
+
.map((coords) => backend.project(coords))
|
|
481
|
+
.map((p) => `${p.x},${p.y}`)
|
|
482
|
+
.join(' ');
|
|
483
|
+
return h('g', {
|
|
484
|
+
key: shape.id,
|
|
485
|
+
'data-mol-id': 'map-drawing-shape',
|
|
486
|
+
'data-shape-id': shape.id,
|
|
487
|
+
'data-shape-kind': 'line',
|
|
488
|
+
opacity,
|
|
489
|
+
}, [h('polyline', { points, fill: 'none', stroke, 'stroke-width': 2 })]);
|
|
490
|
+
}
|
|
491
|
+
if (shape.kind === 'polygon' && geometry.type === 'Polygon') {
|
|
492
|
+
const ring = geometry.coordinates[0] ?? [];
|
|
493
|
+
const points = ring
|
|
494
|
+
.map((coords) => backend.project(coords))
|
|
495
|
+
.map((p) => `${p.x},${p.y}`)
|
|
496
|
+
.join(' ');
|
|
497
|
+
return h('g', {
|
|
498
|
+
key: shape.id,
|
|
499
|
+
'data-mol-id': 'map-drawing-shape',
|
|
500
|
+
'data-shape-id': shape.id,
|
|
501
|
+
'data-shape-kind': 'polygon',
|
|
502
|
+
opacity,
|
|
503
|
+
}, [
|
|
504
|
+
h('polygon', {
|
|
505
|
+
points,
|
|
506
|
+
fill: stroke,
|
|
507
|
+
'fill-opacity': 0.15,
|
|
508
|
+
stroke,
|
|
509
|
+
'stroke-width': 2,
|
|
510
|
+
}),
|
|
511
|
+
]);
|
|
512
|
+
}
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Convert a meter radius to a longitude delta at the given latitude.
|
|
517
|
+
* Used only by the circle renderer to size the rendered circle inside
|
|
518
|
+
* the SVG overlay; the canonical geometry stored on the shape uses
|
|
519
|
+
* meters via `properties.radiusMeters`.
|
|
520
|
+
*
|
|
521
|
+
* @param meters - Distance in meters.
|
|
522
|
+
* @param latitudeDegrees - Latitude in degrees (controls the cosine factor).
|
|
523
|
+
* @returns Longitude delta in degrees.
|
|
524
|
+
*/
|
|
525
|
+
function radiusMetersToDegreesLng(meters, latitudeDegrees) {
|
|
526
|
+
if (!Number.isFinite(meters) || meters === 0)
|
|
527
|
+
return 0;
|
|
528
|
+
// 1° of longitude ≈ 111_320 * cos(lat) meters at the WGS84 sphere.
|
|
529
|
+
const cosLat = Math.cos((latitudeDegrees * Math.PI) / 180);
|
|
530
|
+
const denom = 111_320 * (cosLat === 0 ? 1 : cosLat);
|
|
531
|
+
return meters / denom;
|
|
532
|
+
}
|
|
533
|
+
//# sourceMappingURL=MapDrawing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapDrawing.js","sourceRoot":"","sources":["../src/MapDrawing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EAED,GAAG,EAGH,KAAK,GACN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CA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AC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3B,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,OAAO,CAAC,CACN,GAAG,EACH;YACE,GAAG,EAAE,KAAK,CAAC,EAAE;YACb,aAAa,EAAE,mBAAmB;YAClC,eAAe,EAAE,KAAK,CAAC,EAAE;YACzB,iBAAiB,EAAE,SAAS;YAC5B,OAAO;SACR,EACD;YACE,CAAC,CAAC,SAAS,EAAE;gBACX,MAAM;gBACN,IAAI,EAAE,MAAM;gBACZ,cAAc,EAAE,IAAI;gBACpB,MAAM;gBACN,cAAc,EAAE,CAAC;aAClB,CAAC;SACH,CACF,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,wBAAwB,CAAC,MAAc,EAAE,eAAuB;IACvE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAA;IACtD,mEAAmE;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,eAAe,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAA;IAC1D,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACnD,OAAO,MAAM,GAAG,KAAK,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue map-drawing toolbar: one button per drawing tool plus the select,
|
|
3
|
+
* cancel-draft and delete actions.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-map-drawing-react`'s
|
|
6
|
+
* `MapDrawingToolbar` — the same props (React names), the same ClassMap
|
|
7
|
+
* classes, and the same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type PropType, type VNode } from 'vue';
|
|
12
|
+
import type { ActiveTool, DrawingTool } from './types.js';
|
|
13
|
+
/** MapDrawingToolbar component props. */
|
|
14
|
+
export interface MapDrawingToolbarProps {
|
|
15
|
+
/** Drawing tools to expose (in declaration order). */
|
|
16
|
+
tools: DrawingTool[];
|
|
17
|
+
/** Currently active tool. */
|
|
18
|
+
activeTool: ActiveTool;
|
|
19
|
+
/** Called when the user clicks a tool button. */
|
|
20
|
+
onActiveToolChange: (tool: ActiveTool) => void;
|
|
21
|
+
/** Called when the user clicks the delete-selected button. */
|
|
22
|
+
onDeleteSelected: () => void;
|
|
23
|
+
/** Whether anything is currently selected (drives delete-button enabled state). */
|
|
24
|
+
hasSelection: boolean;
|
|
25
|
+
/** Whether a draft (path vertices, circle or marquee) is in progress (drives cancel-button enabled state). */
|
|
26
|
+
hasDraft: boolean;
|
|
27
|
+
/** Called when the user clicks the cancel-draft button. */
|
|
28
|
+
onCancelDraft: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Toolbar with one button per drawing tool plus `select` and `delete`.
|
|
32
|
+
* All button labels route through `t()` so the toolbar translates via the
|
|
33
|
+
* companion `@molecule/app-locales-feature-map-drawing` bond.
|
|
34
|
+
*
|
|
35
|
+
* @param props - Toolbar props (see {@link MapDrawingToolbarProps}).
|
|
36
|
+
* @returns The toolbar component.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MapDrawingToolbar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
39
|
+
/** Drawing tools to expose (in declaration order). */
|
|
40
|
+
tools: {
|
|
41
|
+
type: PropType<DrawingTool[]>;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
/** Currently active tool. */
|
|
45
|
+
activeTool: {
|
|
46
|
+
type: PropType<ActiveTool>;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
/** Called when the user clicks a tool button. */
|
|
50
|
+
onActiveToolChange: {
|
|
51
|
+
type: PropType<MapDrawingToolbarProps["onActiveToolChange"]>;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
/** Called when the user clicks the delete-selected button. */
|
|
55
|
+
onDeleteSelected: {
|
|
56
|
+
type: PropType<MapDrawingToolbarProps["onDeleteSelected"]>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
/** Whether anything is currently selected. */
|
|
60
|
+
hasSelection: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
required: true;
|
|
63
|
+
};
|
|
64
|
+
/** Whether a draft is in progress. */
|
|
65
|
+
hasDraft: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
/** Called when the user clicks the cancel-draft button. */
|
|
70
|
+
onCancelDraft: {
|
|
71
|
+
type: PropType<MapDrawingToolbarProps["onCancelDraft"]>;
|
|
72
|
+
required: true;
|
|
73
|
+
};
|
|
74
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
75
|
+
/** Drawing tools to expose (in declaration order). */
|
|
76
|
+
tools: {
|
|
77
|
+
type: PropType<DrawingTool[]>;
|
|
78
|
+
required: true;
|
|
79
|
+
};
|
|
80
|
+
/** Currently active tool. */
|
|
81
|
+
activeTool: {
|
|
82
|
+
type: PropType<ActiveTool>;
|
|
83
|
+
required: true;
|
|
84
|
+
};
|
|
85
|
+
/** Called when the user clicks a tool button. */
|
|
86
|
+
onActiveToolChange: {
|
|
87
|
+
type: PropType<MapDrawingToolbarProps["onActiveToolChange"]>;
|
|
88
|
+
required: true;
|
|
89
|
+
};
|
|
90
|
+
/** Called when the user clicks the delete-selected button. */
|
|
91
|
+
onDeleteSelected: {
|
|
92
|
+
type: PropType<MapDrawingToolbarProps["onDeleteSelected"]>;
|
|
93
|
+
required: true;
|
|
94
|
+
};
|
|
95
|
+
/** Whether anything is currently selected. */
|
|
96
|
+
hasSelection: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
required: true;
|
|
99
|
+
};
|
|
100
|
+
/** Whether a draft is in progress. */
|
|
101
|
+
hasDraft: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
required: true;
|
|
104
|
+
};
|
|
105
|
+
/** Called when the user clicks the cancel-draft button. */
|
|
106
|
+
onCancelDraft: {
|
|
107
|
+
type: PropType<MapDrawingToolbarProps["onCancelDraft"]>;
|
|
108
|
+
required: true;
|
|
109
|
+
};
|
|
110
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
111
|
+
//# sourceMappingURL=MapDrawingToolbar.d.ts.map
|