@vaadin/bundles 25.0.0-alpha3 → 25.0.0-alpha5

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 (192) hide show
  1. package/node_modules_ol_ImageCanvas_js.js +76 -83
  2. package/node_modules_ol_ImageCanvas_js.js.map +1 -1
  3. package/node_modules_ol_TileRange_js.js +128 -110
  4. package/node_modules_ol_TileRange_js.js.map +1 -1
  5. package/node_modules_ol_Tile_js.js +279 -0
  6. package/node_modules_ol_Tile_js.js.map +1 -0
  7. package/node_modules_ol_VectorRenderTile_js.js +428 -143
  8. package/node_modules_ol_VectorRenderTile_js.js.map +1 -1
  9. package/node_modules_ol_VectorTile_js.js +405 -119
  10. package/node_modules_ol_VectorTile_js.js.map +1 -1
  11. package/node_modules_ol_control_MousePosition_js.js +327 -0
  12. package/node_modules_ol_control_MousePosition_js.js.map +1 -0
  13. package/node_modules_ol_control_ZoomToExtent_js.js +118 -0
  14. package/node_modules_ol_control_ZoomToExtent_js.js.map +1 -0
  15. package/node_modules_ol_events_SnapEvent_js.js +79 -0
  16. package/node_modules_ol_events_SnapEvent_js.js.map +1 -0
  17. package/node_modules_ol_featureloader_js.js +205 -0
  18. package/node_modules_ol_featureloader_js.js.map +1 -0
  19. package/node_modules_ol_geom_Circle_js.js +300 -0
  20. package/node_modules_ol_geom_Circle_js.js.map +1 -0
  21. package/node_modules_ol_geom_GeometryCollection_js.js +369 -0
  22. package/node_modules_ol_geom_GeometryCollection_js.js.map +1 -0
  23. package/node_modules_ol_geom_MultiPoint_js.js +228 -0
  24. package/node_modules_ol_geom_MultiPoint_js.js.map +1 -0
  25. package/node_modules_ol_geom_flat_center_js.js +47 -0
  26. package/node_modules_ol_geom_flat_center_js.js.map +1 -0
  27. package/node_modules_ol_geom_flat_geodesic_js.js +123 -88
  28. package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -1
  29. package/node_modules_ol_geom_flat_interpolate_js.js +230 -0
  30. package/node_modules_ol_geom_flat_interpolate_js.js.map +1 -0
  31. package/node_modules_ol_geom_flat_length_js-_375a0.js +58 -0
  32. package/node_modules_ol_geom_flat_length_js-_375a0.js.map +1 -0
  33. package/node_modules_ol_geom_flat_length_js-_375a1.js +58 -0
  34. package/node_modules_ol_geom_flat_length_js-_375a1.js.map +1 -0
  35. package/node_modules_ol_geom_flat_length_js-_375a2.js +58 -0
  36. package/node_modules_ol_geom_flat_length_js-_375a2.js.map +1 -0
  37. package/node_modules_ol_geom_flat_length_js-_375a3.js +58 -0
  38. package/node_modules_ol_geom_flat_length_js-_375a3.js.map +1 -0
  39. package/node_modules_ol_geom_flat_length_js-_375a4.js +58 -0
  40. package/node_modules_ol_geom_flat_length_js-_375a4.js.map +1 -0
  41. package/node_modules_ol_geom_flat_linechunk_js.js +76 -0
  42. package/node_modules_ol_geom_flat_linechunk_js.js.map +1 -0
  43. package/node_modules_ol_geom_flat_straightchunk_js.js +68 -0
  44. package/node_modules_ol_geom_flat_straightchunk_js.js.map +1 -0
  45. package/node_modules_ol_geom_flat_textpath_js.js +178 -0
  46. package/node_modules_ol_geom_flat_textpath_js.js.map +1 -0
  47. package/node_modules_ol_interaction_DblClickDragZoom_js.js +285 -0
  48. package/node_modules_ol_interaction_DblClickDragZoom_js.js.map +1 -0
  49. package/node_modules_ol_interaction_DragAndDrop_js.js +351 -0
  50. package/node_modules_ol_interaction_DragAndDrop_js.js.map +1 -0
  51. package/node_modules_ol_interaction_DragRotateAndZoom_js.js +159 -0
  52. package/node_modules_ol_interaction_DragRotateAndZoom_js.js.map +1 -0
  53. package/node_modules_ol_layer_Vector_js-_49290.js +110 -0
  54. package/node_modules_ol_layer_Vector_js-_49290.js.map +1 -0
  55. package/node_modules_ol_layer_Vector_js-_49291.js +110 -0
  56. package/node_modules_ol_layer_Vector_js-_49291.js.map +1 -0
  57. package/node_modules_ol_layer_Vector_js-_49292.js +110 -0
  58. package/node_modules_ol_layer_Vector_js-_49292.js.map +1 -0
  59. package/node_modules_ol_layer_Vector_js-_49293.js +110 -0
  60. package/node_modules_ol_layer_Vector_js-_49293.js.map +1 -0
  61. package/node_modules_ol_loadingstrategy_js.js +95 -0
  62. package/node_modules_ol_loadingstrategy_js.js.map +1 -0
  63. package/node_modules_ol_render_VectorContext_js-_3ad60.js +144 -0
  64. package/node_modules_ol_render_VectorContext_js-_3ad60.js.map +1 -0
  65. package/node_modules_ol_render_VectorContext_js-_3ad61.js +144 -0
  66. package/node_modules_ol_render_VectorContext_js-_3ad61.js.map +1 -0
  67. package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js +372 -0
  68. package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js.map +1 -0
  69. package/node_modules_ol_render_canvas_ImageBuilder_js.js +318 -0
  70. package/node_modules_ol_render_canvas_ImageBuilder_js.js.map +1 -0
  71. package/node_modules_ol_render_canvas_Instruction_js.js +66 -0
  72. package/node_modules_ol_render_canvas_Instruction_js.js.map +1 -0
  73. package/node_modules_ol_render_canvas_LineStringBuilder_js.js +187 -0
  74. package/node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -0
  75. package/node_modules_ol_render_canvas_PolygonBuilder_js.js +276 -0
  76. package/node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
  77. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js +156 -0
  78. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js.map +1 -0
  79. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js +156 -0
  80. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js.map +1 -0
  81. package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js +301 -0
  82. package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js.map +1 -0
  83. package/node_modules_ol_renderer_Layer_js.js +219 -0
  84. package/node_modules_ol_renderer_Layer_js.js.map +1 -0
  85. package/node_modules_ol_source_Source_js.js +256 -0
  86. package/node_modules_ol_source_Source_js.js.map +1 -0
  87. package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js +318 -0
  88. package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js.map +1 -0
  89. package/node_modules_ol_source_VectorEventType_js.js +80 -0
  90. package/node_modules_ol_source_VectorEventType_js.js.map +1 -0
  91. package/node_modules_ol_structs_RBush_js.js +242 -0
  92. package/node_modules_ol_structs_RBush_js.js.map +1 -0
  93. package/node_modules_ol_style_js.js +2 -1
  94. package/node_modules_ol_style_js.js.map +1 -1
  95. package/node_modules_rbush_rbush_min_js.js +16 -0
  96. package/node_modules_rbush_rbush_min_js.js.map +1 -0
  97. package/package.json +142 -146
  98. package/vaadin-bundle.json +2447 -2352
  99. package/vaadin.js +52246 -63791
  100. package/vaadin.js.map +1 -1
  101. package/vendors-node_modules_dompurify_dist_purify_es_mjs.js +1364 -0
  102. package/vendors-node_modules_dompurify_dist_purify_es_mjs.js.map +1 -0
  103. package/vendors-node_modules_dompurify_dist_purify_js.js +26 -21
  104. package/vendors-node_modules_dompurify_dist_purify_js.js.map +1 -1
  105. package/vendors-node_modules_marked_lib_marked_esm_js.js +2205 -0
  106. package/vendors-node_modules_marked_lib_marked_esm_js.js.map +1 -0
  107. package/vendors-node_modules_marked_lib_marked_umd_js.js +2164 -2556
  108. package/vendors-node_modules_marked_lib_marked_umd_js.js.map +1 -1
  109. package/vendors-node_modules_ol_Feature_js.js +360 -0
  110. package/vendors-node_modules_ol_Feature_js.js.map +1 -0
  111. package/vendors-node_modules_ol_Geolocation_js.js +352 -293
  112. package/vendors-node_modules_ol_Geolocation_js.js.map +1 -1
  113. package/vendors-node_modules_ol_ImageTile_js.js +494 -0
  114. package/vendors-node_modules_ol_ImageTile_js.js.map +1 -0
  115. package/vendors-node_modules_ol_Overlay_js.js +606 -0
  116. package/vendors-node_modules_ol_Overlay_js.js.map +1 -0
  117. package/vendors-node_modules_ol_control_FullScreen_js.js +417 -0
  118. package/vendors-node_modules_ol_control_FullScreen_js.js.map +1 -0
  119. package/vendors-node_modules_ol_control_OverviewMap_js.js +711 -0
  120. package/vendors-node_modules_ol_control_OverviewMap_js.js.map +1 -0
  121. package/vendors-node_modules_ol_control_ScaleLine_js.js +509 -0
  122. package/vendors-node_modules_ol_control_ScaleLine_js.js.map +1 -0
  123. package/vendors-node_modules_ol_control_ZoomSlider_js.js +418 -0
  124. package/vendors-node_modules_ol_control_ZoomSlider_js.js.map +1 -0
  125. package/vendors-node_modules_ol_control_js.js +490 -0
  126. package/vendors-node_modules_ol_control_js.js.map +1 -0
  127. package/vendors-node_modules_ol_geom_LineString_js.js +574 -0
  128. package/vendors-node_modules_ol_geom_LineString_js.js.map +1 -0
  129. package/vendors-node_modules_ol_geom_MultiLineString_js.js +405 -0
  130. package/vendors-node_modules_ol_geom_MultiLineString_js.js.map +1 -0
  131. package/vendors-node_modules_ol_geom_MultiPolygon_js.js +773 -0
  132. package/vendors-node_modules_ol_geom_MultiPolygon_js.js.map +1 -0
  133. package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js +769 -0
  134. package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js.map +1 -0
  135. package/vendors-node_modules_ol_index_js.js +526 -675
  136. package/vendors-node_modules_ol_index_js.js.map +1 -1
  137. package/vendors-node_modules_ol_interaction_Draw_js.js +2777 -0
  138. package/vendors-node_modules_ol_interaction_Draw_js.js.map +1 -0
  139. package/vendors-node_modules_ol_interaction_Extent_js.js +586 -0
  140. package/vendors-node_modules_ol_interaction_Extent_js.js.map +1 -0
  141. package/vendors-node_modules_ol_interaction_Link_js.js +489 -0
  142. package/vendors-node_modules_ol_interaction_Link_js.js.map +1 -0
  143. package/vendors-node_modules_ol_interaction_Modify_js.js +1841 -0
  144. package/vendors-node_modules_ol_interaction_Modify_js.js.map +1 -0
  145. package/vendors-node_modules_ol_interaction_Select_js.js +623 -0
  146. package/vendors-node_modules_ol_interaction_Select_js.js.map +1 -0
  147. package/vendors-node_modules_ol_interaction_Snap_js.js +982 -0
  148. package/vendors-node_modules_ol_interaction_Snap_js.js.map +1 -0
  149. package/vendors-node_modules_ol_interaction_Translate_js.js +466 -0
  150. package/vendors-node_modules_ol_interaction_Translate_js.js.map +1 -0
  151. package/vendors-node_modules_ol_interaction_js.js +872 -0
  152. package/vendors-node_modules_ol_interaction_js.js.map +1 -0
  153. package/vendors-node_modules_ol_layer_Graticule_js.js +1374 -989
  154. package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -1
  155. package/vendors-node_modules_ol_render_Feature_js.js +546 -0
  156. package/vendors-node_modules_ol_render_Feature_js.js.map +1 -0
  157. package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js +897 -0
  158. package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -0
  159. package/vendors-node_modules_ol_render_canvas_Builder_js.js +907 -0
  160. package/vendors-node_modules_ol_render_canvas_Builder_js.js.map +1 -0
  161. package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js +539 -0
  162. package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -0
  163. package/vendors-node_modules_ol_render_canvas_Executor_js.js +1715 -0
  164. package/vendors-node_modules_ol_render_canvas_Executor_js.js.map +1 -0
  165. package/vendors-node_modules_ol_render_canvas_Immediate_js.js +1208 -0
  166. package/vendors-node_modules_ol_render_canvas_Immediate_js.js.map +1 -0
  167. package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js +825 -0
  168. package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -0
  169. package/vendors-node_modules_ol_renderer_canvas_Layer_js.js +654 -0
  170. package/vendors-node_modules_ol_renderer_canvas_Layer_js.js.map +1 -0
  171. package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js +1044 -0
  172. package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -0
  173. package/vendors-node_modules_ol_renderer_vector_js.js +460 -0
  174. package/vendors-node_modules_ol_renderer_vector_js.js.map +1 -0
  175. package/vendors-node_modules_ol_source_Vector_js.js +2091 -0
  176. package/vendors-node_modules_ol_source_Vector_js.js.map +1 -0
  177. package/node_modules_ol_ImageTile_js.js +0 -177
  178. package/node_modules_ol_ImageTile_js.js.map +0 -1
  179. package/node_modules_ol_render_js.js +0 -131
  180. package/node_modules_ol_render_js.js.map +0 -1
  181. package/node_modules_ol_structs_LRUCache_js.js +0 -275
  182. package/node_modules_ol_structs_LRUCache_js.js.map +0 -1
  183. package/node_modules_ol_tilecoord_js.js +0 -115
  184. package/node_modules_ol_tilecoord_js.js.map +0 -1
  185. package/vendors-node_modules_ol_TileCache_js.js +0 -461
  186. package/vendors-node_modules_ol_TileCache_js.js.map +0 -1
  187. package/vendors-node_modules_ol_Tile_js.js +0 -330
  188. package/vendors-node_modules_ol_Tile_js.js.map +0 -1
  189. package/vendors-node_modules_ol_style_Text_js.js +0 -509
  190. package/vendors-node_modules_ol_style_Text_js.js.map +0 -1
  191. package/vendors-node_modules_rbush_index_js.js +0 -531
  192. package/vendors-node_modules_rbush_index_js.js.map +0 -1
