@vaadin/bundles 25.3.0-alpha13 → 25.3.0-alpha14

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.
Files changed (105) hide show
  1. package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js +6 -6
  2. package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js.map +1 -1
  3. package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js +10 -1
  4. package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js.map +1 -1
  5. package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js +5 -0
  6. package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js.map +1 -1
  7. package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js +9 -8
  8. package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js.map +1 -1
  9. package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js +1 -1
  10. package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js.map +1 -1
  11. package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js +172 -0
  12. package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js.map +1 -0
  13. package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js +58 -0
  14. package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js.map +1 -0
  15. package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js → node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js} +244 -5
  16. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js.map +1 -0
  17. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js +383 -0
  18. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js.map +1 -0
  19. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js +243 -0
  20. package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js.map +1 -0
  21. package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js +18 -5
  22. package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js.map +1 -1
  23. package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js +8 -8
  24. package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js.map +1 -1
  25. package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js → node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js} +2 -2
  26. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map +1 -0
  27. package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js +17 -7
  28. package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -1
  29. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js +18 -15
  30. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map +1 -1
  31. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js +18 -15
  32. package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map +1 -1
  33. package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js +21 -1
  34. package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js.map +1 -1
  35. package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js +34 -3
  36. package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js.map +1 -1
  37. package/package.json +135 -135
  38. package/vaadin-bundle.json +1824 -1812
  39. package/vaadin.js +2725 -1726
  40. package/vaadin.js.map +1 -1
  41. package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js +30 -16
  42. package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js.map +1 -1
  43. package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js +6 -6
  44. package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js.map +1 -1
  45. package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js +7 -7
  46. package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js.map +1 -1
  47. package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js +1 -1
  48. package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js.map +1 -1
  49. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js +6 -6
  50. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js.map +1 -1
  51. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js +1 -1
  52. package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js.map +1 -1
  53. package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js +34 -25
  54. package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js.map +1 -1
  55. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js +146 -943
  56. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js.map +1 -1
  57. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js +111 -34
  58. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js.map +1 -1
  59. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js +3 -3
  60. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js.map +1 -1
  61. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js +1055 -219
  62. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js.map +1 -1
  63. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js +129 -57
  64. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js.map +1 -1
  65. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js +74 -80
  66. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js.map +1 -1
  67. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js +11 -11
  68. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js.map +1 -1
  69. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js +54 -54
  70. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js.map +1 -1
  71. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js +801 -0
  72. package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js.map +1 -0
  73. package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js +36 -20
  74. package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js.map +1 -1
  75. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js +17 -279
  76. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -1
  77. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js +16 -7
  78. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js.map +1 -1
  79. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js +53 -17
  80. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -1
  81. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js +336 -38
  82. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js.map +1 -1
  83. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js +75 -42
  84. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js.map +1 -1
  85. package/{node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js → vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js} +77 -11
  86. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
  87. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js +210 -16
  88. package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -1
  89. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js +88 -32
  90. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js.map +1 -1
  91. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js +62 -22
  92. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -1
  93. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js +2 -2
  94. package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js.map +1 -1
  95. package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js +135 -81
  96. package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js.map +1 -1
  97. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js.map +0 -1
  98. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js +0 -144
  99. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js.map +0 -1
  100. package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js.map +0 -1
  101. package/node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +0 -1
  102. package/node_modules_vaadin_map_node_modules_ol_style_js.js +0 -48
  103. package/node_modules_vaadin_map_node_modules_ol_style_js.js.map +0 -1
  104. package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js +0 -769
  105. package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js.map +0 -1
@@ -294,371 +294,6 @@ Circle.prototype.transform;
294
294
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Circle);
295
295
 
296
296
 
