@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,285 @@
1
+ (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["node_modules_ol_interaction_DblClickDragZoom_js"],{
2
+
3
+ /***/ "./node_modules/ol/interaction/DblClickDragZoom.js":
4
+ /*!*********************************************************!*\
5
+ !*** ./node_modules/ol/interaction/DblClickDragZoom.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 */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
12
+ /* harmony export */ });
13
+ /* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
14
+ /* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
15
+ /**
16
+ * @module ol/interaction/DblClickDragZoom
17
+ */
18
+
19
+
20
+
21
+ /**
22
+ * @typedef {Object} Options
23
+ * @property {number} [duration=400] Animation duration in milliseconds. *
24
+ * @property {number} [delta=1] The zoom delta applied on move of one pixel. *
25
+ * @property {function(boolean):boolean} [stopDown]
26
+ * Should the down event be propagated to other interactions, or should be
27
+ * stopped?
28
+ */
29
+
30
+ /**
31
+ * @classdesc
32
+ * Allows the user to zoom the map by double tap/click then drag up/down
33
+ * with one finger/left mouse.
34
+ * @api
35
+ */
36
+ class DblClickDragZoom extends _Interaction_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
37
+ /**
38
+ * @param {Options} [opt_options] Options.
39
+ */
40
+ constructor(opt_options) {
41
+ const options = opt_options ? opt_options : {};
42
+
43
+ super(
44
+ /** @type {import("./Interaction.js").InteractionOptions} */ (options),
45
+ );
46
+
47
+ if (options.stopDown) {
48
+ this.stopDown = options.stopDown;
49
+ }
50
+
51
+ /**
52
+ * @private
53
+ * @type {number}
54
+ */
55
+ this.scaleDeltaByPixel_ = options.delta ? options.delta : 0.01;
56
+
57
+ /**
58
+ * @private
59
+ * @type {number}
60
+ */
61
+ this.duration_ = options.duration !== undefined ? options.duration : 250;
62
+
63
+ /**
64
+ * @type {boolean}
65
+ * @private
66
+ */
67
+ this.handlingDownUpSequence_ = false;
68
+
69
+ /**
70
+ * @type {boolean}
71
+ * @private
72
+ */
73
+ this.handlingDoubleDownSequence_ = false;
74
+
75
+ /**
76
+ * @type {ReturnType<typeof setTimeout>}
77
+ * @private
78
+ */
79
+ this.doubleTapTimeoutId_ = undefined;
80
+
81
+ /**
82
+ * @type {!Object<string, PointerEvent>}
83
+ * @private
84
+ */
85
+ this.trackedPointers_ = {};
86
+
87
+ /**
88
+ * @type {PointerEvent|null}
89
+ * @private
90
+ */
91
+ this.down_ = null;
92
+
93
+ /**
94
+ * @type {Array<PointerEvent>}
95
+ * @protected
96
+ */
97
+ this.targetPointers = [];
98
+ }
99
+
100
+ /**
101
+ * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into
102
+ * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
103
+ * detected.
104
+ * @param {import("../MapBrowserEvent.js").default<PointerEvent>} mapBrowserEvent Map browser event.
105
+ * @return {boolean} `false` to stop event propagation.
106
+ * @api
107
+ * @override
108
+ */
109
+ handleEvent(mapBrowserEvent) {
110
+ if (!mapBrowserEvent.originalEvent) {
111
+ return true;
112
+ }
113
+
114
+ let stopEvent = false;
115
+ this.updateTrackedPointers_(mapBrowserEvent);
116
+ if (this.handlingDownUpSequence_) {
117
+ if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERDRAG) {
118
+ this.handleDragEvent(mapBrowserEvent);
119
+ // prevent page scrolling during dragging
120
+ mapBrowserEvent.originalEvent.preventDefault();
121
+ } else if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERUP) {
122
+ const handledUp = this.handleUpEvent(mapBrowserEvent);
123
+ this.handlingDownUpSequence_ = handledUp;
124
+ }
125
+ } else {
126
+ if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERDOWN) {
127
+ if (this.handlingDoubleDownSequence_) {
128
+ this.handlingDoubleDownSequence_ = false;
129
+ const handled = this.handleDownEvent(mapBrowserEvent);
130
+ this.handlingDownUpSequence_ = handled;
131
+ stopEvent = this.stopDown(handled);
132
+ } else {
133
+ stopEvent = this.stopDown(false);
134
+ this.waitForDblTap_();
135
+ }
136
+ }
137
+ }
138
+ return !stopEvent;
139
+ }
140
+
141
+ /**
142
+ * Handle pointer drag events.
143
+ * @param {import("../MapBrowserEvent.js").default<PointerEvent>} mapBrowserEvent Event.
144
+ */
145
+ handleDragEvent(mapBrowserEvent) {
146
+ let scaleDelta = 1.0;
147
+
148
+ const touch0 = this.targetPointers[0];
149
+ const touch1 = this.down_;
150
+ const distance = touch0.clientY - touch1.clientY;
151
+
152
+ if (this.lastDistance_ !== undefined) {
153
+ scaleDelta =
154
+ 1 - (this.lastDistance_ - distance) * this.scaleDeltaByPixel_;
155
+ }
156
+ this.lastDistance_ = distance;
157
+
158
+ if (scaleDelta != 1.0) {
159
+ this.lastScaleDelta_ = scaleDelta;
160
+ }
161
+
162
+ // scale, bypass the resolution constraint
163
+ const map = mapBrowserEvent.map;
164
+ const view = map.getView();
165
+ map.render();
166
+ view.adjustResolutionInternal(scaleDelta);
167
+ }
168
+
169
+ /**
170
+ * Handle pointer down events.
171
+ * @param {import("../MapBrowserEvent.js").default<PointerEvent>} mapBrowserEvent Event.
172
+ * @return {boolean} If the event was consumed.
173
+ */
174
+ handleDownEvent(mapBrowserEvent) {
175
+ if (this.targetPointers.length == 1) {
176
+ const map = mapBrowserEvent.map;
177
+ this.anchor_ = null;
178
+ this.lastDistance_ = undefined;
179
+ this.lastScaleDelta_ = 1;
180
+ this.down_ = mapBrowserEvent.originalEvent;
181
+ if (!this.handlingDownUpSequence_) {
182
+ map.getView().beginInteraction();
183
+ }
184
+ return true;
185
+ }
186
+ return false;
187
+ }
188
+
189
+ /**
190
+ * Handle pointer up events zooming out.
191
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
192
+ * @return {boolean} If the event was consumed.
193
+ */
194
+ handleUpEvent(mapBrowserEvent) {
195
+ if (this.targetPointers.length == 0) {
196
+ const map = mapBrowserEvent.map;
197
+ const view = map.getView();
198
+ const direction = this.lastScaleDelta_ > 1 ? 1 : -1;
199
+ view.endInteraction(this.duration_, direction);
200
+ this.handlingDownUpSequence_ = false;
201
+ this.handlingDoubleDownSequence_ = false;
202
+ return false;
203
+ }
204
+ return true;
205
+ }
206
+
207
+ /**
208
+ * This function is used to determine if "down" events should be propagated
209
+ * to other interactions or should be stopped.
210
+ * @param {boolean} handled Was the event handled by the interaction?
211
+ * @return {boolean} Should the `down` event be stopped?
212
+ */
213
+ stopDown(handled) {
214
+ return handled;
215
+ }
216
+
217
+ /**
218
+ * @param {import("../MapBrowserEvent.js").default<PointerEvent>} mapBrowserEvent Event.
219
+ * @private
220
+ */
221
+ updateTrackedPointers_(mapBrowserEvent) {
222
+ if (isPointerDraggingEvent(mapBrowserEvent)) {
223
+ const event = mapBrowserEvent.originalEvent;
224
+
225
+ const id = event.pointerId.toString();
226
+ if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERUP) {
227
+ delete this.trackedPointers_[id];
228
+ } else if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERDOWN) {
229
+ this.trackedPointers_[id] = event;
230
+ } else if (id in this.trackedPointers_) {
231
+ // update only when there was a pointerdown event for this pointer
232
+ this.trackedPointers_[id] = event;
233
+ }
234
+ this.targetPointers = Object.values(this.trackedPointers_);
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Wait the second double finger tap.
240
+ * @private
241
+ */
242
+ waitForDblTap_() {
243
+ if (this.doubleTapTimeoutId_ !== undefined) {
244
+ // double-click
245
+ clearTimeout(this.doubleTapTimeoutId_);
246
+ this.doubleTapTimeoutId_ = undefined;
247
+ } else {
248
+ this.handlingDoubleDownSequence_ = true;
249
+ this.doubleTapTimeoutId_ = setTimeout(
250
+ this.endInteraction_.bind(this),
251
+ 250,
252
+ );
253
+ }
254
+ }
255
+
256
+ /**
257
+ * @private
258
+ */
259
+ endInteraction_() {
260
+ this.handlingDoubleDownSequence_ = false;
261
+ this.doubleTapTimeoutId_ = undefined;
262
+ }
263
+ }
264
+
265
+ /**
266
+ * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
267
+ * @return {boolean} Whether the event is a pointerdown, pointerdrag
268
+ * or pointerup event.
269
+ */
270
+ function isPointerDraggingEvent(mapBrowserEvent) {
271
+ const type = mapBrowserEvent.type;
272
+ return (
273
+ type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERDOWN ||
274
+ type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERDRAG ||
275
+ type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERUP
276
+ );
277
+ }
278
+
279
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DblClickDragZoom);
280
+
281
+
282
+ /***/ })
283
+
284
+ }])
285
+ //# sourceMappingURL=node_modules_ol_interaction_DblClickDragZoom_js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node_modules_ol_interaction_DblClickDragZoom_js.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AAC4D;AACjB;;AAE3C;AACA,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,2BAA2B;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,uDAAW;AAC1C;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA,iBAAiB,+CAA+C;AAChE;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,oEAAoE;AACtF;AACA;AACA,aAAa,uDAAuD;AACpE,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,2EAA+B;AACjE;AACA;AACA;AACA,QAAQ,iCAAiC,yEAA6B;AACtE;AACA;AACA;AACA,MAAM;AACN,kCAAkC,2EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uDAAuD;AACpE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uDAAuD;AACpE,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA,aAAa,uDAAuD;AACpE;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,yEAA6B;AAC/D;AACA,QAAQ,iCAAiC,2EAA+B;AACxE;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,yCAAyC;AACpD,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa,2EAA+B;AAC5C,aAAa,2EAA+B;AAC5C,aAAa,yEAA6B;AAC1C;AACA;;AAEA,iEAAe,gBAAgB,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/interaction/DblClickDragZoom.js"],"sourcesContent":["/**\n * @module ol/interaction/DblClickDragZoom\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds. *\n * @property {number} [delta=1] The zoom delta applied on move of one pixel. *\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by double tap/click then drag up/down\n * with one finger/left mouse.\n * @api\n */\nclass DblClickDragZoom extends Interaction {\n /**\n * @param {Options} [opt_options] Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @private\n * @type {number}\n */\n this.scaleDeltaByPixel_ = options.delta ? options.delta : 0.01;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.handlingDownUpSequence_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.handlingDoubleDownSequence_ = false;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.doubleTapTimeoutId_ = undefined;\n\n /**\n * @type {!Object<string, PointerEvent>}\n * @private\n */\n this.trackedPointers_ = {};\n\n /**\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n /**\n * @type {Array<PointerEvent>}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence_) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.originalEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence_ = handledUp;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n if (this.handlingDoubleDownSequence_) {\n this.handlingDoubleDownSequence_ = false;\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence_ = handled;\n stopEvent = this.stopDown(handled);\n } else {\n stopEvent = this.stopDown(false);\n this.waitForDblTap_();\n }\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.down_;\n const distance = touch0.clientY - touch1.clientY;\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta =\n 1 - (this.lastDistance_ - distance) * this.scaleDeltaByPixel_;\n }\n this.lastDistance_ = distance;\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale, bypass the resolution constraint\n const map = mapBrowserEvent.map;\n const view = map.getView();\n map.render();\n view.adjustResolutionInternal(scaleDelta);\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length == 1) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n this.down_ = mapBrowserEvent.originalEvent;\n if (!this.handlingDownUpSequence_) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer up events zooming out.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length == 0) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n this.handlingDownUpSequence_ = false;\n this.handlingDoubleDownSequence_ = false;\n return false;\n }\n return true;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (isPointerDraggingEvent(mapBrowserEvent)) {\n const event = mapBrowserEvent.originalEvent;\n\n const id = event.pointerId.toString();\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n delete this.trackedPointers_[id];\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n this.trackedPointers_[id] = event;\n } else if (id in this.trackedPointers_) {\n // update only when there was a pointerdown event for this pointer\n this.trackedPointers_[id] = event;\n }\n this.targetPointers = Object.values(this.trackedPointers_);\n }\n }\n\n /**\n * Wait the second double finger tap.\n * @private\n */\n waitForDblTap_() {\n if (this.doubleTapTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.doubleTapTimeoutId_);\n this.doubleTapTimeoutId_ = undefined;\n } else {\n this.handlingDoubleDownSequence_ = true;\n this.doubleTapTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n 250,\n );\n }\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.handlingDoubleDownSequence_ = false;\n this.doubleTapTimeoutId_ = undefined;\n }\n}\n\n/**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} Whether the event is a pointerdown, pointerdrag\n * or pointerup event.\n */\nfunction isPointerDraggingEvent(mapBrowserEvent) {\n const type = mapBrowserEvent.type;\n return (\n type === MapBrowserEventType.POINTERDOWN ||\n type === MapBrowserEventType.POINTERDRAG ||\n type === MapBrowserEventType.POINTERUP\n );\n}\n\nexport default DblClickDragZoom;\n"],"names":[],"sourceRoot":""}
@@ -0,0 +1,351 @@
1
+ (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["node_modules_ol_interaction_DragAndDrop_js"],{
2
+
3
+ /***/ "./node_modules/ol/interaction/DragAndDrop.js":
4
+ /*!****************************************************!*\
5
+ !*** ./node_modules/ol/interaction/DragAndDrop.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 */ "DragAndDropEvent": () => (/* binding */ DragAndDropEvent),
12
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13
+ /* harmony export */ });
14
+ /* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
15
+ /* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
16
+ /* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
17
+ /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
18
+ /* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
19
+ /* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
20
+ /**
21
+ * @module ol/interaction/DragAndDrop
22
+ */
23
+ // FIXME should handle all geo-referenced data, not just vector data
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+ /**
33
+ * @typedef {Object} Options
34
+ * @property {Array<typeof import("../format/Feature.js").default|import("../format/Feature.js").default>} [formatConstructors] Format constructors
35
+ * (and/or formats pre-constructed with options).
36
+ * @property {import("../source/Vector.js").default} [source] Optional vector source where features will be added. If a source is provided
37
+ * all existing features will be removed and new features will be added when
38
+ * they are dropped on the target. If you want to add features to a vector
39
+ * source without removing the existing features (append only), instead of
40
+ * providing the source option listen for the "addfeatures" event.
41
+ * @property {import("../proj.js").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.
42
+ * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.
43
+ */
44
+
45
+ /**
46
+ * @enum {string}
47
+ */
48
+ const DragAndDropEventType = {
49
+ /**
50
+ * Triggered when features are added
51
+ * @event DragAndDropEvent#addfeatures
52
+ * @api
53
+ */
54
+ ADD_FEATURES: 'addfeatures',
55
+ };
56
+
57
+ /**
58
+ * @classdesc
59
+ * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances
60
+ * of this type.
61
+ */
62
+ class DragAndDropEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
63
+ /**
64
+ * @param {DragAndDropEventType} type Type.
65
+ * @param {File} file File.
66
+ * @param {Array<import("../Feature.js").default>} [features] Features.
67
+ * @param {import("../proj/Projection.js").default} [projection] Projection.
68
+ */
69
+ constructor(type, file, features, projection) {
70
+ super(type);
71
+
72
+ /**
73
+ * The features parsed from dropped data.
74
+ * @type {Array<import("../Feature.js").FeatureLike>|undefined}
75
+ * @api
76
+ */
77
+ this.features = features;
78
+
79
+ /**
80
+ * The dropped file.
81
+ * @type {File}
82
+ * @api
83
+ */
84
+ this.file = file;
85
+
86
+ /**
87
+ * The feature projection.
88
+ * @type {import("../proj/Projection.js").default|undefined}
89
+ * @api
90
+ */
91
+ this.projection = projection;
92
+ }
93
+ }
94
+
95
+ /***
96
+ * @template Return
97
+ * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
98
+ * import("../Observable").OnSignature<import("../ObjectEventType").Types|
99
+ * 'change:active', import("../Object").ObjectEvent, Return> &
100
+ * import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> &
101
+ * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
102
+ * 'change:active'|'addfeatures', Return>} DragAndDropOnSignature
103
+ */
104
+
105
+ /**
106
+ * @classdesc
107
+ * Handles input of vector data by drag and drop.
108
+ *
109
+ * @api
110
+ *
111
+ * @fires DragAndDropEvent
112
+ */
113
+ class DragAndDrop extends _Interaction_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
114
+ /**
115
+ * @param {Options} [options] Options.
116
+ */
117
+ constructor(options) {
118
+ options = options ? options : {};
119
+
120
+ super({
121
+ handleEvent: _functions_js__WEBPACK_IMPORTED_MODULE_3__.TRUE,
122
+ });
123
+
124
+ /***
125
+ * @type {DragAndDropOnSignature<import("../events").EventsKey>}
126
+ */
127
+ this.on;
128
+
129
+ /***
130
+ * @type {DragAndDropOnSignature<import("../events").EventsKey>}
131
+ */
132
+ this.once;
133
+
134
+ /***
135
+ * @type {DragAndDropOnSignature<void>}
136
+ */
137
+ this.un;
138
+
139
+ /**
140
+ * @private
141
+ * @type {boolean}
142
+ */
143
+ this.readAsBuffer_ = false;
144
+
145
+ /**
146
+ * @private
147
+ * @type {Array<import("../format/Feature.js").default>}
148
+ */
149
+ this.formats_ = [];
150
+ const formatConstructors = options.formatConstructors
151
+ ? options.formatConstructors
152
+ : [];
153
+ for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {
154
+ let format = formatConstructors[i];
155
+ if (typeof format === 'function') {
156
+ format = new format();
157
+ }
158
+ this.formats_.push(format);
159
+ this.readAsBuffer_ =
160
+ this.readAsBuffer_ || format.getType() === 'arraybuffer';
161
+ }
162
+
163
+ /**
164
+ * @private
165
+ * @type {import("../proj/Projection.js").default}
166
+ */
167
+ this.projection_ = options.projection
168
+ ? (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.get)(options.projection)
169
+ : null;
170
+
171
+ /**
172
+ * @private
173
+ * @type {?Array<import("../events.js").EventsKey>}
174
+ */
175
+ this.dropListenKeys_ = null;
176
+
177
+ /**
178
+ * @private
179
+ * @type {import("../source/Vector.js").default}
180
+ */
181
+ this.source_ = options.source || null;
182
+
183
+ /**
184
+ * @private
185
+ * @type {HTMLElement|null}
186
+ */
187
+ this.target = options.target ? options.target : null;
188
+ }
189
+
190
+ /**
191
+ * @param {File} file File.
192
+ * @param {Event} event Load event.
193
+ * @private
194
+ */
195
+ handleResult_(file, event) {
196
+ const result = event.target.result;
197
+ const map = this.getMap();
198
+ let projection = this.projection_;
199
+ if (!projection) {
200
+ projection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
201
+ if (!projection) {
202
+ const view = map.getView();
203
+ projection = view.getProjection();
204
+ }
205
+ }
206
+
207
+ let text;
208
+ const formats = this.formats_;
209
+ for (let i = 0, ii = formats.length; i < ii; ++i) {
210
+ const format = formats[i];
211
+ let input = result;
212
+ if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {
213
+ if (text === undefined) {
214
+ text = new TextDecoder().decode(result);
215
+ }
216
+ input = text;
217
+ }
218
+ const features = this.tryReadFeatures_(format, input, {
219
+ featureProjection: projection,
220
+ });
221
+ if (features && features.length > 0) {
222
+ if (this.source_) {
223
+ this.source_.clear();
224
+ this.source_.addFeatures(features);
225
+ }
226
+ this.dispatchEvent(
227
+ new DragAndDropEvent(
228
+ DragAndDropEventType.ADD_FEATURES,
229
+ file,
230
+ features,
231
+ projection,
232
+ ),
233
+ );
234
+ break;
235
+ }
236
+ }
237
+ }
238
+
239
+ /**
240
+ * @private
241
+ */
242
+ registerListeners_() {
243
+ const map = this.getMap();
244
+ if (map) {
245
+ const dropArea = this.target ? this.target : map.getViewport();
246
+ this.dropListenKeys_ = [
247
+ (0,_events_js__WEBPACK_IMPORTED_MODULE_4__.listen)(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].DROP, this.handleDrop, this),
248
+ (0,_events_js__WEBPACK_IMPORTED_MODULE_4__.listen)(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAGENTER, this.handleStop, this),
249
+ (0,_events_js__WEBPACK_IMPORTED_MODULE_4__.listen)(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].DRAGOVER, this.handleStop, this),
250
+ (0,_events_js__WEBPACK_IMPORTED_MODULE_4__.listen)(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].DROP, this.handleStop, this),
251
+ ];
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Activate or deactivate the interaction.
257
+ * @param {boolean} active Active.
258
+ * @observable
259
+ * @api
260
+ * @override
261
+ */
262
+ setActive(active) {
263
+ if (!this.getActive() && active) {
264
+ this.registerListeners_();
265
+ }
266
+ if (this.getActive() && !active) {
267
+ this.unregisterListeners_();
268
+ }
269
+ super.setActive(active);
270
+ }
271
+
272
+ /**
273
+ * Remove the interaction from its current map and attach it to the new map.
274
+ * Subclasses may set up event handlers to get notified about changes to
275
+ * the map here.
276
+ * @param {import("../Map.js").default} map Map.
277
+ * @override
278
+ */
279
+ setMap(map) {
280
+ this.unregisterListeners_();
281
+ super.setMap(map);
282
+ if (this.getActive()) {
283
+ this.registerListeners_();
284
+ }
285
+ }
286
+
287
+ /**
288
+ * @param {import("../format/Feature.js").default} format Format.
289
+ * @param {string} text Text.
290
+ * @param {import("../format/Feature.js").ReadOptions} options Read options.
291
+ * @private
292
+ * @return {Array<import("../Feature.js").default>} Features.
293
+ */
294
+ tryReadFeatures_(format, text, options) {
295
+ try {
296
+ return (
297
+ /** @type {Array<import("../Feature.js").default>} */
298
+ (format.readFeatures(text, options))
299
+ );
300
+ } catch {
301
+ return null;
302
+ }
303
+ }
304
+
305
+ /**
306
+ * @private
307
+ */
308
+ unregisterListeners_() {
309
+ if (this.dropListenKeys_) {
310
+ this.dropListenKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_4__.unlistenByKey);
311
+ this.dropListenKeys_ = null;
312
+ }
313
+ }
314
+
315
+ /**
316
+ * @param {DragEvent} event Event.
317
+ */
318
+ handleDrop(event) {
319
+ const files = event.dataTransfer.files;
320
+ for (let i = 0, ii = files.length; i < ii; ++i) {
321
+ const file = files.item(i);
322
+ const reader = new FileReader();
323
+ reader.addEventListener(
324
+ _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].LOAD,
325
+ this.handleResult_.bind(this, file),
326
+ );
327
+ if (this.readAsBuffer_) {
328
+ reader.readAsArrayBuffer(file);
329
+ } else {
330
+ reader.readAsText(file);
331
+ }
332
+ }
333
+ }
334
+
335
+ /**
336
+ * @param {DragEvent} event Event.
337
+ */
338
+ handleStop(event) {
339
+ event.stopPropagation();
340
+ event.preventDefault();
341
+ event.dataTransfer.dropEffect = 'copy';
342
+ }
343
+ }
344
+
345
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DragAndDrop);
346
+
347
+
348
+ /***/ })
349
+
350
+ }])
351
+ //# sourceMappingURL=node_modules_ol_interaction_DragAndDrop_js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node_modules_ol_interaction_DragAndDrop_js.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEuC;AACQ;AACI;AACd;AAC8B;AACxB;;AAE3C;AACA,aAAa,QAAQ;AACrB,cAAc,6FAA6F;AAC3G;AACA,cAAc,uCAAuC;AACrD;AACA;AACA;AACA;AACA,cAAc,qCAAqC;AACnD,cAAc,aAAa;AAC3B;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,qDAAqD;AAC3E;AACA;AACO,+BAA+B,wDAAK;AAC3C;AACA,aAAa,sBAAsB;AACnC,aAAa,MAAM;AACnB,aAAa,wCAAwC;AACrD,aAAa,yCAAyC;AACtD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAW;AACrC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA,mBAAmB,+CAAI;AACvB,KAAK;;AAEL;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,QAAQ,6CAAa;AACrB;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAiB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kDAAM,WAAW,iEAAc;AACvC,QAAQ,kDAAM,WAAW,sEAAmB;AAC5C,QAAQ,kDAAM,WAAW,qEAAkB;AAC3C,QAAQ,kDAAM,WAAW,iEAAc;AACvC;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB,aAAa,4CAA4C;AACzD;AACA,cAAc,wCAAwC;AACtD;AACA;AACA;AACA;AACA,mBAAmB,wCAAwC;AAC3D;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,qDAAa;AAChD;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA,QAAQ,iEAAc;AACtB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/interaction/DragAndDrop.js"],"sourcesContent":["/**\n * @module ol/interaction/DragAndDrop\n */\n// FIXME should handle all geo-referenced data, not just vector data\n\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {TRUE} from '../functions.js';\nimport {get as getProjection, getUserProjection} from '../proj.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<typeof import(\"../format/Feature.js\").default|import(\"../format/Feature.js\").default>} [formatConstructors] Format constructors\n * (and/or formats pre-constructed with options).\n * @property {import(\"../source/Vector.js\").default} [source] Optional vector source where features will be added. If a source is provided\n * all existing features will be removed and new features will be added when\n * they are dropped on the target. If you want to add features to a vector\n * source without removing the existing features (append only), instead of\n * providing the source option listen for the \"addfeatures\" event.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.\n * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.\n */\n\n/**\n * @enum {string}\n */\nconst DragAndDropEventType = {\n /**\n * Triggered when features are added\n * @event DragAndDropEvent#addfeatures\n * @api\n */\n ADD_FEATURES: 'addfeatures',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances\n * of this type.\n */\nexport class DragAndDropEvent extends Event {\n /**\n * @param {DragAndDropEventType} type Type.\n * @param {File} file File.\n * @param {Array<import(\"../Feature.js\").default>} [features] Features.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n */\n constructor(type, file, features, projection) {\n super(type);\n\n /**\n * The features parsed from dropped data.\n * @type {Array<import(\"../Feature.js\").FeatureLike>|undefined}\n * @api\n */\n this.features = features;\n\n /**\n * The dropped file.\n * @type {File}\n * @api\n */\n this.file = file;\n\n /**\n * The feature projection.\n * @type {import(\"../proj/Projection.js\").default|undefined}\n * @api\n */\n this.projection = projection;\n }\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<'addfeatures', DragAndDropEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'addfeatures', Return>} DragAndDropOnSignature\n */\n\n/**\n * @classdesc\n * Handles input of vector data by drag and drop.\n *\n * @api\n *\n * @fires DragAndDropEvent\n */\nclass DragAndDrop extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n handleEvent: TRUE,\n });\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DragAndDropOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.readAsBuffer_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../format/Feature.js\").default>}\n */\n this.formats_ = [];\n const formatConstructors = options.formatConstructors\n ? options.formatConstructors\n : [];\n for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {\n let format = formatConstructors[i];\n if (typeof format === 'function') {\n format = new format();\n }\n this.formats_.push(format);\n this.readAsBuffer_ =\n this.readAsBuffer_ || format.getType() === 'arraybuffer';\n }\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = options.projection\n ? getProjection(options.projection)\n : null;\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.dropListenKeys_ = null;\n\n /**\n * @private\n * @type {import(\"../source/Vector.js\").default}\n */\n this.source_ = options.source || null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.target = options.target ? options.target : null;\n }\n\n /**\n * @param {File} file File.\n * @param {Event} event Load event.\n * @private\n */\n handleResult_(file, event) {\n const result = event.target.result;\n const map = this.getMap();\n let projection = this.projection_;\n if (!projection) {\n projection = getUserProjection();\n if (!projection) {\n const view = map.getView();\n projection = view.getProjection();\n }\n }\n\n let text;\n const formats = this.formats_;\n for (let i = 0, ii = formats.length; i < ii; ++i) {\n const format = formats[i];\n let input = result;\n if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {\n if (text === undefined) {\n text = new TextDecoder().decode(result);\n }\n input = text;\n }\n const features = this.tryReadFeatures_(format, input, {\n featureProjection: projection,\n });\n if (features && features.length > 0) {\n if (this.source_) {\n this.source_.clear();\n this.source_.addFeatures(features);\n }\n this.dispatchEvent(\n new DragAndDropEvent(\n DragAndDropEventType.ADD_FEATURES,\n file,\n features,\n projection,\n ),\n );\n break;\n }\n }\n }\n\n /**\n * @private\n */\n registerListeners_() {\n const map = this.getMap();\n if (map) {\n const dropArea = this.target ? this.target : map.getViewport();\n this.dropListenKeys_ = [\n listen(dropArea, EventType.DROP, this.handleDrop, this),\n listen(dropArea, EventType.DRAGENTER, this.handleStop, this),\n listen(dropArea, EventType.DRAGOVER, this.handleStop, this),\n listen(dropArea, EventType.DROP, this.handleStop, this),\n ];\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!this.getActive() && active) {\n this.registerListeners_();\n }\n if (this.getActive() && !active) {\n this.unregisterListeners_();\n }\n super.setActive(active);\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.unregisterListeners_();\n super.setMap(map);\n if (this.getActive()) {\n this.registerListeners_();\n }\n }\n\n /**\n * @param {import(\"../format/Feature.js\").default} format Format.\n * @param {string} text Text.\n * @param {import(\"../format/Feature.js\").ReadOptions} options Read options.\n * @private\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n tryReadFeatures_(format, text, options) {\n try {\n return (\n /** @type {Array<import(\"../Feature.js\").default>} */\n (format.readFeatures(text, options))\n );\n } catch {\n return null;\n }\n }\n\n /**\n * @private\n */\n unregisterListeners_() {\n if (this.dropListenKeys_) {\n this.dropListenKeys_.forEach(unlistenByKey);\n this.dropListenKeys_ = null;\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleDrop(event) {\n const files = event.dataTransfer.files;\n for (let i = 0, ii = files.length; i < ii; ++i) {\n const file = files.item(i);\n const reader = new FileReader();\n reader.addEventListener(\n EventType.LOAD,\n this.handleResult_.bind(this, file),\n );\n if (this.readAsBuffer_) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsText(file);\n }\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleStop(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n}\n\nexport default DragAndDrop;\n"],"names":[],"sourceRoot":""}