ol 10.7.1 → 10.7.2

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 (268) hide show
  1. package/Collection.d.ts +1 -3
  2. package/Collection.d.ts.map +1 -1
  3. package/Feature.d.ts +6 -15
  4. package/Feature.d.ts.map +1 -1
  5. package/Feature.js +3 -6
  6. package/Geolocation.d.ts +1 -3
  7. package/Geolocation.d.ts.map +1 -1
  8. package/ImageTile.d.ts +2 -12
  9. package/ImageTile.d.ts.map +1 -1
  10. package/ImageTile.js +5 -32
  11. package/Map.d.ts +7 -27
  12. package/Map.d.ts.map +1 -1
  13. package/Map.js +3 -29
  14. package/Object.d.ts +18 -15
  15. package/Object.d.ts.map +1 -1
  16. package/Object.js +6 -9
  17. package/Overlay.d.ts +1 -3
  18. package/Overlay.d.ts.map +1 -1
  19. package/VectorRenderTile.d.ts +0 -4
  20. package/VectorRenderTile.d.ts.map +1 -1
  21. package/VectorRenderTile.js +0 -2
  22. package/View.d.ts +1 -40
  23. package/View.d.ts.map +1 -1
  24. package/View.js +0 -94
  25. package/colorlike.js +8 -4
  26. package/control/Control.d.ts +1 -3
  27. package/control/Control.d.ts.map +1 -1
  28. package/control/OverviewMap.d.ts +1 -5
  29. package/control/OverviewMap.d.ts.map +1 -1
  30. package/coordinate.d.ts +0 -8
  31. package/coordinate.d.ts.map +1 -1
  32. package/coordinate.js +1 -31
  33. package/dist/ol.d.ts +0 -24
  34. package/dist/ol.d.ts.map +1 -1
  35. package/dist/ol.js +1 -1
  36. package/dist/ol.js.map +1 -1
  37. package/dom.d.ts +0 -15
  38. package/dom.d.ts.map +1 -1
  39. package/dom.js +0 -6
  40. package/featureloader.d.ts +2 -6
  41. package/featureloader.d.ts.map +1 -1
  42. package/format/EsriJSON.d.ts +1 -3
  43. package/format/EsriJSON.d.ts.map +1 -1
  44. package/format/Feature.d.ts +1 -3
  45. package/format/Feature.d.ts.map +1 -1
  46. package/format/GeoJSON.d.ts +2 -6
  47. package/format/GeoJSON.d.ts.map +1 -1
  48. package/format/JSONFeature.d.ts +1 -3
  49. package/format/JSONFeature.d.ts.map +1 -1
  50. package/format/KML.d.ts +0 -9
  51. package/format/KML.d.ts.map +1 -1
  52. package/format/KML.js +0 -7
  53. package/format/TextFeature.d.ts +1 -3
  54. package/format/TextFeature.d.ts.map +1 -1
  55. package/format/TopoJSON.d.ts +1 -3
  56. package/format/TopoJSON.d.ts.map +1 -1
  57. package/format/WKB.d.ts +1 -3
  58. package/format/WKB.d.ts.map +1 -1
  59. package/format/XMLFeature.d.ts +1 -3
  60. package/format/XMLFeature.d.ts.map +1 -1
  61. package/geom/Geometry.d.ts +1 -3
  62. package/geom/Geometry.d.ts.map +1 -1
  63. package/interaction/DragAndDrop.d.ts +2 -6
  64. package/interaction/DragAndDrop.d.ts.map +1 -1
  65. package/interaction/Draw.d.ts +3 -9
  66. package/interaction/Draw.d.ts.map +1 -1
  67. package/interaction/Interaction.d.ts +1 -3
  68. package/interaction/Interaction.d.ts.map +1 -1
  69. package/interaction/Link.js +2 -2
  70. package/interaction/Modify.d.ts +28 -76
  71. package/interaction/Modify.d.ts.map +1 -1
  72. package/interaction/Modify.js +54 -248
  73. package/interaction/Select.d.ts +18 -10
  74. package/interaction/Select.d.ts.map +1 -1
  75. package/interaction/Select.js +89 -54
  76. package/interaction/Snap.d.ts +12 -18
  77. package/interaction/Snap.d.ts.map +1 -1
  78. package/interaction/Translate.d.ts +2 -6
  79. package/interaction/Translate.d.ts.map +1 -1
  80. package/layer/Base.d.ts +8 -19
  81. package/layer/Base.d.ts.map +1 -1
  82. package/layer/Base.js +3 -6
  83. package/layer/BaseImage.d.ts +1 -3
  84. package/layer/BaseImage.d.ts.map +1 -1
  85. package/layer/BaseTile.d.ts +1 -3
  86. package/layer/BaseTile.d.ts.map +1 -1
  87. package/layer/BaseVector.d.ts +1 -3
  88. package/layer/BaseVector.d.ts.map +1 -1
  89. package/layer/Flow.d.ts +2 -2
  90. package/layer/Graticule.d.ts +1 -5
  91. package/layer/Graticule.d.ts.map +1 -1
  92. package/layer/Group.d.ts +2 -8
  93. package/layer/Group.d.ts.map +1 -1
  94. package/layer/Heatmap.d.ts +2 -23
  95. package/layer/Heatmap.d.ts.map +1 -1
  96. package/layer/Heatmap.js +0 -29
  97. package/layer/Layer.d.ts +8 -17
  98. package/layer/Layer.d.ts.map +1 -1
  99. package/layer/Layer.js +2 -5
  100. package/layer/Tile.d.ts +1 -1
  101. package/layer/Vector.d.ts +2 -2
  102. package/layer/Vector.d.ts.map +1 -1
  103. package/layer/VectorImage.d.ts +2 -2
  104. package/layer/VectorImage.d.ts.map +1 -1
  105. package/layer/VectorTile.d.ts +2 -2
  106. package/layer/VectorTile.d.ts.map +1 -1
  107. package/layer/WebGLPoints.d.ts +1 -3
  108. package/layer/WebGLPoints.d.ts.map +1 -1
  109. package/layer/WebGLTile.d.ts +3 -3
  110. package/layer/WebGLTile.d.ts.map +1 -1
  111. package/layer/WebGLVector.d.ts +2 -4
  112. package/layer/WebGLVector.d.ts.map +1 -1
  113. package/layer/WebGLVectorTile.d.ts +2 -2
  114. package/layer/WebGLVectorTile.d.ts.map +1 -1
  115. package/package.json +3 -4
  116. package/proj/proj4.d.ts +6 -43
  117. package/proj/proj4.d.ts.map +1 -1
  118. package/proj/proj4.js +28 -89
  119. package/proj.js +2 -2
  120. package/render/canvas/Builder.d.ts.map +1 -1
  121. package/render/canvas/Builder.js +1 -8
  122. package/render/canvas/Executor.d.ts.map +1 -1
  123. package/render/canvas/Executor.js +3 -49
  124. package/render/canvas/ExecutorGroup.d.ts.map +1 -1
  125. package/render/canvas/ExecutorGroup.js +5 -41
  126. package/render/canvas/Immediate.d.ts +0 -2
  127. package/render/canvas/Immediate.d.ts.map +1 -1
  128. package/render/canvas/Immediate.js +4 -28
  129. package/render/canvas/LineStringBuilder.d.ts +0 -1
  130. package/render/canvas/LineStringBuilder.d.ts.map +1 -1
  131. package/render/canvas/LineStringBuilder.js +5 -15
  132. package/render/canvas/PolygonBuilder.d.ts +0 -2
  133. package/render/canvas/PolygonBuilder.d.ts.map +1 -1
  134. package/render/canvas/PolygonBuilder.js +6 -72
  135. package/render/canvas/style.d.ts.map +1 -1
  136. package/render/canvas/style.js +37 -118
  137. package/render/canvas.d.ts +2 -22
  138. package/render/canvas.d.ts.map +1 -1
  139. package/render/canvas.js +0 -9
  140. package/render/webgl/bufferUtil.d.ts.map +1 -1
  141. package/render/webgl/bufferUtil.js +31 -1
  142. package/renderer/Composite.js +4 -4
  143. package/renderer/canvas/ImageLayer.d.ts +1 -6
  144. package/renderer/canvas/ImageLayer.d.ts.map +1 -1
  145. package/renderer/canvas/ImageLayer.js +0 -14
  146. package/renderer/canvas/TileLayer.d.ts +1 -1
  147. package/renderer/canvas/VectorLayer.d.ts +1 -8
  148. package/renderer/canvas/VectorLayer.d.ts.map +1 -1
  149. package/renderer/canvas/VectorLayer.js +14 -55
  150. package/renderer/canvas/VectorTileLayer.d.ts +1 -1
  151. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  152. package/renderer/canvas/VectorTileLayer.js +0 -2
  153. package/renderer/webgl/TileLayerBase.js +1 -1
  154. package/reproj/Tile.d.ts +2 -7
  155. package/reproj/Tile.d.ts.map +1 -1
  156. package/reproj/Tile.js +6 -12
  157. package/source/Cluster.d.ts +2 -8
  158. package/source/Cluster.d.ts.map +1 -1
  159. package/source/DataTile.d.ts +0 -15
  160. package/source/DataTile.d.ts.map +1 -1
  161. package/source/DataTile.js +0 -9
  162. package/source/GeoTIFF.d.ts +2 -7
  163. package/source/GeoTIFF.d.ts.map +1 -1
  164. package/source/GeoTIFF.js +10 -15
  165. package/source/ImageArcGISRest.d.ts +0 -10
  166. package/source/ImageArcGISRest.d.ts.map +1 -1
  167. package/source/ImageArcGISRest.js +0 -8
  168. package/source/ImageMapGuide.d.ts +0 -10
  169. package/source/ImageMapGuide.d.ts.map +1 -1
  170. package/source/ImageMapGuide.js +0 -8
  171. package/source/ImageStatic.d.ts +0 -5
  172. package/source/ImageStatic.d.ts.map +1 -1
  173. package/source/ImageStatic.js +0 -2
  174. package/source/ImageTile.d.ts +1 -5
  175. package/source/ImageTile.d.ts.map +1 -1
  176. package/source/ImageTile.js +0 -5
  177. package/source/ImageWMS.d.ts +0 -10
  178. package/source/ImageWMS.d.ts.map +1 -1
  179. package/source/ImageWMS.js +0 -10
  180. package/source/OGCMapTile.d.ts +0 -5
  181. package/source/OGCMapTile.d.ts.map +1 -1
  182. package/source/OGCMapTile.js +0 -2
  183. package/source/OSM.d.ts +0 -5
  184. package/source/OSM.d.ts.map +1 -1
  185. package/source/OSM.js +19 -5
  186. package/source/SentinelHub.d.ts +0 -1
  187. package/source/SentinelHub.d.ts.map +1 -1
  188. package/source/SentinelHub.js +0 -5
  189. package/source/Source.d.ts +1 -3
  190. package/source/Source.d.ts.map +1 -1
  191. package/source/TileArcGISRest.d.ts +1 -6
  192. package/source/TileArcGISRest.d.ts.map +1 -1
  193. package/source/TileArcGISRest.js +0 -2
  194. package/source/TileDebug.d.ts +1 -1
  195. package/source/TileImage.d.ts +0 -10
  196. package/source/TileImage.d.ts.map +1 -1
  197. package/source/TileImage.js +3 -16
  198. package/source/TileWMS.d.ts +1 -1
  199. package/source/UrlTile.d.ts +1 -1
  200. package/source/Vector.d.ts +8 -18
  201. package/source/Vector.d.ts.map +1 -1
  202. package/source/Vector.js +3 -3
  203. package/source/WMTS.d.ts +0 -5
  204. package/source/WMTS.d.ts.map +1 -1
  205. package/source/WMTS.js +0 -2
  206. package/source/XYZ.d.ts +0 -5
  207. package/source/XYZ.d.ts.map +1 -1
  208. package/source/XYZ.js +0 -2
  209. package/source/Zoomify.d.ts +2 -7
  210. package/source/Zoomify.d.ts.map +1 -1
  211. package/source/Zoomify.js +3 -5
  212. package/source/arcgisRest.d.ts +0 -5
  213. package/source/arcgisRest.d.ts.map +1 -1
  214. package/source/arcgisRest.js +0 -5
  215. package/source/mapguide.d.ts +0 -4
  216. package/source/mapguide.d.ts.map +1 -1
  217. package/source/mapguide.js +0 -5
  218. package/source/mapserver.d.ts +1 -5
  219. package/source/mapserver.d.ts.map +1 -1
  220. package/source/mapserver.js +0 -4
  221. package/source/ogcTileUtil.d.ts +12 -20
  222. package/source/ogcTileUtil.d.ts.map +1 -1
  223. package/source/ogcTileUtil.js +15 -27
  224. package/source/static.d.ts +0 -5
  225. package/source/static.d.ts.map +1 -1
  226. package/source/static.js +0 -4
  227. package/source/wms.d.ts +0 -5
  228. package/source/wms.d.ts.map +1 -1
  229. package/source/wms.js +0 -5
  230. package/style/Circle.d.ts +14 -0
  231. package/style/Circle.d.ts.map +1 -1
  232. package/style/Circle.js +11 -0
  233. package/style/Fill.js +1 -1
  234. package/style/Icon.d.ts +0 -19
  235. package/style/Icon.d.ts.map +1 -1
  236. package/style/Icon.js +2 -55
  237. package/style/IconImage.d.ts +5 -14
  238. package/style/IconImage.d.ts.map +1 -1
  239. package/style/IconImage.js +18 -28
  240. package/style/IconImageCache.d.ts +8 -4
  241. package/style/IconImageCache.d.ts.map +1 -1
  242. package/style/IconImageCache.js +13 -11
  243. package/style/RegularShape.d.ts +0 -12
  244. package/style/RegularShape.d.ts.map +1 -1
  245. package/style/RegularShape.js +4 -36
  246. package/style/Stroke.d.ts +0 -25
  247. package/style/Stroke.d.ts.map +1 -1
  248. package/style/Stroke.js +0 -28
  249. package/style/Style.d.ts +1 -1
  250. package/style/flat.d.ts +2 -2
  251. package/style/flat.js +1 -1
  252. package/tilegrid/TileGrid.d.ts +0 -5
  253. package/tilegrid/TileGrid.d.ts.map +1 -1
  254. package/tilegrid/TileGrid.js +0 -8
  255. package/util.js +1 -1
  256. package/worker/webgl.js +1 -1
  257. package/geom/flat/lineoffset.d.ts +0 -45
  258. package/geom/flat/lineoffset.d.ts.map +0 -1
  259. package/geom/flat/lineoffset.js +0 -173
  260. package/source/GeoZarr.d.ts +0 -163
  261. package/source/GeoZarr.d.ts.map +0 -1
  262. package/source/GeoZarr.js +0 -472
  263. package/source/OGCMap.d.ts +0 -180
  264. package/source/OGCMap.d.ts.map +0 -1
  265. package/source/OGCMap.js +0 -227
  266. package/source/ogcMapUtil.d.ts +0 -88
  267. package/source/ogcMapUtil.d.ts.map +0 -1
  268. package/source/ogcMapUtil.js +0 -121