297
- /***/ }),
298
-
299
- /***/ "./node_modules/@vaadin/map/node_modules/ol/geom/GeometryCollection.js":
300
- /*!*****************************************************************************!*\
301
- !*** ./node_modules/@vaadin/map/node_modules/ol/geom/GeometryCollection.js ***!
302
- \*****************************************************************************/
303
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
304
-
305
- __webpack_require__.r(__webpack_exports__);
306
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
307
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
308
- /* harmony export */ });
309
- /* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/@vaadin/map/node_modules/ol/events/EventType.js");
310
- /* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events.js */ "./node_modules/@vaadin/map/node_modules/ol/events.js");
311
- /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../extent.js */ "./node_modules/@vaadin/map/node_modules/ol/extent.js");
312
- /* harmony import */ var _Geometry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Geometry.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Geometry.js");
313
- /**
314
- * @module ol/geom/GeometryCollection
315
- */
316
-
317
-
318
-
319
-
320
-
321
- /**
322
- * @classdesc
323
- * An array of {@link module:ol/geom/Geometry~Geometry} objects.
324
- *
325
- * @api
326
- */
327
- class GeometryCollection extends _Geometry_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
328
- /**
329
- * @param {Array<Geometry>} geometries Geometries.
330
- */
331
- constructor(geometries) {
332
- super();
333
-
334
- /**
335
- * @private
336
- * @type {Array<Geometry>}
337
- */
338
- this.geometries_ = geometries;
339
-
340
- /**
341
- * @private
342
- * @type {Array<import("../events.js").EventsKey>}
343
- */
344
- this.changeEventsKeys_ = [];
345
-
346
- this.listenGeometriesChange_();
347
- }
348
-
349
- /**
350
- * @private
351
- */
352
- unlistenGeometriesChange_() {
353
- this.changeEventsKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_1__.unlistenByKey);
354
- this.changeEventsKeys_.length = 0;
355
- }
356
-
357
- /**
358
- * @private
359
- */
360
- listenGeometriesChange_() {
361
- const geometries = this.geometries_;
362
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
363
- this.changeEventsKeys_.push(
364
- (0,_events_js__WEBPACK_IMPORTED_MODULE_1__.listen)(geometries[i], _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE, this.changed, this),
365
- );
366
- }
367
- }
368
-
369
- /**
370
- * Make a complete copy of the geometry.
371
- * @return {!GeometryCollection} Clone.
372
- * @api
373
- * @override
374
- */
375
- clone() {
376
- const geometryCollection = new GeometryCollection(
377
- cloneGeometries(this.geometries_),
378
- );
379
- geometryCollection.applyProperties(this);
380
- return geometryCollection;
381
- }
382
-
383
- /**
384
- * @param {number} x X.
385
- * @param {number} y Y.
386
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
387
- * @param {number} minSquaredDistance Minimum squared distance.
388
- * @return {number} Minimum squared distance.
389
- * @override
390
- */
391
- closestPointXY(x, y, closestPoint, minSquaredDistance) {
392
- if (minSquaredDistance < (0,_extent_js__WEBPACK_IMPORTED_MODULE_3__.closestSquaredDistanceXY)(this.getExtent(), x, y)) {
393
- return minSquaredDistance;
394
- }
395
- const geometries = this.geometries_;
396
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
397
- minSquaredDistance = geometries[i].closestPointXY(
398
- x,
399
- y,
400
- closestPoint,
401
- minSquaredDistance,
402
- );
403
- }
404
- return minSquaredDistance;
405
- }
406
-
407
- /**
408
- * @param {number} x X.
409
- * @param {number} y Y.
410
- * @return {boolean} Contains (x, y).
411
- * @override
412
- */
413
- containsXY(x, y) {
414
- const geometries = this.geometries_;
415
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
416
- if (geometries[i].containsXY(x, y)) {
417
- return true;
418
- }
419
- }
420
- return false;
421
- }
422
-
423
- /**
424
- * @param {import("../extent.js").Extent} extent Extent.
425
- * @protected
426
- * @return {import("../extent.js").Extent} extent Extent.
427
- * @override
428
- */
429
- computeExtent(extent) {
430
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_3__.createOrUpdateEmpty)(extent);
431
- const geometries = this.geometries_;
432
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
433
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_3__.extend)(extent, geometries[i].getExtent());
434
- }
435
- return extent;
436
- }
437
-
438
- /**
439
- * Return the geometries that make up this geometry collection.
440
- * @return {Array<Geometry>} Geometries.
441
- * @api
442
- */
443
- getGeometries() {
444
- return cloneGeometries(this.geometries_);
445
- }
446
-
447
- /**
448
- * @return {Array<Geometry>} Geometries.
449
- */
450
- getGeometriesArray() {
451
- return this.geometries_;
452
- }
453
-
454
- /**
455
- * @return {Array<Geometry>} Geometries.
456
- */
457
- getGeometriesArrayRecursive() {
458
- /** @type {Array<Geometry>} */
459
- let geometriesArray = [];
460
- const geometries = this.geometries_;
461
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
462
- if (geometries[i].getType() === this.getType()) {
463
- geometriesArray = geometriesArray.concat(
464
- /** @type {GeometryCollection} */ (
465
- geometries[i]
466
- ).getGeometriesArrayRecursive(),
467
- );
468
- } else {
469
- geometriesArray.push(geometries[i]);
470
- }
471
- }
472
- return geometriesArray;
473
- }
474
-
475
- /**
476
- * Create a simplified version of this geometry using the Douglas Peucker algorithm.
477
- * @param {number} squaredTolerance Squared tolerance.
478
- * @return {GeometryCollection} Simplified GeometryCollection.
479
- * @override
480
- */
481
- getSimplifiedGeometry(squaredTolerance) {
482
- if (this.simplifiedGeometryRevision !== this.getRevision()) {
483
- this.simplifiedGeometryMaxMinSquaredTolerance = 0;
484
- this.simplifiedGeometryRevision = this.getRevision();
485
- }
486
- if (
487
- squaredTolerance < 0 ||
488
- (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&
489
- squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)
490
- ) {
491
- return this;
492
- }
493
-
494
- const simplifiedGeometries = [];
495
- const geometries = this.geometries_;
496
- let simplified = false;
497
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
498
- const geometry = geometries[i];
499
- const simplifiedGeometry =
500
- geometry.getSimplifiedGeometry(squaredTolerance);
501
- simplifiedGeometries.push(simplifiedGeometry);
502
- if (simplifiedGeometry !== geometry) {
503
- simplified = true;
504
- }
505
- }
506
- if (simplified) {
507
- const simplifiedGeometryCollection = new GeometryCollection(
508
- simplifiedGeometries,
509
- );
510
- return simplifiedGeometryCollection;
511
- }
512
- this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;
513
- return this;
514
- }
515
-
516
- /**
517
- * Get the type of this geometry.
518
- * @return {import("./Geometry.js").Type} Geometry type.
519
- * @api
520
- * @override
521
- */
522
- getType() {
523
- return 'GeometryCollection';
524
- }
525
-
526
- /**
527
- * Test if the geometry and the passed extent intersect.
528
- * @param {import("../extent.js").Extent} extent Extent.
529
- * @return {boolean} `true` if the geometry and the extent intersect.
530
- * @api
531
- * @override
532
- */
533
- intersectsExtent(extent) {
534
- const geometries = this.geometries_;
535
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
536
- if (geometries[i].intersectsExtent(extent)) {
537
- return true;
538
- }
539
- }
540
- return false;
541
- }
542
-
543
- /**
544
- * @return {boolean} Is empty.
545
- */
546
- isEmpty() {
547
- return this.geometries_.length === 0;
548
- }
549
-
550
- /**
551
- * Rotate the geometry around a given coordinate. This modifies the geometry
552
- * coordinates in place.
553
- * @param {number} angle Rotation angle in radians.
554
- * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
555
- * @api
556
- * @override
557
- */
558
- rotate(angle, anchor) {
559
- const geometries = this.geometries_;
560
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
561
- geometries[i].rotate(angle, anchor);
562
- }
563
- this.changed();
564
- }
565
-
566
- /**
567
- * Scale the geometry (with an optional origin). This modifies the geometry
568
- * coordinates in place.
569
- * @abstract
570
- * @param {number} sx The scaling factor in the x-direction.
571
- * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
572
- * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
573
- * of the geometry extent).
574
- * @api
575
- * @override
576
- */
577
- scale(sx, sy, anchor) {
578
- if (!anchor) {
579
- anchor = (0,_extent_js__WEBPACK_IMPORTED_MODULE_3__.getCenter)(this.getExtent());
580
- }
581
- const geometries = this.geometries_;
582
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
583
- geometries[i].scale(sx, sy, anchor);
584
- }
585
- this.changed();
586
- }
587
-
588
- /**
589
- * Set the geometries that make up this geometry collection.
590
- * @param {Array<Geometry>} geometries Geometries.
591
- * @api
592
- */
593
- setGeometries(geometries) {
594
- this.setGeometriesArray(cloneGeometries(geometries));
595
- }
596
-
597
- /**
598
- * @param {Array<Geometry>} geometries Geometries.
599
- */
600
- setGeometriesArray(geometries) {
601
- this.unlistenGeometriesChange_();
602
- this.geometries_ = geometries;
603
- this.listenGeometriesChange_();
604
- this.changed();
605
- }
606
-
607
- /**
608
- * Apply a transform function to the coordinates of the geometry.
609
- * The geometry is modified in place.
610
- * If you do not want the geometry modified in place, first `clone()` it and
611
- * then use this function on the clone.
612
- * @param {import("../proj.js").TransformFunction} transformFn Transform function.
613
- * Called with a flat array of geometry coordinates.
614
- * @api
615
- * @override
616
- */
617
- applyTransform(transformFn) {
618
- const geometries = this.geometries_;
619
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
620
- geometries[i].applyTransform(transformFn);
621
- }
622
- this.changed();
623
- }
624
-
625
- /**
626
- * Translate the geometry. This modifies the geometry coordinates in place. If
627
- * instead you want a new geometry, first `clone()` this geometry.
628
- * @param {number} deltaX Delta X.
629
- * @param {number} deltaY Delta Y.
630
- * @api
631
- * @override
632
- */
633
- translate(deltaX, deltaY) {
634
- const geometries = this.geometries_;
635
- for (let i = 0, ii = geometries.length; i < ii; ++i) {
636
- geometries[i].translate(deltaX, deltaY);
637
- }
638
- this.changed();
639
- }
640
-
641
- /**
642
- * Clean up.
643
- * @override
644
- */
645
- disposeInternal() {
646
- this.unlistenGeometriesChange_();
647
- super.disposeInternal();
648
- }
649
- }
650
-
651
- /**
652
- * @param {Array<Geometry>} geometries Geometries.
653
- * @return {Array<Geometry>} Cloned geometries.
654
- */
655
- function cloneGeometries(geometries) {
656
- return geometries.map((geometry) => geometry.clone());
657
- }
658
-
659
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GeometryCollection);
660
-
661
-
662
297
  /***/ }),
663
298
 
664
299
  /***/ "./node_modules/@vaadin/map/node_modules/ol/interaction/Draw.js":
@@ -674,31 +309,30 @@ __webpack_require__.r(__webpack_exports__);
674
309
  /* harmony export */ "createRegularPolygon": () => (/* binding */ createRegularPolygon),
675
310
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
676
311
  /* harmony export */ });