@@ -0,0 +1,586 @@
1
+ (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_interaction_Extent_js"],{
2
+
3
+ /***/ "./node_modules/ol/interaction/Extent.js":
4
+ /*!***********************************************!*\
5
+ !*** ./node_modules/ol/interaction/Extent.js ***!
6
+ \***********************************************/
7
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "ExtentEvent": () => (/* binding */ ExtentEvent),
12
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13
+ /* harmony export */ });
14
+ /* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
15
+ /* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
16
+ /* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
17
+ /* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
18
+ /* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
19
+ /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
20
+ /* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
21
+ /* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
22
+ /* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/ol/layer/Vector.js");
23
+ /* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
24
+ /* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/ol/source/Vector.js");
25
+ /* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
26
+ /* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
27
+ /**
28
+ * @module ol/interaction/Extent
29
+ */
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ /**
45
+ * @typedef {Object} Options
46
+ * @property {import("../events/condition.js").Condition} [condition] A function that
47
+ * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
48
+ * boolean to indicate whether that event should be handled.
49
+ * Default is {@link module:ol/events/condition.always}.
50
+ * @property {import("../extent.js").Extent} [extent] Initial extent. Defaults to no
51
+ * initial extent.
52
+ * @property {import("../style/Style.js").StyleLike} [boxStyle]
53
+ * Style for the drawn extent box. Defaults to the `Polygon` editing style
54
+ * documented in {@link module:ol/style/Style~Style}
55
+ * @property {number} [pixelTolerance=10] Pixel tolerance for considering the
56
+ * pointer close enough to a segment or vertex for editing.
57
+ * @property {import("../style/Style.js").StyleLike} [pointerStyle]
58
+ * Style for the cursor used to draw the extent. Defaults to the `Point` editing style
59
+ * documented in {@link module:ol/style/Style~Style}
60
+ * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
61
+ * in the X direction? Only affects visuals, not functionality.
62
+ */
63
+
64
+ /**
65
+ * @enum {string}
66
+ */
67
+ const ExtentEventType = {
68
+ /**
69
+ * Triggered after the extent is changed
70
+ * @event ExtentEvent#extentchanged
71
+ * @api
72
+ */
73
+ EXTENTCHANGED: 'extentchanged',
74
+ };
75
+
76
+ /**
77
+ * @classdesc
78
+ * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are
79
+ * instances of this type.
80
+ */
81
+ class ExtentEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
82
+ /**
83
+ * @param {import("../extent.js").Extent} extent the new extent
84
+ */
85
+ constructor(extent) {
86
+ super(ExtentEventType.EXTENTCHANGED);
87
+
88
+ /**
89
+ * The current extent.
90
+ * @type {import("../extent.js").Extent}
91
+ * @api
92
+ */
93
+ this.extent = extent;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * @typedef {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} PointerHandler
99
+ */
100
+
101
+ /***
102
+ * @template Return
103
+ * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
104
+ * import("../Observable").OnSignature<import("../ObjectEventType").Types|
105
+ * 'change:active', import("../Object").ObjectEvent, Return> &
106
+ * import("../Observable").OnSignature<'extentchanged', ExtentEvent, Return> &
107
+ * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
108
+ * 'change:active'|'extentchanged', Return>} ExtentOnSignature
109
+ */
110
+
111
+ /**
112
+ * @classdesc
113
+ * Allows the user to draw a vector box by clicking and dragging on the map.
114
+ * Once drawn, the vector box can be modified by dragging its vertices or edges.
115
+ * This interaction is only supported for mouse devices.
116
+ *
117
+ * @fires ExtentEvent
118
+ * @api
119
+ */
120
+ class Extent extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
121
+ /**
122
+ * @param {Options} [options] Options.
123
+ */
124
+ constructor(options) {
125
+ options = options || {};
126
+
127
+ super(/** @type {import("./Pointer.js").Options} */ (options));
128
+
129
+ /***
130
+ * @type {ExtentOnSignature<import("../events").EventsKey>}
131
+ */
132
+ this.on;
133
+
134
+ /***
135
+ * @type {ExtentOnSignature<import("../events").EventsKey>}
136
+ */
137
+ this.once;
138
+
139
+ /***
140
+ * @type {ExtentOnSignature<void>}
141
+ */
142
+ this.un;
143
+
144
+ /**
145
+ * Condition
146
+ * @type {import("../events/condition.js").Condition}
147
+ * @private
148
+ */
149
+ this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_3__.always;
150
+
151
+ /**
152
+ * Extent of the drawn box
153
+ * @type {import("../extent.js").Extent}
154
+ * @private
155
+ */
156
+ this.extent_ = null;
157
+
158
+ /**
159
+ * Handler for pointer move events
160
+ * @type {PointerHandler|null}
161
+ * @private
162
+ */
163
+ this.pointerHandler_ = null;
164
+
165
+ /**
166
+ * Pixel threshold to snap to extent
167
+ * @type {number}
168
+ * @private
169
+ */
170
+ this.pixelTolerance_ =
171
+ options.pixelTolerance !== undefined ? options.pixelTolerance : 10;
172
+
173
+ /**
174
+ * Is the pointer snapped to an extent vertex
175
+ * @type {boolean}
176
+ * @private
177
+ */
178
+ this.snappedToVertex_ = false;
179
+
180
+ /**
181
+ * Feature for displaying the visible extent
182
+ * @type {Feature}
183
+ * @private
184
+ */
185
+ this.extentFeature_ = null;
186
+
187
+ /**
188
+ * Feature for displaying the visible pointer
189
+ * @type {Feature<Point>}
190
+ * @private
191
+ */
192
+ this.vertexFeature_ = null;
193
+
194
+ if (!options) {
195
+ options = {};
196
+ }
197
+
198
+ /**
199
+ * Layer for the extentFeature
200
+ * @type {VectorLayer}
201
+ * @private
202
+ */
203
+ this.extentOverlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
204
+ source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
205
+ useSpatialIndex: false,
206
+ wrapX: !!options.wrapX,
207
+ }),
208
+ style: options.boxStyle
209
+ ? options.boxStyle
210
+ : getDefaultExtentStyleFunction(),
211
+ updateWhileAnimating: true,
212
+ updateWhileInteracting: true,
213
+ });
214
+
215
+ /**
216
+ * Layer for the vertexFeature
217
+ * @type {VectorLayer}
218
+ * @private
219
+ */
220
+ this.vertexOverlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
221
+ source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
222
+ useSpatialIndex: false,
223
+ wrapX: !!options.wrapX,
224
+ }),
225
+ style: options.pointerStyle
226
+ ? options.pointerStyle
227
+ : getDefaultPointerStyleFunction(),
228
+ updateWhileAnimating: true,
229
+ updateWhileInteracting: true,
230
+ });
231
+
232
+ if (options.extent) {
233
+ this.setExtent(options.extent);
234
+ }
235
+ }
236
+
237
+ /**
238
+ * @param {import("../pixel.js").Pixel} pixel cursor location
239
+ * @param {import("../Map.js").default} map map
240
+ * @return {import("../coordinate.js").Coordinate|null} snapped vertex on extent
241
+ * @private
242
+ */
243
+ snapToVertex_(pixel, map) {
244
+ const pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);
245
+ const sortByDistance = function (a, b) {
246
+ return (
247
+ (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.squaredDistanceToSegment)(pixelCoordinate, a) -
248
+ (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.squaredDistanceToSegment)(pixelCoordinate, b)
249
+ );
250
+ };
251
+ const extent = this.getExtentInternal();
252
+ if (extent) {
253
+ //convert extents to line segments and find the segment closest to pixelCoordinate
254
+ const segments = getSegments(extent);
255
+ segments.sort(sortByDistance);
256
+ const closestSegment = segments[0];
257
+
258
+ let vertex = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.closestOnSegment)(pixelCoordinate, closestSegment);
259
+ const vertexPixel = map.getPixelFromCoordinateInternal(vertex);
260
+
261
+ //if the distance is within tolerance, snap to the segment
262
+ if ((0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.distance)(pixel, vertexPixel) <= this.pixelTolerance_) {
263
+ //test if we should further snap to a vertex
264
+ const pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);
265
+ const pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);
266
+ const squaredDist1 = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.squaredDistance)(vertexPixel, pixel1);
267
+ const squaredDist2 = (0,_coordinate_js__WEBPACK_IMPORTED_MODULE_6__.squaredDistance)(vertexPixel, pixel2);
268
+ const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
269
+ this.snappedToVertex_ = dist <= this.pixelTolerance_;
270
+ if (this.snappedToVertex_) {
271
+ vertex =
272
+ squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];
273
+ }
274
+ return vertex;
275
+ }
276
+ }
277
+ return null;
278
+ }
279
+
280
+ /**
281
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event
282
+ * @private
283
+ */
284
+ handlePointerMove_(mapBrowserEvent) {
285
+ const pixel = mapBrowserEvent.pixel;
286
+ const map = mapBrowserEvent.map;
287
+
288
+ let vertex = this.snapToVertex_(pixel, map);
289
+ if (!vertex) {
290
+ vertex = map.getCoordinateFromPixelInternal(pixel);
291
+ }
292
+ this.createOrUpdatePointerFeature_(vertex);
293
+ }
294
+
295
+ /**
296
+ * @param {import("../extent.js").Extent} extent extent
297
+ * @return {Feature} extent as featrue
298
+ * @private
299
+ */
300
+ createOrUpdateExtentFeature_(extent) {
301
+ let extentFeature = this.extentFeature_;
302
+
303
+ if (!extentFeature) {
304
+ if (!extent) {
305
+ extentFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_7__["default"]({});
306
+ } else {
307
+ extentFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_7__["default"]((0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__.fromExtent)(extent));
308
+ }
309
+ this.extentFeature_ = extentFeature;
310
+ this.extentOverlay_.getSource().addFeature(extentFeature);
311
+ } else {
312
+ if (!extent) {
313
+ extentFeature.setGeometry(undefined);
314
+ } else {
315
+ extentFeature.setGeometry((0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__.fromExtent)(extent));
316
+ }
317
+ }
318
+ return extentFeature;
319
+ }
320
+
321
+ /**
322
+ * @param {import("../coordinate.js").Coordinate} vertex location of feature
323
+ * @return {Feature} vertex as feature
324
+ * @private
325
+ */
326
+ createOrUpdatePointerFeature_(vertex) {
327
+ let vertexFeature = this.vertexFeature_;
328
+ if (!vertexFeature) {
329
+ vertexFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_7__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__["default"](vertex));
330
+ this.vertexFeature_ = vertexFeature;
331
+ this.vertexOverlay_.getSource().addFeature(vertexFeature);
332
+ } else {
333
+ const geometry = vertexFeature.getGeometry();
334
+ geometry.setCoordinates(vertex);
335
+ }
336
+ return vertexFeature;
337
+ }
338
+
339
+ /**
340
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
341
+ * @return {boolean} `false` to stop event propagation.
342
+ * @override
343
+ */
344
+ handleEvent(mapBrowserEvent) {
345
+ if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) {
346
+ return true;
347
+ }
348
+ //display pointer (if not dragging)
349
+ if (
350
+ mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].POINTERMOVE &&
351
+ !this.handlingDownUpSequence
352
+ ) {
353
+ this.handlePointerMove_(mapBrowserEvent);
354
+ }
355
+ //call pointer to determine up/down/drag
356
+ super.handleEvent(mapBrowserEvent);
357
+ //return false to stop propagation
358
+ return false;
359
+ }
360
+
361
+ /**
362
+ * Handle pointer down events.
363
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
364
+ * @return {boolean} If the event was consumed.
365
+ * @override
366
+ */
367
+ handleDownEvent(mapBrowserEvent) {
368
+ const pixel = mapBrowserEvent.pixel;
369
+ const map = mapBrowserEvent.map;
370
+
371
+ const extent = this.getExtentInternal();
372
+ let vertex = this.snapToVertex_(pixel, map);
373
+
374
+ //find the extent corner opposite the passed corner
375
+ const getOpposingPoint = function (point) {
376
+ let x_ = null;
377
+ let y_ = null;
378
+ if (point[0] == extent[0]) {
379
+ x_ = extent[2];
380
+ } else if (point[0] == extent[2]) {
381
+ x_ = extent[0];
382
+ }
383
+ if (point[1] == extent[1]) {
384
+ y_ = extent[3];
385
+ } else if (point[1] == extent[3]) {
386
+ y_ = extent[1];
387
+ }
388
+ if (x_ !== null && y_ !== null) {
389
+ return [x_, y_];
390
+ }
391
+ return null;
392
+ };
393
+ if (vertex && extent) {
394
+ const x =
395
+ vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null;
396
+ const y =
397
+ vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null;
398
+
399
+ //snap to point
400
+ if (x !== null && y !== null) {
401
+ this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));
402
+ //snap to edge
403
+ } else if (x !== null) {
404
+ this.pointerHandler_ = getEdgeHandler(
405
+ getOpposingPoint([x, extent[1]]),
406
+ getOpposingPoint([x, extent[3]]),
407
+ );
408
+ } else if (y !== null) {
409
+ this.pointerHandler_ = getEdgeHandler(
410
+ getOpposingPoint([extent[0], y]),
411
+ getOpposingPoint([extent[2], y]),
412
+ );
413
+ }
414
+ //no snap - new bbox
415
+ } else {
416
+ vertex = map.getCoordinateFromPixelInternal(pixel);
417
+ this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);
418
+ this.pointerHandler_ = getPointHandler(vertex);
419
+ }
420
+ return true; //event handled; start downup sequence
421
+ }
422
+
423
+ /**
424
+ * Handle pointer drag events.
425
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
426
+ * @override
427
+ */
428
+ handleDragEvent(mapBrowserEvent) {
429
+ if (this.pointerHandler_) {
430
+ const pixelCoordinate = mapBrowserEvent.coordinate;
431
+ this.setExtent(this.pointerHandler_(pixelCoordinate));
432
+ this.createOrUpdatePointerFeature_(pixelCoordinate);
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Handle pointer up events.
438
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
439
+ * @return {boolean} If the event was consumed.
440
+ * @override
441
+ */
442
+ handleUpEvent(mapBrowserEvent) {
443
+ this.pointerHandler_ = null;
444
+ //If bbox is zero area, set to null;
445
+ const extent = this.getExtentInternal();
446
+ if (!extent || (0,_extent_js__WEBPACK_IMPORTED_MODULE_11__.getArea)(extent) === 0) {
447
+ this.setExtent(null);
448
+ }
449
+ return false; //Stop handling downup sequence
450
+ }
451
+
452
+ /**
453
+ * Remove the interaction from its current map and attach it to the new map.
454
+ * Subclasses may set up event handlers to get notified about changes to
455
+ * the map here.
456
+ * @param {import("../Map.js").default} map Map.
457
+ * @override
458
+ */
459
+ setMap(map) {
460
+ this.extentOverlay_.setMap(map);
461
+ this.vertexOverlay_.setMap(map);
462
+ super.setMap(map);
463
+ }
464
+
465
+ /**
466
+ * Returns the current drawn extent in the view projection (or user projection if set)
467
+ *
468
+ * @return {import("../extent.js").Extent} Drawn extent in the view projection.
469
+ * @api
470
+ */
471
+ getExtent() {
472
+ return (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.toUserExtent)(
473
+ this.getExtentInternal(),
474
+ this.getMap().getView().getProjection(),
475
+ );
476
+ }
477
+
478
+ /**
479
+ * Returns the current drawn extent in the view projection
480
+ *
481
+ * @return {import("../extent.js").Extent} Drawn extent in the view projection.
482
+ * @api
483
+ */
484
+ getExtentInternal() {
485
+ return this.extent_;
486
+ }
487
+
488
+ /**
489
+ * Manually sets the drawn extent, using the view projection.
490
+ *
491
+ * @param {import("../extent.js").Extent} extent Extent
492
+ * @api
493
+ */
494
+ setExtent(extent) {
495
+ //Null extent means no bbox
496
+ this.extent_ = extent ? extent : null;
497
+ this.createOrUpdateExtentFeature_(extent);
498
+ this.dispatchEvent(new ExtentEvent(this.extent_));
499
+ }
500
+ }
501
+
502
+ /**
503
+ * Returns the default style for the drawn bbox
504
+ *
505
+ * @return {import("../style/Style.js").StyleFunction} Default Extent style
506
+ */
507
+ function getDefaultExtentStyleFunction() {
508
+ const style = (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_12__.createEditingStyle)();
509
+ return function (feature, resolution) {
510
+ return style['Polygon'];
511
+ };
512
+ }
513
+
514
+ /**
515
+ * Returns the default style for the pointer
516
+ *
517
+ * @return {import("../style/Style.js").StyleFunction} Default pointer style
518
+ */
519
+ function getDefaultPointerStyleFunction() {
520
+ const style = (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_12__.createEditingStyle)();
521
+ return function (feature, resolution) {
522
+ return style['Point'];
523
+ };
524
+ }
525
+
526
+ /**
527
+ * @param {import("../coordinate.js").Coordinate} fixedPoint corner that will be unchanged in the new extent
528
+ * @return {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} event handler
529
+ */
530
+ function getPointHandler(fixedPoint) {
531
+ return function (point) {
532
+ return (0,_extent_js__WEBPACK_IMPORTED_MODULE_11__.boundingExtent)([fixedPoint, point]);
533
+ };
534
+ }
535
+
536
+ /**
537
+ * @param {import("../coordinate.js").Coordinate} fixedP1 first corner that will be unchanged in the new extent
538
+ * @param {import("../coordinate.js").Coordinate} fixedP2 second corner that will be unchanged in the new extent
539
+ * @return {PointerHandler|null} event handler
540
+ */
541
+ function getEdgeHandler(fixedP1, fixedP2) {
542
+ if (fixedP1[0] == fixedP2[0]) {
543
+ return function (point) {
544
+ return (0,_extent_js__WEBPACK_IMPORTED_MODULE_11__.boundingExtent)([fixedP1, [point[0], fixedP2[1]]]);
545
+ };
546
+ }
547
+ if (fixedP1[1] == fixedP2[1]) {
548
+ return function (point) {
549
+ return (0,_extent_js__WEBPACK_IMPORTED_MODULE_11__.boundingExtent)([fixedP1, [fixedP2[0], point[1]]]);
550
+ };
551
+ }
552
+ return null;
553
+ }
554
+
555
+ /**
556
+ * @param {import("../extent.js").Extent} extent extent
557
+ * @return {Array<Array<import("../coordinate.js").Coordinate>>} extent line segments
558
+ */
559
+ function getSegments(extent) {
560
+ return [
561
+ [
562
+ [extent[0], extent[1]],
563
+ [extent[0], extent[3]],
564
+ ],
565
+ [
566
+ [extent[0], extent[3]],
567
+ [extent[2], extent[3]],
568
+ ],
569
+ [
570
+ [extent[2], extent[3]],
571
+ [extent[2], extent[1]],
572
+ ],
573
+ [
574
+ [extent[2], extent[1]],
575
+ [extent[0], extent[1]],
576
+ ],
577
+ ];
578
+ }
579
+
580
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Extent);
581
+
582
+
583
+ /***/ })
584
+
585
+ }])
586
+ //# sourceMappingURL=vendors-node_modules_ol_interaction_Extent_js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendors-node_modules_ol_interaction_Extent_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACoC;AACwB;AAMlC;AACa;AACO;AACO;AAChB;AAC8B;AACtB;AACL;AACO;AACM;AACP;;AAE9C;AACA,aAAa,QAAQ;AACrB,cAAc,4CAA4C;AAC1D,YAAY,iDAAiD;AAC7D;AACA,eAAe,wCAAwC;AACvD,cAAc,+BAA+B;AAC7C;AACA,cAAc,uCAAuC;AACrD;AACA,kBAAkB;AAClB,cAAc,QAAQ;AACtB;AACA,cAAc,uCAAuC;AACrD;AACA,kBAAkB;AAClB,cAAc,SAAS;AACvB;AACA;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,2CAA2C;AACjE;AACA;AACO,0BAA0B,wDAAK;AACtC;AACA,aAAa,+BAA+B;AAC5C;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,iFAAiF;AAC9F;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,mDAAkB;AACvC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA,qBAAqB,gCAAgC;;AAErD;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,8DAA8D,wDAAM;;AAEpE;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,8BAA8B,wDAAW;AACzC,kBAAkB,yDAAY;AAC9B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA,8BAA8B,wDAAW;AACzC,kBAAkB,yDAAY;AAC9B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,aAAa,6BAA6B;AAC1C,aAAa,6BAA6B;AAC1C,cAAc,4CAA4C;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,wEAAwB;AAChC,QAAQ,wEAAwB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,gEAAgB;AACnC;;AAEA;AACA,UAAU,wDAAkB;AAC5B;AACA;AACA;AACA,6BAA6B,+DAAyB;AACtD,6BAA6B,+DAAyB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,+BAA+B;AAC5C,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,mDAAO,GAAG;AACtC,QAAQ;AACR,4BAA4B,mDAAO,CAAC,4DAAiB;AACrD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,QAAQ;AACR,kCAAkC,4DAAiB;AACnD;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA,0BAA0B,mDAAO,KAAK,sDAAK;AAC3C;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,4EAA+B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oDAAO;AAC1B;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,+BAA+B;AAC7C;AACA;AACA;AACA,WAAW,sDAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,+BAA+B;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,+BAA+B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,2CAA2C;AACvD;AACA;AACA,gBAAgB,oEAAkB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,2CAA2C;AACvD;AACA;AACA,gBAAgB,oEAAkB;AAClC;AACA;AACA;AACA;;AAEA;AACA,WAAW,uCAAuC;AAClD,YAAY,iFAAiF;AAC7F;AACA;AACA;AACA,WAAW,2DAAc;AACzB;AACA;;AAEA;AACA,WAAW,uCAAuC;AAClD,WAAW,uCAAuC;AAClD,YAAY,qBAAqB;AACjC;AACA;AACA;AACA;AACA,aAAa,2DAAc;AAC3B;AACA;AACA;AACA;AACA,aAAa,2DAAc;AAC3B;AACA;AACA;AACA;;AAEA;AACA,WAAW,+BAA+B;AAC1C,YAAY,qDAAqD;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,MAAM,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/interaction/Extent.js"],"sourcesContent":["/**\n * @module ol/interaction/Extent\n */\nimport Feature from '../Feature.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport {always} from '../events/condition.js';\nimport {boundingExtent, getArea} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {toUserExtent} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.always}.\n * @property {import(\"../extent.js\").Extent} [extent] Initial extent. Defaults to no\n * initial extent.\n * @property {import(\"../style/Style.js\").StyleLike} [boxStyle]\n * Style for the drawn extent box. Defaults to the `Polygon` editing style\n * documented in {@link module:ol/style/Style~Style}\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike} [pointerStyle]\n * Style for the cursor used to draw the extent. Defaults to the `Point` editing style\n * documented in {@link module:ol/style/Style~Style}\n * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps\n * in the X direction? Only affects visuals, not functionality.\n */\n\n/**\n * @enum {string}\n */\nconst ExtentEventType = {\n /**\n * Triggered after the extent is changed\n * @event ExtentEvent#extentchanged\n * @api\n */\n EXTENTCHANGED: 'extentchanged',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are\n * instances of this type.\n */\nexport class ExtentEvent extends Event {\n /**\n * @param {import(\"../extent.js\").Extent} extent the new extent\n */\n constructor(extent) {\n super(ExtentEventType.EXTENTCHANGED);\n\n /**\n * The current extent.\n * @type {import(\"../extent.js\").Extent}\n * @api\n */\n this.extent = extent;\n }\n}\n\n/**\n * @typedef {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent} PointerHandler\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'extentchanged', ExtentEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'extentchanged', Return>} ExtentOnSignature\n */\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map.\n * Once drawn, the vector box can be modified by dragging its vertices or edges.\n * This interaction is only supported for mouse devices.\n *\n * @fires ExtentEvent\n * @api\n */\nclass Extent extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {ExtentOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ExtentOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ExtentOnSignature<void>}\n */\n this.un;\n\n /**\n * Condition\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.condition_ = options.condition ? options.condition : always;\n\n /**\n * Extent of the drawn box\n * @type {import(\"../extent.js\").Extent}\n * @private\n */\n this.extent_ = null;\n\n /**\n * Handler for pointer move events\n * @type {PointerHandler|null}\n * @private\n */\n this.pointerHandler_ = null;\n\n /**\n * Pixel threshold to snap to extent\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Is the pointer snapped to an extent vertex\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Feature for displaying the visible extent\n * @type {Feature}\n * @private\n */\n this.extentFeature_ = null;\n\n /**\n * Feature for displaying the visible pointer\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n if (!options) {\n options = {};\n }\n\n /**\n * Layer for the extentFeature\n * @type {VectorLayer}\n * @private\n */\n this.extentOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.boxStyle\n ? options.boxStyle\n : getDefaultExtentStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * Layer for the vertexFeature\n * @type {VectorLayer}\n * @private\n */\n this.vertexOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.pointerStyle\n ? options.pointerStyle\n : getDefaultPointerStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n if (options.extent) {\n this.setExtent(options.extent);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel cursor location\n * @param {import(\"../Map.js\").default} map map\n * @return {import(\"../coordinate.js\").Coordinate|null} snapped vertex on extent\n * @private\n */\n snapToVertex_(pixel, map) {\n const pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);\n const sortByDistance = function (a, b) {\n return (\n squaredDistanceToSegment(pixelCoordinate, a) -\n squaredDistanceToSegment(pixelCoordinate, b)\n );\n };\n const extent = this.getExtentInternal();\n if (extent) {\n //convert extents to line segments and find the segment closest to pixelCoordinate\n const segments = getSegments(extent);\n segments.sort(sortByDistance);\n const closestSegment = segments[0];\n\n let vertex = closestOnSegment(pixelCoordinate, closestSegment);\n const vertexPixel = map.getPixelFromCoordinateInternal(vertex);\n\n //if the distance is within tolerance, snap to the segment\n if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {\n //test if we should further snap to a vertex\n const pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];\n }\n return vertex;\n }\n }\n return null;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent pointer move event\n * @private\n */\n handlePointerMove_(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n let vertex = this.snapToVertex_(pixel, map);\n if (!vertex) {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n }\n this.createOrUpdatePointerFeature_(vertex);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @return {Feature} extent as featrue\n * @private\n */\n createOrUpdateExtentFeature_(extent) {\n let extentFeature = this.extentFeature_;\n\n if (!extentFeature) {\n if (!extent) {\n extentFeature = new Feature({});\n } else {\n extentFeature = new Feature(polygonFromExtent(extent));\n }\n this.extentFeature_ = extentFeature;\n this.extentOverlay_.getSource().addFeature(extentFeature);\n } else {\n if (!extent) {\n extentFeature.setGeometry(undefined);\n } else {\n extentFeature.setGeometry(polygonFromExtent(extent));\n }\n }\n return extentFeature;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} vertex location of feature\n * @return {Feature} vertex as feature\n * @private\n */\n createOrUpdatePointerFeature_(vertex) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(vertex));\n this.vertexFeature_ = vertexFeature;\n this.vertexOverlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(vertex);\n }\n return vertexFeature;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) {\n return true;\n }\n //display pointer (if not dragging)\n if (\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n //call pointer to determine up/down/drag\n super.handleEvent(mapBrowserEvent);\n //return false to stop propagation\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n const extent = this.getExtentInternal();\n let vertex = this.snapToVertex_(pixel, map);\n\n //find the extent corner opposite the passed corner\n const getOpposingPoint = function (point) {\n let x_ = null;\n let y_ = null;\n if (point[0] == extent[0]) {\n x_ = extent[2];\n } else if (point[0] == extent[2]) {\n x_ = extent[0];\n }\n if (point[1] == extent[1]) {\n y_ = extent[3];\n } else if (point[1] == extent[3]) {\n y_ = extent[1];\n }\n if (x_ !== null && y_ !== null) {\n return [x_, y_];\n }\n return null;\n };\n if (vertex && extent) {\n const x =\n vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null;\n const y =\n vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null;\n\n //snap to point\n if (x !== null && y !== null) {\n this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));\n //snap to edge\n } else if (x !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([x, extent[1]]),\n getOpposingPoint([x, extent[3]]),\n );\n } else if (y !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([extent[0], y]),\n getOpposingPoint([extent[2], y]),\n );\n }\n //no snap - new bbox\n } else {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);\n this.pointerHandler_ = getPointHandler(vertex);\n }\n return true; //event handled; start downup sequence\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (this.pointerHandler_) {\n const pixelCoordinate = mapBrowserEvent.coordinate;\n this.setExtent(this.pointerHandler_(pixelCoordinate));\n this.createOrUpdatePointerFeature_(pixelCoordinate);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n this.pointerHandler_ = null;\n //If bbox is zero area, set to null;\n const extent = this.getExtentInternal();\n if (!extent || getArea(extent) === 0) {\n this.setExtent(null);\n }\n return false; //Stop handling downup sequence\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.extentOverlay_.setMap(map);\n this.vertexOverlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Returns the current drawn extent in the view projection (or user projection if set)\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtent() {\n return toUserExtent(\n this.getExtentInternal(),\n this.getMap().getView().getProjection(),\n );\n }\n\n /**\n * Returns the current drawn extent in the view projection\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtentInternal() {\n return this.extent_;\n }\n\n /**\n * Manually sets the drawn extent, using the view projection.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent\n * @api\n */\n setExtent(extent) {\n //Null extent means no bbox\n this.extent_ = extent ? extent : null;\n this.createOrUpdateExtentFeature_(extent);\n this.dispatchEvent(new ExtentEvent(this.extent_));\n }\n}\n\n/**\n * Returns the default style for the drawn bbox\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default Extent style\n */\nfunction getDefaultExtentStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Polygon'];\n };\n}\n\n/**\n * Returns the default style for the pointer\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default pointer style\n */\nfunction getDefaultPointerStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Point'];\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedPoint corner that will be unchanged in the new extent\n * @return {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent} event handler\n */\nfunction getPointHandler(fixedPoint) {\n return function (point) {\n return boundingExtent([fixedPoint, point]);\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedP1 first corner that will be unchanged in the new extent\n * @param {import(\"../coordinate.js\").Coordinate} fixedP2 second corner that will be unchanged in the new extent\n * @return {PointerHandler|null} event handler\n */\nfunction getEdgeHandler(fixedP1, fixedP2) {\n if (fixedP1[0] == fixedP2[0]) {\n return function (point) {\n return boundingExtent([fixedP1, [point[0], fixedP2[1]]]);\n };\n }\n if (fixedP1[1] == fixedP2[1]) {\n return function (point) {\n return boundingExtent([fixedP1, [fixedP2[0], point[1]]]);\n };\n }\n return null;\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} extent line segments\n */\nfunction getSegments(extent) {\n return [\n [\n [extent[0], extent[1]],\n [extent[0], extent[3]],\n ],\n [\n [extent[0], extent[3]],\n [extent[2], extent[3]],\n ],\n [\n [extent[2], extent[3]],\n [extent[2], extent[1]],\n ],\n [\n [extent[2], extent[1]],\n [extent[0], extent[1]],\n ],\n ];\n}\n\nexport default Extent;\n"],"names":[],"sourceRoot":""}