@@ -52,11 +52,6 @@ export type SegmentData = {
52
52
  */
53
53
  featureSegments?: SegmentData[] | undefined;
54
54
  };
55
- /**
56
- * A function that takes a {@link module :ol/Feature~Feature} and returns `true` if
57
- * the feature may be modified or `false` otherwise.
58
- */
59
- export type FilterFunction = (arg0: Feature) => boolean;
60
55
  export type DragSegment = [SegmentData, number];
61
56
  export type Options = {
62
57
  /**
@@ -112,9 +107,7 @@ export type Options = {
112
107
  * features to modify. If a vector source is not provided, a feature collection
113
108
  * must be provided with the `features` option.
114
109
  */
115
- source?: VectorSource<Feature<import("../geom.js").Geometry, {
116
- [x: string]: any;
117
- }>> | undefined;
110
+ source?: VectorSource<Feature<import("../geom/Geometry.js").default>> | undefined;
118
111
  /**
119
112
  * When configured, point
120
113
  * features will be considered for modification based on their visual appearance, instead of being within
@@ -126,13 +119,7 @@ export type Options = {
126
119
  * The features the interaction works on. If a feature collection is not
127
120
  * provided, a vector source must be provided with the `source` option.
128
121
  */
129
- features?: Collection<Feature<import("../geom.js").Geometry, {
130
- [x: string]: any;
131
- }>> | undefined;
132
- /**
133
- * A function that takes a {@link module :ol/Feature~Feature}and returns `true` if the feature may be modified or `false` otherwise.
134
- */
135
- filter?: FilterFunction | undefined;
122
+ features?: Collection<Feature<import("../geom/Geometry.js").default>> | undefined;
136
123
  /**
137
124
  * Trace a portion of another geometry.
138
125
  * Tracing starts when two neighboring vertices are dragged onto a trace target, without any other modification in between..
@@ -143,9 +130,7 @@ export type Options = {
143
130
  * not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with
144
131
  * either a `traceSource` or a `source`.
145
132
  */
146
- traceSource?: VectorSource<Feature<import("../geom.js").Geometry, {
147
- [x: string]: any;
148
- }>> | undefined;
133
+ traceSource?: VectorSource<Feature<import("../geom/Geometry.js").default>> | undefined;
149
134
  /**
150
135
  * Wrap the world horizontally on the sketch
151
136
  * overlay.
@@ -204,33 +189,6 @@ declare class Modify extends PointerInteraction {
204
189
  * @param {Options} options Options.
205
190
  */
206
191
  constructor(options: Options);
207
- /**
208
- * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
209
- * @private
210
- */
211
- private handleSourceAdd_;
212
- /**
213
- * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
214
- * @private
215
- */
216
- private handleSourceRemove_;
217
- /**
218
- * @param {import("../Collection.js").CollectionEvent} event Event.
219
- * @private
220
- */
221
- private handleExternalCollectionAdd_;
222
- /**
223
- * @param {import("../Collection.js").CollectionEvent} event Event.
224
- * @private
225
- */
226
- private handleExternalCollectionRemove_;
227
- /**
228
- * Listener for features in external source or features collection. Ensures the feature filter
229
- * is re-run and segment data is updated.
230
- * @param {import("../events/Event.js").default | import("../Object").ObjectEvent} evt Event.
231
- * @private
232
- */
233
- private handleFeatureChange_;
234
192
  /***
235
193
  * @type {ModifyOnSignature<import("../events").EventsKey>}
236
194
  */
@@ -243,6 +201,8 @@ declare class Modify extends PointerInteraction {
243
201
  * @type {ModifyOnSignature<void>}
244
202
  */
245
203
  un: ModifyOnSignature<void>;
204
+ /** @private */
205
+ private boundHandleFeatureChange_;
246
206
  /**
247
207
  * @private
248
208
  * @type {import("../events/condition.js").Condition}
@@ -364,23 +324,7 @@ declare class Modify extends PointerInteraction {
364
324
  */
365
325
  private hitDetection_;
366
326
  /**
367
- * Useful for performance optimization
368
- * @private
369
- * @type boolean
370
- */
371
- private filterFunctionWasSupplied_;
372
- /**
373
- * @private
374
- * @type {FilterFunction}
375
- */
376
- private filter_;
377
- featuresCollection_: Collection<Feature<import("../geom.js").Geometry, {
378
- [x: string]: any;
379
- }>> | undefined;
380
- /**
381
- * Internal features array. When adding or removing features, be sure to use
382
- * addFeature_()/removeFeature_() so that the the segment index is adjusted.
383
- * @type {Array<Feature>}
327
+ * @type {Collection<Feature>}
384
328
  * @private
385
329
  */
386
330
  private features_;
@@ -407,7 +351,6 @@ declare class Modify extends PointerInteraction {
407
351
  */
408
352
  setTrace(trace: boolean | import("../events/condition.js").Condition): void;
409
353
  /**
410
- * Called when a feature is added to the internal features collection
411
354
  * @param {Feature} feature Feature.
412
355
  * @private
413
356
  */
@@ -419,8 +362,6 @@ declare class Modify extends PointerInteraction {
419
362
  */
420
363
  private willModifyFeatures_;
421
364
  /**
422
- * Removes a feature from the internal features collection and updates internal state
423
- * accordingly.
424
365
  * @param {Feature} feature Feature.
425
366
  * @private
426
367
  */
@@ -445,17 +386,30 @@ declare class Modify extends PointerInteraction {
445
386
  */
446
387
  getOverlay(): VectorLayer;
447
388
  /**
448
- * Common handler for event signaling addition of feature to the supplied features source
449
- * or collection.
450
- * @param {Feature} feature Feature.
389
+ * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
390
+ * @private
451
391
  */
452
- externalAddFeatureHandler_(feature: Feature): void;
392
+ private handleSourceAdd_;
453
393
  /**
454
- * Common handler for event signaling removal of feature from the supplied features source
455
- * or collection.
456
- * @param {Feature} feature Feature.
394
+ * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
395
+ * @private
396
+ */
397
+ private handleSourceRemove_;
398
+ /**
399
+ * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
400
+ * @private
401
+ */
402
+ private handleFeatureAdd_;
403
+ /**
404
+ * @param {import("../events/Event.js").default} evt Event.
405
+ * @private
406
+ */
407
+ private handleFeatureChange_;
408
+ /**
409
+ * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
410
+ * @private
457
411
  */
458
- externalRemoveFeatureHandler_(feature: Feature): void;
412
+ private handleFeatureRemove_;
459
413
  /**
460
414
  * @param {Feature} feature Feature
461
415
  * @param {Point} geometry Geometry.
@@ -535,9 +489,7 @@ declare class Modify extends PointerInteraction {
535
489
  * @private
536
490
  */
537
491
  private updateTrace_;
538
- getTraceCandidates_(event: any): Feature<import("../geom.js").Geometry, {
539
- [x: string]: any;
540
- }>[];
492
+ getTraceCandidates_(event: any): Feature<import("../geom/Geometry.js").default>[];
541
493
  /**
542
494
  * Activate or deactivate trace state based on a browser event.
543
495
  * @param {import("../MapBrowserEvent.js").default} event Event.
@@ -1 +1 @@
1
- {"version":3,"file":"Modify.d.ts","sourceRoot":"","sources":["Modify.js"],"names":[],"mappings":"AAyLA;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,kBANW,eAAe,YACf,UAAU,CAAC,OAAO,CAAC,mBAEnB,OAAO,uBAAuB,EAAE,OAAO,EAmBjD;IAbC;;;;OAIG;IACH,UAHU,UAAU,CAAC,OAAO,CAAC,CAGL;IAExB;;;;OAIG;IACH,iBAHU,OAAO,uBAAuB,EAAE,OAAO,CAGX;CAEzC;;;;;;;;;;aA7Ha,OAAO;;;;cACP,OAAO,2BAA2B,EAAE,OAAO;;;;;;;;aAE3C,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;6BAOrB,CAAS,IAAO,EAAP,OAAO,KAAE,OAAO;0BAIzB,CAAC,WAAW,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAkHrB,MAAM,IACN,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACjI,OAAW,eAAe,EAAE,WAAW,CAAC,OAAO,oBAAoB,EAAE,KAAK,GAC1E,eAAqB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC/D,OAAW,eAAe,EAAE,WAAW,CAAC,WAAW,GAAC,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,GACvF,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,U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IAED;;;OAGG;IACH,YAFY,OAAO,kBAAkB,EAAE,UAAU,GAAG,IAAI,CAWvD;IAED;;;;;OAKG;IACH,kBAHY,OAAO,CAyBlB;IAED;;;;;;OAMG;IACH,yBALW,OAAO,kBAAkB,EAAE,UAAU,GAEpC,OAAO,CAoClB;IAED;;;;OAIG;IACH,sBAiHC;IAED;;;;;OAKG;IACH,kBAHY,OAAO,CA2BlB;IAED;;;;;;OAMG;IACH,yBALW,OAAO,kBAAkB,EAAE,UAAU,GAEpC,OAAO,CAiBlB;IAED;;;;OAIG;IACH,gCAIC;IAED;;;;;;OAMG;IACH,8BAeC;CACF;yBA3hEwB,qBAAqB;+BAKf,cAAc;wBAbrB,oBAAoB"}
@@ -5,7 +5,6 @@ import Collection from '../Collection.js';
5
5
  import CollectionEventType from '../CollectionEventType.js';
6
6
  import Feature from '../Feature.js';
7
7
  import MapBrowserEventType from '../MapBrowserEventType.js';
8
- import ObjectEventType from '../ObjectEventType.js';
9
8
  import {equals} from '../array.js';
10
9
  import {
11
10
  closestOnSegment,
@@ -95,12 +94,6 @@ const ModifyEventType = {
95
94
  * @property {Array<SegmentData>} [featureSegments] FeatureSegments.
96
95
  */
97
96
 
98
- /**
99
- * A function that takes a {@link module:ol/Feature~Feature} and returns `true` if
100
- * the feature may be modified or `false` otherwise.
101
- * @typedef {function(Feature):boolean} FilterFunction
102
- */
103
-
104
97
  /**
105
98
  * @typedef {[SegmentData, number]} DragSegment
106
99
  */
@@ -151,8 +144,6 @@ const ModifyEventType = {
151
144
  * @property {Collection<Feature>} [features]
152
145
  * The features the interaction works on. If a feature collection is not
153
146
  * provided, a vector source must be provided with the `source` option.
154
- * @property {FilterFunction} [filter] A function that takes a {@link module:ol/Feature~Feature}
155
- * and returns `true` if the feature may be modified or `false` otherwise.
156
147
  * @property {boolean|import("../events/condition.js").Condition} [trace=false] Trace a portion of another geometry.
157
148
  * Tracing starts when two neighboring vertices are dragged onto a trace target, without any other modification in between..
158
149
  * @property {VectorSource} [traceSource] Source for features to trace. If tracing is active and a `traceSource` is
@@ -253,24 +244,6 @@ class Modify extends PointerInteraction {
253
244
  constructor(options) {
254
245
  super(/** @type {import("./Pointer.js").Options} */ (options));
255
246
 
256
- //Maintain a ref to event handlers for later unregistering
257
- /** @private */
258
- this.handleSourceAdd_ = this.handleSourceAdd_.bind(this);
259
-
260
- /** @private */
261
- this.handleSourceRemove_ = this.handleSourceRemove_.bind(this);
262
-
263
- /** @private */
264
- this.handleExternalCollectionAdd_ =
265
- this.handleExternalCollectionAdd_.bind(this);
266
-
267
- /** @private */
268
- this.handleExternalCollectionRemove_ =
269
- this.handleExternalCollectionRemove_.bind(this);
270
-
271
- /** @private */
272
- this.handleFeatureChange_ = this.handleFeatureChange_.bind(this);
273
-
274
247
  /***
275
248
  * @type {ModifyOnSignature<import("../events").EventsKey>}
276
249
  */
@@ -286,6 +259,9 @@ class Modify extends PointerInteraction {
286
259
  */
287
260
  this.un;
288
261
 
262
+ /** @private */
263
+ this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this);
264
+
289
265
  /**
290
266
  * @private
291
267
  * @type {import("../events/condition.js").Condition}
@@ -454,80 +430,46 @@ class Modify extends PointerInteraction {
454
430
  */
455
431
  this.hitDetection_ = null;
456
432
 
457
- /**
458
- * Useful for performance optimization
459
- * @private
460
- * @type boolean
461
- */
462
- this.filterFunctionWasSupplied_ =
463
- options.filter != undefined ? true : false;
464
-
465
- /**
466
- * @private
467
- * @type {FilterFunction}
468
- */
469
- this.filter_ = options.filter ? options.filter : () => true;
470
-
471
- if (!(options.features || options.source)) {
472
- throw new Error(
473
- 'The modify interaction requires features collection or a source',
474
- );
475
- }
476
- /** @type {Array<Feature>} */
433
+ /** @type {Collection<Feature>} */
477
434
  let features;
478
435
  if (options.features) {
479
- features = options.features.getArray();
480
- //setup listeners on external features collection and features
481
- options.features.addEventListener(
482
- CollectionEventType.ADD,
483
- this.handleExternalCollectionAdd_,
484
- );
485
- options.features.addEventListener(
486
- CollectionEventType.REMOVE,
487
- this.handleExternalCollectionRemove_,
488
- );
489
- //keep ref for unsubscribe on dispose
490
- this.featuresCollection_ = options.features;
436
+ features = options.features;
491
437
  } else if (options.source) {
492
- features = options.source.getFeatures();
493
- //setup listeners on external source and features
494
- options.source.addEventListener(
438
+ this.source_ = options.source;
439
+ features = new Collection(this.source_.getFeatures());
440
+ this.source_.addEventListener(
495
441
  VectorEventType.ADDFEATURE,
496
- this.handleSourceAdd_,
442
+ this.handleSourceAdd_.bind(this),
497
443
  );
498
- options.source.addEventListener(
444
+ this.source_.addEventListener(
499
445
  VectorEventType.REMOVEFEATURE,
500
- this.handleSourceRemove_,
446
+ this.handleSourceRemove_.bind(this),
447
+ );
448
+ }
449
+ if (!features) {
450
+ throw new Error(
451
+ 'The modify interaction requires features, a source or a layer',
501
452
  );
502
- //keep ref for unsubscribe on dispose
503
- this.source_ = options.source;
504
453
  }
505
- features.forEach((feature) => {
506
- //any modification to the feature requires filter to be re-run
507
- feature.addEventListener(EventType.CHANGE, this.handleFeatureChange_);
508
- //prop change handler is only to re-run the filter
509
- if (this.filterFunctionWasSupplied_) {
510
- feature.addEventListener(
511
- ObjectEventType.PROPERTYCHANGE,
512
- this.handleFeatureChange_,
513
- );
514
- }
515
- });
516
-
517
454
  if (options.hitDetection) {
518
455
  this.hitDetection_ = options.hitDetection;
519
456
  }
520
457
 
521
458
  /**
522
- * Internal features array. When adding or removing features, be sure to use
523
- * addFeature_()/removeFeature_() so that the the segment index is adjusted.
524
- * @type {Array<Feature>}
459
+ * @type {Collection<Feature>}
525
460
  * @private
526
461
  */
527
- this.features_ = [];
528
- features
529
- .filter(this.filter_)
530
- .forEach((feature) => this.addFeature_(feature));
462
+ this.features_ = features;
463
+
464
+ this.features_.forEach(this.addFeature_.bind(this));
465
+ this.features_.addEventListener(
466
+ CollectionEventType.ADD,
467
+ this.handleFeatureAdd_.bind(this),
468
+ );
469
+ this.features_.addEventListener(
470
+ CollectionEventType.REMOVE,
471
+ this.handleFeatureRemove_.bind(this),
472
+ );
531
473
 
532
474
  /**
533
475
  * @type {import("../MapBrowserEvent.js").default}
@@ -570,12 +512,10 @@ class Modify extends PointerInteraction {
570
512
  }
571
513
 
572
514
  /**
573
- * Called when a feature is added to the internal features collection
574
515
  * @param {Feature} feature Feature.
575
516
  * @private
576
517
  */
577
518
  addFeature_(feature) {
578
- this.features_.push(feature);
579
519
  const geometry = feature.getGeometry();
580
520
  if (geometry) {
581
521
  const writer = this.SEGMENT_WRITERS_[geometry.getType()];
@@ -587,6 +527,7 @@ class Modify extends PointerInteraction {
587
527
  if (map && map.isRendered() && this.getActive()) {
588
528
  this.handlePointerAtPixel_(this.lastCoordinate_);
589
529
  }
530
+ feature.addEventListener(EventType.CHANGE, this.boundHandleFeatureChange_);
590
531
  }
591
532
 
592
533
  /**
@@ -619,20 +560,20 @@ class Modify extends PointerInteraction {
619
560
  }
620
561
 
621
562
  /**
622
- * Removes a feature from the internal features collection and updates internal state
623
- * accordingly.
624
563
  * @param {Feature} feature Feature.
625
564
  * @private
626
565
  */
627
566
  removeFeature_(feature) {
628
- const itemIndex = this.features_.indexOf(feature);
629
- this.features_.splice(itemIndex, 1);
630
567
  this.removeFeatureSegmentData_(feature);
631
568
  // Remove the vertex feature if the collection of candidate features is empty.
632
- if (this.vertexFeature_ && this.features_.length === 0) {
569
+ if (this.vertexFeature_ && this.features_.getLength() === 0) {
633
570
  this.overlay_.getSource().removeFeature(this.vertexFeature_);
634
571
  this.vertexFeature_ = null;
635
572
  }
573
+ feature.removeEventListener(
574
+ EventType.CHANGE,
575
+ this.boundHandleFeatureChange_,
576
+ );
636
577
  }
637
578
 
638
579
  /**
@@ -705,9 +646,8 @@ class Modify extends PointerInteraction {
705
646
  * @private
706
647
  */
707
648
  handleSourceAdd_(event) {
708
- const feature = event.feature;
709
- if (feature) {
710
- this.externalAddFeatureHandler_(feature);
649
+ if (event.feature) {
650
+ this.features_.push(event.feature);
711
651
  }
712
652
  }
713
653
 
@@ -716,83 +656,37 @@ class Modify extends PointerInteraction {
716
656
  * @private
717
657
  */
718
658
  handleSourceRemove_(event) {
719
- const feature = event.feature;
720
- if (feature) {
721
- this.externalRemoveFeatureHandler_(feature);
659
+ if (event.feature) {
660
+ this.features_.remove(event.feature);
722
661
  }
723
662
  }
724
663
 
725
664
  /**
726
- * @param {import("../Collection.js").CollectionEvent} event Event.
665
+ * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
727
666
  * @private
728
667
  */
729
- handleExternalCollectionAdd_(event) {
730
- const feature = event.element;
731
- if (feature) {
732
- this.externalAddFeatureHandler_(feature);
733
- }
668
+ handleFeatureAdd_(evt) {
669
+ this.addFeature_(evt.element);
734
670
  }
735
671
 
736
672
  /**
737
- * @param {import("../Collection.js").CollectionEvent} event Event.
673
+ * @param {import("../events/Event.js").default} evt Event.
738
674
  * @private
739
675
  */
740
- handleExternalCollectionRemove_(event) {
741
- const feature = event.element;
742
- if (feature) {
743
- this.externalRemoveFeatureHandler_(feature);
744
- }
745
- }
746
-
747
- /**
748
- * Common handler for event signaling addition of feature to the supplied features source
749
- * or collection.
750
- * @param {Feature} feature Feature.
751
- */
752
- externalAddFeatureHandler_(feature) {
753
- feature.addEventListener(EventType.CHANGE, this.handleFeatureChange_);
754
- //prop change handler is only for reapplying the filter
755
- if (this.filterFunctionWasSupplied_) {
756
- feature.addEventListener(
757
- ObjectEventType.PROPERTYCHANGE,
758
- this.handleFeatureChange_,
759
- );
760
- }
761
- if (this.filter_(feature)) {
676
+ handleFeatureChange_(evt) {
677
+ if (!this.changingFeature_) {
678
+ const feature = /** @type {Feature} */ (evt.target);
679
+ this.removeFeature_(feature);
762
680
  this.addFeature_(feature);
763
681
  }
764
682
  }
765
683
 
766
684
  /**
767
- * Common handler for event signaling removal of feature from the supplied features source
768
- * or collection.
769
- * @param {Feature} feature Feature.
770
- */
771
- externalRemoveFeatureHandler_(feature) {
772
- feature.removeEventListener(EventType.CHANGE, this.handleFeatureChange_);
773
- if (this.filterFunctionWasSupplied_) {
774
- feature.removeEventListener(
775
- ObjectEventType.PROPERTYCHANGE,
776
- this.handleFeatureChange_,
777
- );
778
- }
779
- this.removeFeature_(feature);
780
- }
781
-
782
- /**
783
- * Listener for features in external source or features collection. Ensures the feature filter
784
- * is re-run and segment data is updated.
785
- * @param {import("../events/Event.js").default | import("../Object").ObjectEvent} evt Event.
685
+ * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
786
686
  * @private
787
687
  */
788
- handleFeatureChange_(evt) {
789
- if (!this.changingFeature_) {
790
- const feature = /** @type {Feature} */ (evt.target);
791
- this.removeFeature_(feature);
792
- //safe to remove handler on a feature if there isn't one, but need to apply the filter
793
- // before adding the feature.
794
- this.filter_(feature) && this.addFeature_(feature);
795
- }
688
+ handleFeatureRemove_(evt) {
689
+ this.removeFeature_(evt.element);
796
690
  }
797
691
 
798
692
  /**
@@ -1481,50 +1375,16 @@ class Modify extends PointerInteraction {
1481
1375
  coordinates[depth[0]][segmentData.index + index] = vertex;
1482
1376
  segment[index] = vertex;
1483
1377
  break;
1484
- case 'Polygon': {
1378
+ case 'Polygon':
1485
1379
  coordinates = geometry.getCoordinates();
1486
- const ring = coordinates[depth[0]];
1487
- const targetIndex = segmentData.index + index;
1488
-
1489
- // Prevent duplicate change events when vertex already at position
1490
- if (
1491
- ring[targetIndex][0] === vertex[0] &&
1492
- ring[targetIndex][1] === vertex[1]
1493
- ) {
1494
- coordinates = null;
1495
- } else {
1496
- ring[targetIndex] = vertex;
1497
- if (targetIndex === 0) {
1498
- ring[ring.length - 1] = vertex;
1499
- } else if (targetIndex === ring.length - 1) {
1500
- ring[0] = vertex;
1501
- }
1502
- }
1380
+ coordinates[depth[0]][segmentData.index + index] = vertex;
1503
1381
  segment[index] = vertex;
1504
1382
  break;
1505
- }
1506
- case 'MultiPolygon': {
1383
+ case 'MultiPolygon':
1507
1384
  coordinates = geometry.getCoordinates();
1508
- const mRing = coordinates[depth[1]][depth[0]];
1509
- const mTargetIndex = segmentData.index + index;
1510
-
1511
- // Prevent duplicate change events when vertex already at position
1512
- if (
1513
- mRing[mTargetIndex][0] === vertex[0] &&
1514
- mRing[mTargetIndex][1] === vertex[1]
1515
- ) {
1516
- coordinates = null;
1517
- } else {
1518
- mRing[mTargetIndex] = vertex;
1519
- if (mTargetIndex === 0) {
1520
- mRing[mRing.length - 1] = vertex;
1521
- } else if (mTargetIndex === mRing.length - 1) {
1522
- mRing[0] = vertex;
1523
- }
1524
- }
1385
+ coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;
1525
1386
  segment[index] = vertex;
1526
1387
  break;
1527
- }
1528
1388
  case 'Circle':
1529
1389
  const circle = /** @type {import("../geom/Circle.js").default} */ (
1530
1390
  geometry
@@ -1755,7 +1615,7 @@ class Modify extends PointerInteraction {
1755
1615
  geom &&
1756
1616
  geom.getType() === 'Point' &&
1757
1617
  feature instanceof Feature &&
1758
- this.features_.includes(feature)
1618
+ this.features_.getArray().includes(feature)
1759
1619
  ) {
1760
1620
  hitPointGeometry = /** @type {Point} */ (geom);
1761
1621
  const coordinate = /** @type {Point} */ (feature.getGeometry())
@@ -2252,60 +2112,6 @@ class Modify extends PointerInteraction {
2252
2112
  },
2253
2113
  );
2254
2114
  }
2255
-
2256
- /**
2257
- * @override
2258
- */
2259
- disposeInternal() {
2260
- super.disposeInternal();
2261
- if (this.featuresCollection_) {
2262
- this.featuresCollection_.removeEventListener(
2263
- CollectionEventType.ADD,
2264
- this.handleExternalCollectionAdd_,
2265
- );
2266
- this.featuresCollection_.removeEventListener(
2267
- CollectionEventType.REMOVE,
2268
- this.handleExternalCollectionRemove_,
2269
- );
2270
- //change and propertychange event handlers were placed on all features in the external
2271
- // collection, not just the ones that passed the filter. Remove these too.
2272
- for (const feature of this.featuresCollection_.getArray()) {
2273
- feature.removeEventListener(
2274
- EventType.CHANGE,
2275
- this.handleFeatureChange_,
2276
- );
2277
- if (this.filterFunctionWasSupplied_) {
2278
- feature.removeEventListener(
2279
- ObjectEventType.PROPERTYCHANGE,
2280
- this.handleFeatureChange_,
2281
- );
2282
- }
2283
- }
2284
- } else if (this.source_) {
2285
- this.source_.removeEventListener(
2286
- VectorEventType.ADDFEATURE,
2287
- this.handleSourceAdd_,
2288
- );
2289
- this.source_.removeEventListener(
2290
- VectorEventType.REMOVEFEATURE,
2291
- this.handleSourceRemove_,
2292
- );
2293
- //change and propertychange event handlers were placed on all features in the source, not
2294
- // just the ones that passed the filter. Remove these too.
2295
- for (const feature of this.source_.getFeatures()) {
2296
- feature.removeEventListener(
2297
- EventType.CHANGE,
2298
- this.handleFeatureChange_,
2299
- );
2300
- if (this.filterFunctionWasSupplied_) {
2301
- feature.removeEventListener(
2302
- ObjectEventType.PROPERTYCHANGE,
2303
- this.handleFeatureChange_,
2304
- );
2305
- }
2306
- }
2307
- }
2308
- }
2309
2115
  }
2310
2116
 
2311
2117
  /**