677
- /* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/@vaadin/map/node_modules/ol/Feature.js");
678
- /* harmony import */ var _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../MapBrowserEvent.js */ "./node_modules/@vaadin/map/node_modules/ol/MapBrowserEvent.js");
679
- /* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/MapBrowserEventType.js");
680
- /* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/@vaadin/map/node_modules/ol/coordinate.js");
312
+ /* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/@vaadin/map/node_modules/ol/Feature.js");
313
+ /* harmony import */ var _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../MapBrowserEvent.js */ "./node_modules/@vaadin/map/node_modules/ol/MapBrowserEvent.js");
314
+ /* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/@vaadin/map/node_modules/ol/MapBrowserEventType.js");
315
+ /* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/@vaadin/map/node_modules/ol/coordinate.js");
681
316
  /* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/@vaadin/map/node_modules/ol/events/Event.js");
682
- /* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/@vaadin/map/node_modules/ol/events/EventType.js");
683
- /* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/@vaadin/map/node_modules/ol/events/condition.js");
684
- /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../extent.js */ "./node_modules/@vaadin/map/node_modules/ol/extent.js");
685
- /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../functions.js */ "./node_modules/@vaadin/map/node_modules/ol/functions.js");
686
- /* harmony import */ var _geom_Circle_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/Circle.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Circle.js");
687
- /* harmony import */ var _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/GeometryCollection.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/GeometryCollection.js");
688
- /* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/LineString.js");
689
- /* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiLineString.js");
690
- /* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiPoint.js");
691
- /* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiPolygon.js");
692
- /* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Point.js");
693
- /* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Polygon.js");
694
- /* harmony import */ var _geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../geom/SimpleGeometry.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/SimpleGeometry.js");
695
- /* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js");
696
- /* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math.js */ "./node_modules/@vaadin/map/node_modules/ol/math.js");
317
+ /* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/@vaadin/map/node_modules/ol/events/EventType.js");
318
+ /* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/@vaadin/map/node_modules/ol/events/condition.js");
319
+ /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../extent.js */ "./node_modules/@vaadin/map/node_modules/ol/extent.js");
320
+ /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/@vaadin/map/node_modules/ol/functions.js");
321
+ /* harmony import */ var _geom_Circle_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/Circle.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Circle.js");
322
+ /* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/LineString.js");
323
+ /* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiLineString.js");
324
+ /* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiPoint.js");
325
+ /* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/MultiPolygon.js");
326
+ /* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Point.js");
327
+ /* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/Polygon.js");
328
+ /* harmony import */ var _geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../geom/SimpleGeometry.js */ "./node_modules/@vaadin/map/node_modules/ol/geom/SimpleGeometry.js");
329
+ /* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js");
697
330
  /* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/@vaadin/map/node_modules/ol/proj.js");
698
- /* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/source/Vector.js");
699
- /* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/@vaadin/map/node_modules/ol/style/Style.js");
700
- /* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Pointer.js");
701
- /* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Property.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Property.js");
331
+ /* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/@vaadin/map/node_modules/ol/source/Vector.js");
332
+ /* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/@vaadin/map/node_modules/ol/style/Style.js");
333
+ /* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Pointer.js");
334
+ /* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Property.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/Property.js");
335
+ /* harmony import */ var _tracing_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./tracing.js */ "./node_modules/@vaadin/map/node_modules/ol/interaction/tracing.js");
702
336
  /**
703
337
  * @module ol/interaction/Draw
704
338
  */
@@ -725,7 +359,6 @@ __webpack_require__.r(__webpack_exports__);
725
359
 
726
360
 
727
361
 
728
-
729
362
 
730
363
 
731
364
  /**
@@ -802,8 +435,7 @@ __webpack_require__.r(__webpack_exports__);
802
435
  */
803
436
 
804
437
  /**
805
- * Coordinate type when drawing lines.
806
- * @typedef {Array<import("../coordinate.js").Coordinate>} LineCoordType
438
+ * @typedef {import('./tracing.js').LineCoordType} LineCoordType
807
439
  */
808
440
 
809
441
  /**
@@ -816,23 +448,9 @@ __webpack_require__.r(__webpack_exports__);
816
448
  * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType
817
449
  */
818
450
 
819
- /**
820
- * @typedef {Object} TraceState
821
- * @property {boolean} active Tracing active.
822
- * @property {import("../pixel.js").Pixel} [startPx] The initially clicked pixel location.
823
- * @property {Array<TraceTarget>} [targets] Targets available for tracing.
824
- * @property {number} [targetIndex] The index of the currently traced target. A value of -1 indicates
825
- * that no trace target is active.
826
- */
451
+ /** @typedef {import('./tracing.js').TraceState} TraceState */
827
452
 
828
- /**
829
- * @typedef {Object} TraceTarget
830
- * @property {Array<import("../coordinate.js").Coordinate>} coordinates Target coordinates.
831
- * @property {boolean} ring The target coordinates are a linear ring.
832
- * @property {number} startIndex The index of first traced coordinate. A fractional index represents an
833
- * edge intersection. Index values for rings will wrap (may be negative or larger than coordinates length).
834
- * @property {number} endIndex The index of last traced coordinate. Details from startIndex also apply here.
835
- */
453
+ /** @typedef {import('./tracing.js').TraceTarget} TraceTarget */
836
454
 
837
455
  /**
838
456
  * Function that takes an array of coordinates and an optional existing geometry
@@ -896,378 +514,13 @@ class DrawEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default"]
896
514
  }
897
515
  }
898
516
 
899
- /**
900
- * @param {import("../coordinate.js").Coordinate} coordinate The coordinate.
901
- * @param {Array<Feature>} features The candidate features.
902
- * @return {Array<TraceTarget>} The trace targets.
903
- */
904
- function getTraceTargets(coordinate, features) {
905
- /**
906
- * @type {Array<TraceTarget>}
907
- */
908
- const targets = [];
909
-
910
- for (let i = 0; i < features.length; ++i) {
911
- const feature = features[i];
912
- const geometry = feature.getGeometry();
913
- appendGeometryTraceTargets(coordinate, geometry, targets);
914
- }
915
-
916
- return targets;
917
- }
918
-
919
- /**
920
- * @param {import("../coordinate.js").Coordinate} a One coordinate.
921
- * @param {import("../coordinate.js").Coordinate} b Another coordinate.
922
- * @return {number} The squared distance between the two coordinates.
923
- */
924
- function getSquaredDistance(a, b) {
925
- return (0,_math_js__WEBPACK_IMPORTED_MODULE_2__.squaredDistance)(a[0], a[1], b[0], b[1]);
926
- }
927
-
928
- /**
929
- * @param {LineCoordType} coordinates The ring coordinates.
930
- * @param {number} index The index. May be wrapped.
931
- * @return {import("../coordinate.js").Coordinate} The coordinate.
932
- */
933
- function getCoordinate(coordinates, index) {
934
- const count = coordinates.length;
935
- if (index < 0) {
936
- return coordinates[index + count];
937
- }
938
- if (index >= count) {
939
- return coordinates[index - count];
940
- }
941
- return coordinates[index];
942
- }
943
-
944
- /**
945
- * Get the cumulative squared distance along a ring path. The end index index may be "wrapped" and it may
946
- * be less than the start index to indicate the direction of travel. The start and end index may have
947
- * a fractional part to indicate a point between two coordinates.
948
- * @param {LineCoordType} coordinates Ring coordinates.
949
- * @param {number} startIndex The start index.
950
- * @param {number} endIndex The end index.
951
- * @return {number} The cumulative squared distance along the ring path.
952
- */
953
- function getCumulativeSquaredDistance(coordinates, startIndex, endIndex) {
954
- let lowIndex, highIndex;
955
- if (startIndex < endIndex) {
956
- lowIndex = startIndex;
957
- highIndex = endIndex;
958
- } else {
959
- lowIndex = endIndex;
960
- highIndex = startIndex;
961
- }
962
- const lowWholeIndex = Math.ceil(lowIndex);
963
- const highWholeIndex = Math.floor(highIndex);
964
-
965
- if (lowWholeIndex > highWholeIndex) {
966
- // both start and end are on the same segment
967
- const start = interpolateCoordinate(coordinates, lowIndex);
968
- const end = interpolateCoordinate(coordinates, highIndex);
969
- return getSquaredDistance(start, end);
970
- }
971
-
972
- let sd = 0;
973
-
974
- if (lowIndex < lowWholeIndex) {
975
- const start = interpolateCoordinate(coordinates, lowIndex);
976
- const end = getCoordinate(coordinates, lowWholeIndex);
977
- sd += getSquaredDistance(start, end);
978
- }
979
-
980
- if (highWholeIndex < highIndex) {
981
- const start = getCoordinate(coordinates, highWholeIndex);
982
- const end = interpolateCoordinate(coordinates, highIndex);
983
- sd += getSquaredDistance(start, end);
984
- }
985
-
986
- for (let i = lowWholeIndex; i < highWholeIndex - 1; ++i) {
987
- const start = getCoordinate(coordinates, i);
988
- const end = getCoordinate(coordinates, i + 1);
989
- sd += getSquaredDistance(start, end);
990
- }
991
-
992
- return sd;
993
- }
994
-
995
- /**
996
- * @param {import("../coordinate.js").Coordinate} coordinate The coordinate.
997
- * @param {import("../geom/Geometry.js").default} geometry The candidate geometry.
998
- * @param {Array<TraceTarget>} targets The trace targets.
999
- */
1000
- function appendGeometryTraceTargets(coordinate, geometry, targets) {
1001
- if (geometry instanceof _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"]) {
1002
- appendTraceTarget(coordinate, geometry.getCoordinates(), false, targets);
1003
- return;
1004
- }
1005
- if (geometry instanceof _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__["default"]) {
1006
- const coordinates = geometry.getCoordinates();
1007
- for (let i = 0, ii = coordinates.length; i < ii; ++i) {
1008
- appendTraceTarget(coordinate, coordinates[i], false, targets);
1009
- }
1010
- return;
1011
- }
1012
- if (geometry instanceof _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__["default"]) {
1013
- const coordinates = geometry.getCoordinates();
1014
- for (let i = 0, ii = coordinates.length; i < ii; ++i) {
1015
- appendTraceTarget(coordinate, coordinates[i], true, targets);
1016
- }
1017
- return;
1018
- }
1019
- if (geometry instanceof _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__["default"]) {
1020
- const polys = geometry.getCoordinates();
1021
- for (let i = 0, ii = polys.length; i < ii; ++i) {
1022
- const coordinates = polys[i];
1023
- for (let j = 0, jj = coordinates.length; j < jj; ++j) {
1024
- appendTraceTarget(coordinate, coordinates[j], true, targets);
1025
- }
1026
- }
1027
- return;
1028
- }
1029
- if (geometry instanceof _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"]) {
1030
- const geometries = geometry.getGeometries();
1031
- for (let i = 0; i < geometries.length; ++i) {
1032
- appendGeometryTraceTargets(coordinate, geometries[i], targets);
1033
- }
1034
- return;
1035
- }
1036
- // other types cannot be traced
1037
- }
1038
-
1039
- /**
1040
- * @typedef {Object} TraceTargetUpdateInfo
1041
- * @property {number} index The new target index.
1042
- * @property {number} endIndex The new segment end index.
1043
- */
1044
-
1045
- /**
1046
- * @type {TraceTargetUpdateInfo}
1047
- */
1048
- const sharedUpdateInfo = {index: -1, endIndex: NaN};
1049
-
1050
- /**
1051
- * @param {import("../coordinate.js").Coordinate} coordinate The coordinate.
1052
- * @param {TraceState} traceState The trace state.
1053
- * @param {import("../Map.js").default} map The map.
1054
- * @param {number} snapTolerance The snap tolerance.
1055
- * @return {TraceTargetUpdateInfo} Information about the new trace target. The returned
1056
- * object is reused between calls and must not be modified by the caller.
1057
- */
1058
- function getTraceTargetUpdate(coordinate, traceState, map, snapTolerance) {
1059
- const x = coordinate[0];
1060
- const y = coordinate[1];
1061
-
1062
- let closestTargetDistance = Infinity;
1063
-
1064
- let newTargetIndex = -1;
1065
- let newEndIndex = NaN;
1066
-
1067
- for (
1068
- let targetIndex = 0;
1069
- targetIndex < traceState.targets.length;
1070
- ++targetIndex
1071
- ) {
1072
- const target = traceState.targets[targetIndex];
1073
- const coordinates = target.coordinates;
1074
-
1075
- let minSegmentDistance = Infinity;
1076
- let endIndex;
1077
- for (
1078
- let coordinateIndex = 0;
1079
- coordinateIndex < coordinates.length - 1;
1080
- ++coordinateIndex
1081
- ) {
1082
- const start = coordinates[coordinateIndex];
1083
- const end = coordinates[coordinateIndex + 1];
1084
- const rel = getPointSegmentRelationship(x, y, start, end);
1085
- if (rel.squaredDistance < minSegmentDistance) {
1086
- minSegmentDistance = rel.squaredDistance;
1087
- endIndex = coordinateIndex + rel.along;
1088
- }
1089
- }
1090
-
1091
- if (minSegmentDistance < closestTargetDistance) {
1092
- closestTargetDistance = minSegmentDistance;
1093
- if (target.ring && traceState.targetIndex === targetIndex) {
1094
- // same target, maintain the same trace direction
1095
- if (target.endIndex > target.startIndex) {
1096
- // forward trace
1097
- if (endIndex < target.startIndex) {
1098
- endIndex += coordinates.length;
1099
- }
1100
- } else if (target.endIndex < target.startIndex) {
1101
- // reverse trace
1102
- if (endIndex > target.startIndex) {
1103
- endIndex -= coordinates.length;
1104
- }
1105
- }
1106
- }
1107
- newEndIndex = endIndex;
1108
- newTargetIndex = targetIndex;
1109
- }
1110
- }
1111
-
1112
- const newTarget = traceState.targets[newTargetIndex];
1113
- let considerBothDirections = newTarget.ring;
1114
- if (traceState.targetIndex === newTargetIndex && considerBothDirections) {
1115
- // only consider switching trace direction if close to the start
1116
- const newCoordinate = interpolateCoordinate(
1117
- newTarget.coordinates,
1118
- newEndIndex,
1119
- );
1120
- const pixel = map.getPixelFromCoordinate(newCoordinate);
1121
- if ((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_8__.distance)(pixel, traceState.startPx) > snapTolerance) {
1122
- considerBothDirections = false;
1123
- }
1124
- }
1125
-
1126
- if (considerBothDirections) {
1127
- const coordinates = newTarget.coordinates;
1128
- const count = coordinates.length;
1129
- const startIndex = newTarget.startIndex;
1130
- const endIndex = newEndIndex;
1131
- if (startIndex < endIndex) {
1132
- const forwardDistance = getCumulativeSquaredDistance(
1133
- coordinates,
1134
- startIndex,
1135
- endIndex,
1136
- );
1137
- const reverseDistance = getCumulativeSquaredDistance(
1138
- coordinates,
1139
- startIndex,
1140
- endIndex - count,
1141
- );
1142
- if (reverseDistance < forwardDistance) {
1143
- newEndIndex -= count;
1144
- }
1145
- } else {
1146
- const reverseDistance = getCumulativeSquaredDistance(
1147
- coordinates,
1148
- startIndex,
1149
- endIndex,
1150
- );
1151
- const forwardDistance = getCumulativeSquaredDistance(
1152
- coordinates,
1153
- startIndex,
1154
- endIndex + count,
1155
- );
1156
- if (forwardDistance < reverseDistance) {
1157
- newEndIndex += count;
1158
- }
1159
- }
1160
- }
1161
-
1162
- sharedUpdateInfo.index = newTargetIndex;
1163
- sharedUpdateInfo.endIndex = newEndIndex;
1164
- return sharedUpdateInfo;
1165
- }
1166
-
1167
- /**
1168
- * @param {import("../coordinate.js").Coordinate} coordinate The clicked coordinate.
1169
- * @param {Array<import("../coordinate.js").Coordinate>} coordinates The geometry component coordinates.
1170
- * @param {boolean} ring The coordinates represent a linear ring.
1171
- * @param {Array<TraceTarget>} targets The trace targets.
1172
- */
1173
- function appendTraceTarget(coordinate, coordinates, ring, targets) {
1174
- const x = coordinate[0];
1175
- const y = coordinate[1];
1176
- for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
1177
- const start = coordinates[i];
1178
- const end = coordinates[i + 1];
1179
- const rel = getPointSegmentRelationship(x, y, start, end);
1180
- if (rel.squaredDistance === 0) {
1181
- const index = i + rel.along;
1182
- targets.push({
1183
- coordinates: coordinates,
1184
- ring: ring,
1185
- startIndex: index,
1186
- endIndex: index,
1187
- });
1188
- return;
1189
- }
1190
- }
1191
- }
1192
-
1193
- /**
1194
- * @typedef {Object} PointSegmentRelationship
1195
- * @property {number} along The closest point expressed as a fraction along the segment length.
1196
- * @property {number} squaredDistance The squared distance of the point to the segment.
1197
- */
1198
-
1199
- /**
1200
- * @type {PointSegmentRelationship}
1201
- */
1202
- const sharedRel = {along: 0, squaredDistance: 0};
1203
-
1204
- /**
1205
- * @param {number} x The point x.
1206
- * @param {number} y The point y.
1207
- * @param {import("../coordinate.js").Coordinate} start The segment start.
1208
- * @param {import("../coordinate.js").Coordinate} end The segment end.
1209
- * @return {PointSegmentRelationship} The point segment relationship. The returned object is
1210
- * shared between calls and must not be modified by the caller.
1211
- */
1212
- function getPointSegmentRelationship(x, y, start, end) {
1213
- const x1 = start[0];
1214
- const y1 = start[1];
1215
- const x2 = end[0];
1216
- const y2 = end[1];
1217
- const dx = x2 - x1;
1218
- const dy = y2 - y1;
1219
- let along = 0;
1220
- let px = x1;
1221
- let py = y1;
1222
- if (dx !== 0 || dy !== 0) {
1223
- along = (0,_math_js__WEBPACK_IMPORTED_MODULE_2__.clamp)(((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy), 0, 1);
1224
- px += dx * along;
1225
- py += dy * along;
1226
- }
1227
-
1228
- sharedRel.along = along;
1229
- sharedRel.squaredDistance = (0,_math_js__WEBPACK_IMPORTED_MODULE_2__.toFixed)((0,_math_js__WEBPACK_IMPORTED_MODULE_2__.squaredDistance)(x, y, px, py), 10);
1230
- return sharedRel;
1231
- }
1232
-
1233
- /**
1234
- * @param {LineCoordType} coordinates The coordinates.
1235
- * @param {number} index The index. May be fractional and may wrap.
1236
- * @return {import("../coordinate.js").Coordinate} The interpolated coordinate.
1237
- */
1238
- function interpolateCoordinate(coordinates, index) {
1239
- const count = coordinates.length;
1240
-
1241
- let startIndex = Math.floor(index);
1242
- const along = index - startIndex;
1243
- if (startIndex >= count) {
1244
- startIndex -= count;
1245
- } else if (startIndex < 0) {
1246
- startIndex += count;
1247
- }
1248
-
1249
- let endIndex = startIndex + 1;
1250
- if (endIndex >= count) {
1251
- endIndex -= count;
1252
- }
1253
-
1254
- const start = coordinates[startIndex];
1255
- const x0 = start[0];
1256
- const y0 = start[1];
1257
- const end = coordinates[endIndex];
1258
- const dx = end[0] - x0;
1259
- const dy = end[1] - y0;
1260
-
1261
- return [x0 + dx * along, y0 + dy * along];
1262
- }
1263
-
1264
517
  /***
1265
518
  * @template Return
1266
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
1267
- * import("../Observable").OnSignature<import("../ObjectEventType").Types|
1268
- * 'change:active', import("../Object").ObjectEvent, Return> &
1269
- * import("../Observable").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &
1270
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
519
+ * @typedef {import("../Observable.js").OnSignature<import("../Observable.js").EventTypes, import("../events/Event.js").default, Return> &
520
+ * import("../Observable.js").OnSignature<import("../ObjectEventType.js").Types|
521
+ * 'change:active', import("../Object.js").ObjectEvent, Return> &
522
+ * import("../Observable.js").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &
523
+ * import("../Observable.js").CombinedOnSignature<import("../Observable.js").EventTypes|import("../ObjectEventType.js").Types|
1271
524
  * 'change:active'|'drawabort'|'drawend'|'drawstart', Return>} DrawOnSignature
1272
525
  */
1273
526
 
@@ -1278,7 +531,7 @@ function interpolateCoordinate(coordinates, index) {
1278
531
  * @fires DrawEvent
1279
532
  * @api
1280
533
  */
1281
- class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
534
+ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
1282
535
  /**
1283
536
  * @param {Options} options Options.
1284
537
  */
@@ -1287,18 +540,18 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1287
540
  options
1288
541
  );
1289
542
  if (!pointerOptions.stopDown) {
1290
- pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_10__.FALSE;
543
+ pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_3__.FALSE;
1291
544
  }
1292
545
 
1293
546
  super(pointerOptions);
1294
547
 
1295
548
  /***
1296
- * @type {DrawOnSignature<import("../events").EventsKey>}
549
+ * @type {DrawOnSignature<import("../events.js").EventsKey>}
1297
550
  */
1298
551
  this.on;
1299
552
 
1300
553
  /***
1301
- * @type {DrawOnSignature<import("../events").EventsKey>}
554
+ * @type {DrawOnSignature<import("../events.js").EventsKey>}
1302
555
  */
1303
556
  this.once;
1304
557
 
@@ -1307,6 +560,12 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1307
560
  */
1308
561
  this.un;
1309
562
 
563
+ /**
564
+ * @type {Options}
565
+ * @private
566
+ */
567
+ this.options_ = options;
568
+
1310
569
  /**
1311
570
  * @type {boolean}
1312
571
  * @private
@@ -1389,6 +648,15 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1389
648
  */
1390
649
  this.stopClick_ = !!options.stopClick;
1391
650
 
651
+ /**
652
+ * Ignore the next up event. This is set to `true` when a drag event is encountered,
653
+ * e.g. when the user pans the map while drawing. In this case, we do not want to bail
654
+ * out of tracing.
655
+ * @type {boolean}
656
+ * @private
657
+ */
658
+ this.ignoreNextUpEvent_ = false;
659
+
1392
660
  /**
1393
661
  * The number of points that must be drawn before a polygon ring or line
1394
662
  * string can be finished. The default is 3 for polygon rings and 2 for
@@ -1422,7 +690,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1422
690
  */
1423
691
  this.finishCondition_ = options.finishCondition
1424
692
  ? options.finishCondition
1425
- : _functions_js__WEBPACK_IMPORTED_MODULE_10__.TRUE;
693
+ : _functions_js__WEBPACK_IMPORTED_MODULE_3__.TRUE;
1426
694
 
1427
695
  /**
1428
696
  * @private
@@ -1445,9 +713,9 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1445
713
  geometryFunction = (coordinates, geometry, projection) => {
1446
714
  const circle = geometry
1447
715
  ? /** @type {Circle} */ (geometry)
1448
- : new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_11__["default"]([NaN, NaN]);
716
+ : new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_4__["default"]([NaN, NaN]);
1449
717
  const center = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(coordinates[0], projection);
1450
- const squaredLength = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_8__.squaredDistance)(
718
+ const squaredLength = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_5__.squaredDistance)(
1451
719
  center,
1452
720
  (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(coordinates[coordinates.length - 1], projection),
1453
721
  );
@@ -1465,11 +733,11 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1465
733
  } else {
1466
734
  let Constructor;
1467
735
  if (mode === 'Point') {
1468
- Constructor = _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"];
736
+ Constructor = _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__["default"];
1469
737
  } else if (mode === 'LineString') {
1470
- Constructor = _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"];
738
+ Constructor = _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__["default"];
1471
739
  } else if (mode === 'Polygon') {
1472
- Constructor = _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__["default"];
740
+ Constructor = _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__["default"];
1473
741
  }
1474
742
  /**
1475
743
  * @param {!LineCoordType} coordinates The coordinates.
@@ -1572,8 +840,8 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1572
840
  * @type {VectorLayer}
1573
841
  * @private
1574
842
  */
1575
- this.overlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_13__["default"]({
1576
- source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_14__["default"]({
843
+ this.overlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_9__["default"]({
844
+ source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_10__["default"]({
1577
845
  useSpatialIndex: false,
1578
846
  wrapX: options.wrapX ? options.wrapX : false,
1579
847
  }),
@@ -1592,7 +860,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1592
860
  * @private
1593
861
  * @type {import("../events/condition.js").Condition}
1594
862
  */
1595
- this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_15__.noModifierKeys;
863
+ this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.noModifierKeys;
1596
864
 
1597
865
  /**
1598
866
  * @private
@@ -1600,11 +868,11 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1600
868
  */
1601
869
  this.freehandCondition_;
1602
870
  if (options.freehand) {
1603
- this.freehandCondition_ = _events_condition_js__WEBPACK_IMPORTED_MODULE_15__.always;
871
+ this.freehandCondition_ = _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.always;
1604
872
  } else {
1605
873
  this.freehandCondition_ = options.freehandCondition
1606
874
  ? options.freehandCondition
1607
- : _events_condition_js__WEBPACK_IMPORTED_MODULE_15__.shiftKeyOnly;
875
+ : _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.shiftKeyOnly;
1608
876
  }
1609
877
 
1610
878
  /**
@@ -1626,7 +894,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1626
894
  */
1627
895
  this.traceSource_ = options.traceSource || options.source || null;
1628
896
 
1629
- this.addChangeListener(_Property_js__WEBPACK_IMPORTED_MODULE_16__["default"].ACTIVE, this.updateState_);
897
+ this.addChangeListener(_Property_js__WEBPACK_IMPORTED_MODULE_12__["default"].ACTIVE, this.updateState_);
1630
898
  }
1631
899
 
1632
900
  /**
@@ -1638,9 +906,9 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1638
906
  setTrace(trace) {
1639
907
  let condition;
1640
908
  if (!trace) {
1641
- condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_15__.never;
909
+ condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.never;
1642
910
  } else if (trace === true) {
1643
- condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_15__.always;
911
+ condition = _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.always;
1644
912
  } else {
1645
913
  condition = trace;
1646
914
  }
@@ -1659,6 +927,24 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1659
927
  this.updateState_();
1660
928
  }
1661
929
 
930
+ /**
931
+ * Set whether the drawing is done in freehand mode.
932
+ *
933
+ * @param {boolean} freehand Freehand drawing.
934
+ * @api
935
+ */
936
+ setFreehand(freehand) {
937
+ this.freehand_ = freehand;
938
+ if (this.freehand_) {
939
+ this.freehandCondition_ = _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.always;
940
+ } else {
941
+ this.freehandCondition_ =
942
+ this.options_ && this.options_.freehandCondition
943
+ ? this.options_.freehandCondition
944
+ : _events_condition_js__WEBPACK_IMPORTED_MODULE_11__.shiftKeyOnly;
945
+ }
946
+ }
947
+
1662
948
  /**
1663
949
  * Get the overlay layer that this interaction renders sketch features to.
1664
950
  * @return {VectorLayer} Overlay layer.
@@ -1668,6 +954,15 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1668
954
  return this.overlay_;
1669
955
  }
1670
956
 
957
+ /**
958
+ * Get if this interaction is in freehand mode.
959
+ * @return {boolean} Freehand drawing.
960
+ * @api
961
+ */
962
+ getFreehand() {
963
+ return this.freehand_;
964
+ }
965
+
1671
966
  /**
1672
967
  * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.
1673
968
  * @param {import("../MapBrowserEvent.js").default<PointerEvent>} event Map browser event.
@@ -1676,17 +971,17 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1676
971
  * @override
1677
972
  */
1678
973
  handleEvent(event) {
1679
- if (event.originalEvent.type === _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].CONTEXTMENU) {
974
+ if (event.originalEvent.type === _events_EventType_js__WEBPACK_IMPORTED_MODULE_13__["default"].CONTEXTMENU) {
1680
975
  // Avoid context menu for long taps when drawing on mobile
1681
976
  event.originalEvent.preventDefault();
1682
977
  }
1683
978
  this.freehand_ = this.mode_ !== 'Point' && this.freehandCondition_(event);
1684
- let move = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERMOVE;
979
+ let move = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERMOVE;
1685
980
  let pass = true;
1686
981
  if (
1687
982
  !this.freehand_ &&
1688
983
  this.lastDragTime_ &&
1689
- event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERDRAG
984
+ event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERDRAG
1690
985
  ) {
1691
986
  const now = Date.now();
1692
987
  if (now - this.lastDragTime_ >= this.dragVertexDelay_) {
@@ -1703,18 +998,18 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1703
998
  }
1704
999
  if (
1705
1000
  this.freehand_ &&
1706
- event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERDRAG &&
1001
+ event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERDRAG &&
1707
1002
  this.sketchFeature_ !== null
1708
1003
  ) {
1709
1004
  this.addToDrawing_(event.coordinate);
1710
1005
  pass = false;
1711
1006
  } else if (
1712
1007
  this.freehand_ &&
1713
- event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERDOWN
1008
+ event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERDOWN
1714
1009
  ) {
1715
1010
  pass = false;
1716
1011
  } else if (move && this.getPointerCount() < 2) {
1717
- pass = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERMOVE;
1012
+ pass = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERMOVE;
1718
1013
  if (pass && this.freehand_) {
1719
1014
  this.handlePointerMove_(event);
1720
1015
  if (this.shouldHandle_) {
@@ -1723,12 +1018,12 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1723
1018
  }
1724
1019
  } else if (
1725
1020
  event.originalEvent.pointerType === 'mouse' ||
1726
- (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERDRAG &&
1021
+ (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERDRAG &&
1727
1022
  this.downTimeout_ === undefined)
1728
1023
  ) {
1729
1024
  this.handlePointerMove_(event);
1730
1025
  }
1731
- } else if (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].DBLCLICK) {
1026
+ } else if (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].DBLCLICK) {
1732
1027
  pass = false;
1733
1028
  }
1734
1029
 
@@ -1760,8 +1055,8 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1760
1055
  this.lastDragTime_ = Date.now();
1761
1056
  this.downTimeout_ = setTimeout(() => {
1762
1057
  this.handlePointerMove_(
1763
- new _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_19__["default"](
1764
- _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POINTERMOVE,
1058
+ new _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_15__["default"](
1059
+ _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].POINTERMOVE,
1765
1060
  event.map,
1766
1061
  event.originalEvent,
1767
1062
  false,
@@ -1804,17 +1099,17 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1804
1099
  event.pixel[0] + this.snapTolerance_,
1805
1100
  event.pixel[1] - this.snapTolerance_,
1806
1101
  ]);
1807
- const extent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.boundingExtent)([lowerLeft, upperRight]);
1102
+ const extent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.boundingExtent)([lowerLeft, upperRight]);
1808
1103
  const features = this.traceSource_.getFeaturesInExtent(extent);
1809
1104
  if (features.length === 0) {
1810
1105
  return;
1811
1106
  }
1812
1107
 
1813
- const targets = getTraceTargets(event.coordinate, features);
1108
+ const targets = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_17__.getTraceTargets)(event.coordinate, features);
1814
1109
  if (targets.length) {
1815
1110
  this.traceState_ = {
1816
1111
  active: true,
1817
- startPx: event.pixel.slice(),
1112
+ startCoord: event.coordinate.slice(),
1818
1113
  targets: targets,
1819
1114
  targetIndex: -1,
1820
1115
  };
@@ -1908,7 +1203,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1908
1203
  end -= 1;
1909
1204
  }
1910
1205
  for (let i = start; i <= end; ++i) {
1911
- coordinates.push(getCoordinate(target.coordinates, i));
1206
+ coordinates.push((0,_tracing_js__WEBPACK_IMPORTED_MODULE_17__.getCoordinate)(target.coordinates, i));
1912
1207
  }
1913
1208
  } else {
1914
1209
  // reverse trace
@@ -1918,7 +1213,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1918
1213
  end += 1;
1919
1214
  }
1920
1215
  for (let i = start; i >= end; --i) {
1921
- coordinates.push(getCoordinate(target.coordinates, i));
1216
+ coordinates.push((0,_tracing_js__WEBPACK_IMPORTED_MODULE_17__.getCoordinate)(target.coordinates, i));
1922
1217
  }
1923
1218
  }
1924
1219
  if (coordinates.length) {
@@ -1939,12 +1234,13 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1939
1234
 
1940
1235
  if (traceState.targetIndex === -1) {
1941
1236
  // check if we are ready to pick a target
1942
- if ((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_8__.distance)(traceState.startPx, event.pixel) < this.snapTolerance_) {
1237
+ const startPx = event.map.getPixelFromCoordinate(traceState.startCoord);
1238
+ if ((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_5__.distance)(startPx, event.pixel) < this.snapTolerance_) {
1943
1239
  return;
1944
1240
  }
1945
1241
  }
1946
1242
 
1947
- const updatedTraceTarget = getTraceTargetUpdate(
1243
+ const updatedTraceTarget = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_17__.getTraceTargetUpdate)(
1948
1244
  event.coordinate,
1949
1245
  traceState,
1950
1246
  this.getMap(),
@@ -1977,7 +1273,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1977
1273
  target.endIndex = updatedTraceTarget.endIndex;
1978
1274
 
1979
1275
  // update event coordinate and pixel to match end point of final segment
1980
- const coordinate = interpolateCoordinate(
1276
+ const coordinate = (0,_tracing_js__WEBPACK_IMPORTED_MODULE_17__.interpolateCoordinate)(
1981
1277
  target.coordinates,
1982
1278
  target.endIndex,
1983
1279
  );
@@ -1986,6 +1282,16 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
1986
1282
  event.pixel = [Math.round(pixel[0]), Math.round(pixel[1])];
1987
1283
  }
1988
1284
 
1285
+ /**
1286
+ * Handle drag events.
1287
+ * @param {import("../MapBrowserEvent.js").default<PointerEvent>} event Event.
1288
+ * @override
1289
+ */
1290
+ handleDragEvent(event) {
1291
+ this.ignoreNextUpEvent_ = true;
1292
+ super.handleDragEvent(event);
1293
+ }
1294
+
1989
1295
  /**
1990
1296
  * Handle pointer up events.
1991
1297
  * @param {import("../MapBrowserEvent.js").default<PointerEvent>} event Event.
@@ -2003,7 +1309,9 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2003
1309
 
2004
1310
  this.handlePointerMove_(event);
2005
1311
  const tracing = this.traceState_.active;
2006
- this.toggleTraceState_(event);
1312
+ if (!this.ignoreNextUpEvent_) {
1313
+ this.toggleTraceState_(event);
1314
+ }
2007
1315
 
2008
1316
  if (this.shouldHandle_) {
2009
1317
  const startingToDraw = !this.finishCoordinate_;
@@ -2029,6 +1337,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2029
1337
  this.abortDrawing();
2030
1338
  }
2031
1339
  }
1340
+ this.ignoreNextUpEvent_ = false;
2032
1341
 
2033
1342
  if (!pass && this.stopClick_) {
2034
1343
  event.preventDefault();
@@ -2126,12 +1435,12 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2126
1435
  }
2127
1436
 
2128
1437
  /**
2129
- * @param {import("../coordinate").Coordinate} coordinates Coordinate.
1438
+ * @param {import("../coordinate.js").Coordinate} coordinates Coordinate.
2130
1439
  * @private
2131
1440
  */
2132
1441
  createOrUpdateSketchPoint_(coordinates) {
2133
1442
  if (!this.sketchPoint_) {
2134
- this.sketchPoint_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_21__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"](coordinates));
1443
+ this.sketchPoint_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_18__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__["default"](coordinates));
2135
1444
  this.updateSketchFeatures_();
2136
1445
  } else {
2137
1446
  const sketchPointGeom = this.sketchPoint_.getGeometry();
@@ -2145,12 +1454,12 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2145
1454
  */
2146
1455
  createOrUpdateCustomSketchLine_(geometry) {
2147
1456
  if (!this.sketchLine_) {
2148
- this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_21__["default"]();
1457
+ this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_18__["default"]();
2149
1458
  }
2150
1459
  const ring = geometry.getLinearRing(0);
2151
1460
  let sketchLineGeom = this.sketchLine_.getGeometry();
2152
1461
  if (!sketchLineGeom) {
2153
- sketchLineGeom = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"](
1462
+ sketchLineGeom = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](
2154
1463
  ring.getFlatCoordinates(),
2155
1464
  ring.getLayout(),
2156
1465
  );
@@ -2171,7 +1480,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2171
1480
  */
2172
1481
  startDrawing_(start) {
2173
1482
  const projection = this.getMap().getView().getProjection();
2174
- const stride = (0,_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_22__.getStrideForLayout)(this.geometryLayout_);
1483
+ const stride = (0,_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_19__.getStrideForLayout)(this.geometryLayout_);
2175
1484
  while (start.length < stride) {
2176
1485
  start.push(0);
2177
1486
  }
@@ -2185,14 +1494,14 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2185
1494
  this.sketchCoords_ = [start.slice(), start.slice()];
2186
1495
  }
2187
1496
  if (this.sketchLineCoords_) {
2188
- this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_21__["default"](new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"](this.sketchLineCoords_));
1497
+ this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_18__["default"](new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](this.sketchLineCoords_));
2189
1498
  }
2190
1499
  const geometry = this.geometryFunction_(
2191
1500
  this.sketchCoords_,
2192
1501
  undefined,
2193
1502
  projection,
2194
1503
  );
2195
- this.sketchFeature_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_21__["default"]();
1504
+ this.sketchFeature_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_18__["default"]();
2196
1505
  if (this.geometryName_) {
2197
1506
  this.sketchFeature_.setGeometryName(this.geometryName_);
2198
1507
  }
@@ -2212,7 +1521,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2212
1521
  const map = this.getMap();
2213
1522
  const geometry = this.sketchFeature_.getGeometry();
2214
1523
  const projection = map.getView().getProjection();
2215
- const stride = (0,_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_22__.getStrideForLayout)(this.geometryLayout_);
1524
+ const stride = (0,_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_19__.getStrideForLayout)(this.geometryLayout_);
2216
1525
  let coordinates, last;
2217
1526
  while (coordinate.length < stride) {
2218
1527
  coordinate.push(0);
@@ -2384,15 +1693,15 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2384
1693
  // cast multi-part geometries
2385
1694
  if (this.type_ === 'MultiPoint') {
2386
1695
  sketchFeature.setGeometry(
2387
- new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_23__["default"]([/** @type {PointCoordType} */ (coordinates)]),
1696
+ new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_20__["default"]([/** @type {PointCoordType} */ (coordinates)]),
2388
1697
  );
2389
1698
  } else if (this.type_ === 'MultiLineString') {
2390
1699
  sketchFeature.setGeometry(
2391
- new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__["default"]([/** @type {LineCoordType} */ (coordinates)]),
1700
+ new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_21__["default"]([/** @type {LineCoordType} */ (coordinates)]),
2392
1701
  );
2393
1702
  } else if (this.type_ === 'MultiPolygon') {
2394
1703
  sketchFeature.setGeometry(
2395
- new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__["default"]([/** @type {PolyCoordType} */ (coordinates)]),
1704
+ new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_22__["default"]([/** @type {PolyCoordType} */ (coordinates)]),
2396
1705
  );
2397
1706
  }
2398
1707
 
@@ -2502,7 +1811,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2502
1811
  const last = this.sketchCoords_[this.sketchCoords_.length - 1];
2503
1812
  this.finishCoordinate_ = last.slice();
2504
1813
  this.sketchCoords_.push(last.slice());
2505
- this.sketchPoint_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_21__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"](last));
1814
+ this.sketchPoint_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_18__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__["default"](last));
2506
1815
  this.updateSketchFeatures_();
2507
1816
  this.dispatchEvent(
2508
1817
  new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_),
@@ -2546,7 +1855,7 @@ class Draw extends _Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"] {
2546
1855
  * @return {import("../style/Style.js").StyleFunction} Styles.
2547
1856
  */
2548
1857
  function getDefaultStyleFunction() {
2549
- const styles = (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_24__.createEditingStyle)();
1858
+ const styles = (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_23__.createEditingStyle)();
2550
1859
  return function (feature, resolution) {
2551
1860
  return styles[feature.getGeometry().getType()];
2552
1861
  };
@@ -2575,8 +1884,8 @@ function createRegularPolygon(sides, angle) {
2575
1884
  /** @type {LineCoordType} */ (coordinates)[coordinates.length - 1],
2576
1885
  projection,
2577
1886
  );
2578
- const radius = Math.sqrt((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_8__.squaredDistance)(center, end));
2579
- geometry = geometry || (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__.fromCircle)(new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_11__["default"](center), sides);
1887
+ const radius = Math.sqrt((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_5__.squaredDistance)(center, end));
1888
+ geometry = geometry || (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__.fromCircle)(new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_4__["default"](center), sides);
2580
1889
 
2581
1890
  let internalAngle = angle;
2582
1891
  if (!angle && angle !== 0) {
@@ -2584,7 +1893,7 @@ function createRegularPolygon(sides, angle) {
2584
1893
  const y = end[1] - center[1];
2585
1894
  internalAngle = Math.atan2(y, x);
2586
1895
  }
2587
- (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__.makeRegular)(
1896
+ (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__.makeRegular)(
2588
1897
  /** @type {Polygon} */ (geometry),
2589
1898
  center,
2590
1899
  radius,
@@ -2608,7 +1917,7 @@ function createRegularPolygon(sides, angle) {
2608
1917
  */
2609
1918
  function createBox() {
2610
1919
  return function (coordinates, geometry, projection) {
2611
- const extent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.boundingExtent)(
1920
+ const extent = (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.boundingExtent)(
2612
1921
  /** @type {LineCoordType} */ ([
2613
1922
  coordinates[0],
2614
1923
  coordinates[coordinates.length - 1],
@@ -2618,17 +1927,17 @@ function createBox() {
2618
1927
  );
2619
1928
  const boxCoordinates = [
2620
1929
  [
2621
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.getBottomLeft)(extent),
2622
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.getBottomRight)(extent),
2623
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.getTopRight)(extent),
2624
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.getTopLeft)(extent),
2625
- (0,_extent_js__WEBPACK_IMPORTED_MODULE_20__.getBottomLeft)(extent),
1930
+ (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.getBottomLeft)(extent),
1931
+ (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.getBottomRight)(extent),
1932
+ (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.getTopRight)(extent),
1933
+ (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.getTopLeft)(extent),
1934
+ (0,_extent_js__WEBPACK_IMPORTED_MODULE_16__.getBottomLeft)(extent),
2626
1935
  ],
2627
1936
  ];
2628
1937
  if (geometry) {
2629
1938
  geometry.setCoordinates(boxCoordinates);
2630
1939
  } else {
2631
- geometry = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_5__["default"](boxCoordinates);
1940
+ geometry = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__["default"](boxCoordinates);
2632
1941
  }
2633
1942
  const userProjection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
2634
1943
  if (userProjection) {
@@ -2665,112 +1974,6 @@ function getMode(type) {
2665
1974
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Draw);
2666
1975
 
2667
1976
 
2668
- /***/ }),
2669
-
2670
- /***/ "./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js":
2671
- /*!******************************************************************!*\
2672
- !*** ./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js ***!
2673
- \******************************************************************/
2674
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2675
-
2676
- __webpack_require__.r(__webpack_exports__);
2677
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2678
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2679
- /* harmony export */ });
2680
- /* harmony import */ var _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/canvas/VectorLayer.js */ "./node_modules/@vaadin/map/node_modules/ol/renderer/canvas/VectorLayer.js");
2681
- /* harmony import */ var _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseVector.js */ "./node_modules/@vaadin/map/node_modules/ol/layer/BaseVector.js");
2682
- /**
2683
- * @module ol/layer/Vector
2684
- */
2685
-
2686
-
2687
-
2688
- /**
2689
- * @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<*>]
2690
- * @template {import('../Feature.js').FeatureLike} [FeatureType=import("./BaseVector.js").ExtractedFeatureType<VectorSourceType>]
2691
- * @typedef {Object} Options
2692
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
2693
- * @property {number} [opacity=1] Opacity (0, 1).
2694
- * @property {boolean} [visible=true] Visibility.
2695
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
2696
- * rendered outside of this extent.
2697
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
2698
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
2699
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
2700
- * method was used.
2701
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
2702
- * visible.
2703
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
2704
- * be visible.
2705
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
2706
- * visible.
2707
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
2708
- * be visible.
2709
- * @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
2710
- * features before rendering. By default features are drawn in the order that they are created. Use
2711
- * `null` to avoid the sort, but get an undefined draw order.
2712
- * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
2713
- * renderer when getting features from the vector source for the rendering or hit-detection.
2714
- * Recommended value: the size of the largest symbol, line width or label.
2715
- * @property {VectorSourceType} [source] Source.
2716
- * @property {import("../Map.js").default} [map] Sets the layer as overlay on a map. The map will not manage
2717
- * this layer in its layers collection, and the layer will be rendered on top. This is useful for
2718
- * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
2719
- * use [map.addLayer()]{@link import("../Map.js").default#addLayer}.
2720
- * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable
2721
- * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the
2722
- * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the
2723
- * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct
2724
- * layers or groups of layers separately, use different truthy values for `declutter`.
2725
- * @property {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [style] Layer style. When set to `null`, only
2726
- * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style
2727
- * which will be used if this is not set.
2728
- * @property {import("./Base.js").BackgroundColor} [background] Background color for the layer. If not specified, no background
2729
- * will be rendered.
2730
- * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will
2731
- * be recreated during animations. This means that no vectors will be shown clipped, but the
2732
- * setting will have a performance impact for large amounts of vector data. When set to `false`,
2733
- * batches will be recreated when no animation is active.
2734
- * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will
2735
- * be recreated during interactions. See also `updateWhileAnimating`.
2736
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
2737
- */
2738
-
2739
- /**
2740
- * @classdesc
2741
- * Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering
2742
- * even during animations. Points and labels stay upright on rotated views. For very large
2743
- * amounts of vector data, performance may suffer during pan and zoom animations. In this case,
2744
- * try {@link module:ol/layer/VectorImage~VectorImageLayer}.
2745
- *
2746
- * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
2747
- * property on the layer object; for example, setting `title: 'My Title'` in the
2748
- * options means that `title` is observable, and has get/set accessors.
2749
- *
2750
- * @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<*>]
2751
- * @template {import('../Feature.js').FeatureLike} [FeatureType=import("./BaseVector.js").ExtractedFeatureType<VectorSourceType>]
2752
- * @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorLayerRenderer>}
2753
- * @api
2754
- */
2755
- class VectorLayer extends _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
2756
- /**
2757
- * @param {Options<VectorSourceType, FeatureType>} [options] Options.
2758
- */
2759
- constructor(options) {
2760
- super(options);
2761
- }
2762
-
2763
- /**
2764
- * @override
2765
- */
2766
- createRenderer() {
2767
- return new _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
2768
- }
2769
- }
2770
-
2771
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VectorLayer);
2772
-
2773
-
2774
1977
  /***/ })
2775
1978
 
2776
1979
  }])