@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.
- package/node_modules_ol_ImageCanvas_js.js +76 -83
- package/node_modules_ol_ImageCanvas_js.js.map +1 -1
- package/node_modules_ol_TileRange_js.js +128 -110
- package/node_modules_ol_TileRange_js.js.map +1 -1
- package/node_modules_ol_Tile_js.js +279 -0
- package/node_modules_ol_Tile_js.js.map +1 -0
- package/node_modules_ol_VectorRenderTile_js.js +428 -143
- package/node_modules_ol_VectorRenderTile_js.js.map +1 -1
- package/node_modules_ol_VectorTile_js.js +405 -119
- package/node_modules_ol_VectorTile_js.js.map +1 -1
- package/node_modules_ol_control_MousePosition_js.js +327 -0
- package/node_modules_ol_control_MousePosition_js.js.map +1 -0
- package/node_modules_ol_control_ZoomToExtent_js.js +118 -0
- package/node_modules_ol_control_ZoomToExtent_js.js.map +1 -0
- package/node_modules_ol_events_SnapEvent_js.js +79 -0
- package/node_modules_ol_events_SnapEvent_js.js.map +1 -0
- package/node_modules_ol_featureloader_js.js +205 -0
- package/node_modules_ol_featureloader_js.js.map +1 -0
- package/node_modules_ol_geom_Circle_js.js +300 -0
- package/node_modules_ol_geom_Circle_js.js.map +1 -0
- package/node_modules_ol_geom_GeometryCollection_js.js +369 -0
- package/node_modules_ol_geom_GeometryCollection_js.js.map +1 -0
- package/node_modules_ol_geom_MultiPoint_js.js +228 -0
- package/node_modules_ol_geom_MultiPoint_js.js.map +1 -0
- package/node_modules_ol_geom_flat_center_js.js +47 -0
- package/node_modules_ol_geom_flat_center_js.js.map +1 -0
- package/node_modules_ol_geom_flat_geodesic_js.js +123 -88
- package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -1
- package/node_modules_ol_geom_flat_interpolate_js.js +230 -0
- package/node_modules_ol_geom_flat_interpolate_js.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js.map +1 -0
- package/node_modules_ol_geom_flat_linechunk_js.js +76 -0
- package/node_modules_ol_geom_flat_linechunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js +68 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_textpath_js.js +178 -0
- package/node_modules_ol_geom_flat_textpath_js.js.map +1 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js +285 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js.map +1 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js +351 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js.map +1 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js +159 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49290.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49290.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49291.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49291.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49292.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49292.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49293.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49293.js.map +1 -0
- package/node_modules_ol_loadingstrategy_js.js +95 -0
- package/node_modules_ol_loadingstrategy_js.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js +372 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js +318 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_Instruction_js.js +66 -0
- package/node_modules_ol_render_canvas_Instruction_js.js.map +1 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js +187 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js +276 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js.map +1 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js +301 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_ol_renderer_Layer_js.js +219 -0
- package/node_modules_ol_renderer_Layer_js.js.map +1 -0
- package/node_modules_ol_source_Source_js.js +256 -0
- package/node_modules_ol_source_Source_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js +318 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js.js +80 -0
- package/node_modules_ol_source_VectorEventType_js.js.map +1 -0
- package/node_modules_ol_structs_RBush_js.js +242 -0
- package/node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_style_js.js +2 -1
- package/node_modules_ol_style_js.js.map +1 -1
- package/node_modules_rbush_rbush_min_js.js +16 -0
- package/node_modules_rbush_rbush_min_js.js.map +1 -0
- package/package.json +142 -146
- package/vaadin-bundle.json +2447 -2352
- package/vaadin.js +52246 -63791
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js +1364 -0
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js.map +1 -0
- package/vendors-node_modules_dompurify_dist_purify_js.js +26 -21
- package/vendors-node_modules_dompurify_dist_purify_js.js.map +1 -1
- package/vendors-node_modules_marked_lib_marked_esm_js.js +2205 -0
- package/vendors-node_modules_marked_lib_marked_esm_js.js.map +1 -0
- package/vendors-node_modules_marked_lib_marked_umd_js.js +2164 -2556
- package/vendors-node_modules_marked_lib_marked_umd_js.js.map +1 -1
- package/vendors-node_modules_ol_Feature_js.js +360 -0
- package/vendors-node_modules_ol_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_Geolocation_js.js +352 -293
- package/vendors-node_modules_ol_Geolocation_js.js.map +1 -1
- package/vendors-node_modules_ol_ImageTile_js.js +494 -0
- package/vendors-node_modules_ol_ImageTile_js.js.map +1 -0
- package/vendors-node_modules_ol_Overlay_js.js +606 -0
- package/vendors-node_modules_ol_Overlay_js.js.map +1 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js +417 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js.map +1 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js +711 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js +509 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js +418 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js.map +1 -0
- package/vendors-node_modules_ol_control_js.js +490 -0
- package/vendors-node_modules_ol_control_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_LineString_js.js +574 -0
- package/vendors-node_modules_ol_geom_LineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js +405 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js +773 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js +769 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js.map +1 -0
- package/vendors-node_modules_ol_index_js.js +526 -675
- package/vendors-node_modules_ol_index_js.js.map +1 -1
- package/vendors-node_modules_ol_interaction_Draw_js.js +2777 -0
- package/vendors-node_modules_ol_interaction_Draw_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js +586 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Link_js.js +489 -0
- package/vendors-node_modules_ol_interaction_Link_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js +1841 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Select_js.js +623 -0
- package/vendors-node_modules_ol_interaction_Select_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js +982 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js +466 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_js.js +872 -0
- package/vendors-node_modules_ol_interaction_js.js.map +1 -0
- package/vendors-node_modules_ol_layer_Graticule_js.js +1374 -989
- package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -1
- package/vendors-node_modules_ol_render_Feature_js.js +546 -0
- package/vendors-node_modules_ol_render_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js +897 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js +907 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js +539 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js +1715 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js +1208 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js +825 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js +654 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js +1044 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_vector_js.js +460 -0
- package/vendors-node_modules_ol_renderer_vector_js.js.map +1 -0
- package/vendors-node_modules_ol_source_Vector_js.js +2091 -0
- package/vendors-node_modules_ol_source_Vector_js.js.map +1 -0
- package/node_modules_ol_ImageTile_js.js +0 -177
- package/node_modules_ol_ImageTile_js.js.map +0 -1
- package/node_modules_ol_render_js.js +0 -131
- package/node_modules_ol_render_js.js.map +0 -1
- package/node_modules_ol_structs_LRUCache_js.js +0 -275
- package/node_modules_ol_structs_LRUCache_js.js.map +0 -1
- package/node_modules_ol_tilecoord_js.js +0 -115
- package/node_modules_ol_tilecoord_js.js.map +0 -1
- package/vendors-node_modules_ol_TileCache_js.js +0 -461
- package/vendors-node_modules_ol_TileCache_js.js.map +0 -1
- package/vendors-node_modules_ol_Tile_js.js +0 -330
- package/vendors-node_modules_ol_Tile_js.js.map +0 -1
- package/vendors-node_modules_ol_style_Text_js.js +0 -509
- package/vendors-node_modules_ol_style_Text_js.js.map +0 -1
- package/vendors-node_modules_rbush_index_js.js +0 -531
- package/vendors-node_modules_rbush_index_js.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_ol_interaction_Snap_js.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AAC+B;;AAE/B;AACA,UAAU;AACV;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,uCAAuC;AAC7D;AACO,wBAAwB,iDAAK;AACpC;AACA,aAAa,eAAe;AAC5B,aAAa,QAAQ;AACrB,aAAa,uCAAuC;AACpD,aAAa,uCAAuC;AACpD,aAAa,iCAAiC;AAC9C,aAAa,mDAAmD;AAChE;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1DA;AACA;AACA;AAC4D;AAKlC;AACqB;AACiB;AACb;AAM7B;AACsB;AACE;AACgB;AAM1C;AACuC;AACnB;AACN;AACY;;AAE9C;AACA,aAAa,8CAA8C;AAC3D;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,iCAAiC;AAC/C,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB;;AAEA;AACA,cAAc,uCAAuC;AACrD,aAAa,kGAAkG;AAC/G,wBAAwB,wCAAwC,uCAAuC,cAAc;AACrH;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc,oDAAoD;AAClE,cAAc,yDAAyD;AACvE,cAAc,sDAAsD;AACpE,cAAc,qDAAqD;AACnE,cAAc,iEAAiE;AAC/E,cAAc,yDAAyD;AACvE,cAAc,8DAA8D;AAC5E,cAAc,2DAA2D;AACzE;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,qEAAqE;AACnF,cAAc,uCAAuC;AACrD,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB;AACA,cAAc,YAAY,mCAAmC,mCAAmC;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc,4CAA4C;AAC1D,cAAc,kCAAkC;AAChD,cAAc,sCAAsC;AACpD,cAAc,cAAc;AAC5B;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA,aAAa,qCAAqC;AAClD,aAAa,yCAAyC;AACtD,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA,2BAA2B,2DAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,oBAAoB,4DAAU;AAC9B;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,iDAAiD;AAC9D,aAAa,yCAAyC;AACtD,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,uBAAuB;AACtC;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,yCAAyC;AACtD,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA,sDAAsD,QAAQ;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,8CAA8C;AAC3D,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,yCAAyC;AACtD,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,2CAA2C;AACxD,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA,wCAAwC,QAAQ;AAChD;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,oCAAoC;AACjD,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA,GAAG;;AAEH;AACA,aAAa,sCAAsC;AACnD,cAAc,gBAAgB;AAC9B;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,YAAY,6HAA6H;AACzI,YAAY,sCAAsC;AAClD;AACA;AACA;AACA,eAAe,iDAAiD;AAChE;AACA,sBAAsB,iDAAiD;AACvE;AACA;AACA;AACA,eAAe,6EAA6E;AAC5F;AACA;AACA;AACA,sBAAsB,6EAA6E;AACnG;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,sCAAsC;AACjD;AACA,WAAW,oBAAoB;AAC/B;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA;AACA;AACA,6BAA6B,4CAA4C,IAAI;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,mDAAkB;AACrC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA,sCAAsC,gCAAgC;AACtE;AACA;;AAEA;AACA,uCAAuC,+CAAI;AAC3C;;AAEA;AACA,gCAAgC,gDAAK;AACrC;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;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;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,sBAAsB,yDAAK;;AAE3B;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iCAAiC;AAC9C,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA,wBAAwB,gDAAM;AAC9B;AACA;AACA;AACA;AACA;AACA,6BAA6B,uDAAW;AACxC;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA,2BAA2B,0DAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA,mBAAmB,sDAAgB;AACnC;AACA;AACA,mCAAmC,4EAAoB;AACvD;AACA;AACA;AACA;AACA,0CAA0C,0DAAc;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA,mCAAmC,4EAAoB;AACvD;AACA;AACA;AACA;AACA,0CAA0C,0DAAc;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA,qDAAqD,kDAAM;AAC3D;AACA,QAAQ,mEAAgB;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,4GAA4G;AAC1H;AACA;AACA;AACA,eAAe,4GAA4G;AAC3H;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,aAAa;AAC1B,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,4DAAS,CAAC,uEAAoB;AAC7D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,4DAAS,CAAC,qEAAkB;AACzD,MAAM;AACN;AACA,6BAA6B,4DAAS,CAAC,uEAAoB;AAC3D;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,6HAA6H;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6HAA6H;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,sCAAsC;AACnD;AACA;AACA;AACA,+BAA+B,iCAAiC;AAChE;AACA,kBAAkB,gDAAM;AACxB;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iCAAiC;AAC9C,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA,wBAAwB,gDAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,6CAA6C,QAAQ;AACrD;AACA;AACA;;AAEA;AACA,MAAM,yDAAa;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,qDAAa;AAChC;AACA;AACA,6DAA6D,qDAAa;AAC1E;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,kDAAM;AAChB;AACA,YAAY,oEAAuB;AACnC;AACA;AACA;AACA,UAAU,kDAAM;AAChB;AACA,YAAY,uEAA0B;AACtC;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,UAAU,kDAAM;AAChB;AACA,YAAY,8EAA0B;AACtC;AACA;AACA;AACA,UAAU,kDAAM;AAChB;AACA,YAAY,iFAA6B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6BAA6B;AAC1C,aAAa,uCAAuC;AACpD,aAAa,6BAA6B;AAC1C,cAAc,kBAAkB;AAChC;AACA;AACA;AACA,gCAAgC,4DAAkB;;AAElD,gBAAgB,sDAAY;AAC5B,MAAM,kDAAM;AACZ,QAAQ,0DAAc;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,gEAAe;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA,oCAAoC,4DAAkB;AACtD,0BAA0B,gEAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA,iCAAiC,2DAAiB;AAClD;AACA;AACA;AACA;AACA;AACA,mBAAmB,gEAAe;AAClC;AACA,uBAAuB,qCAAqC;AAC5D;AACA,UAAU;AACV;AACA;AACA;AACA,6BAA6B,4DAAkB;AAC/C,6BAA6B,4DAAkB;AAC/C,qBAAqB,iEAAgB;AACrC;AACA;AACA;AACA,wBAAwB,gEAAe;AACvC;AACA,4BAA4B,0DAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,iCAAiC;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,IAAI,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/events/SnapEvent.js","webpack://@vaadin/bundles/./node_modules/ol/interaction/Snap.js"],"sourcesContent":["/**\n * @module ol/events/SnapEvent\n */\nimport Event from './Event.js';\n\n/**\n * @enum {string}\n */\nexport const SnapEventType = {\n /**\n * Triggered upon snapping to vertex or edge\n * @event SnapEvent#snap\n * @api\n */\n SNAP: 'snap',\n UNSNAP: 'unsnap',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Snap~Snap} instances are instances of this\n */\nexport class SnapEvent extends Event {\n /**\n * @param {SnapEventType} type Type.\n * @param {Object} options Options.\n * @param {import(\"../coordinate.js\").Coordinate} options.vertex The snapped vertex.\n * @param {import(\"../coordinate.js\").Coordinate} options.vertexPixel The pixel of the snapped vertex.\n * @param {import(\"../Feature.js\").default} options.feature The feature being snapped.\n * @param {Array<import(\"../coordinate.js\").Coordinate>|null} options.segment Segment, or `null` if snapped to a vertex.\n */\n constructor(type, options) {\n super(type);\n /**\n * The Map coordinate of the snapped point.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.vertex = options.vertex;\n /**\n * The Map pixel of the snapped point.\n * @type {Array<number>&Array<number>}\n * @api\n */\n this.vertexPixel = options.vertexPixel;\n /**\n * The feature closest to the snapped point.\n * @type {import(\"../Feature.js\").default<import(\"../geom/Geometry.js\").default>}\n * @api\n */\n this.feature = options.feature;\n /**\n * The segment closest to the snapped point, if snapped to a segment.\n * @type {Array<import(\"../coordinate.js\").Coordinate>|null}\n * @api\n */\n this.segment = options.segment;\n }\n}\n","/**\n * @module ol/interaction/Snap\n */\nimport CollectionEventType from '../CollectionEventType.js';\nimport {\n closestOnCircle,\n closestOnSegment,\n squaredDistance,\n} from '../coordinate.js';\nimport EventType from '../events/EventType.js';\nimport {SnapEvent, SnapEventType} from '../events/SnapEvent.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {\n boundingExtent,\n buffer,\n createEmpty,\n intersects as intersectsExtent,\n} from '../extent.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport {getIntersectionPoint} from '../geom/flat/segments.js';\nimport {\n fromUserCoordinate,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport RBush from '../structs/RBush.js';\nimport {getUid} from '../util.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Array<import(\"../coordinate.js\").Coordinate>} Segment\n * An array of two coordinates representing a line segment, or an array of one\n * coordinate representing a point.\n */\n\n/**\n * @typedef {Object} SegmentData\n * @property {import(\"../Feature.js\").default} feature Feature.\n * @property {Segment} segment Segment.\n * @property {boolean} [isIntersection] Is intersection.\n */\n\n/**\n * @template {import(\"../geom/Geometry.js\").default} [GeometryType=import(\"../geom/Geometry.js\").default]\n * @typedef {(geometry: GeometryType, projection?: import(\"../proj/Projection.js\").default) => Array<Segment>} Segmenter\n * A function taking a {@link module:ol/geom/Geometry~Geometry} as argument and returning an array of {@link Segment}s.\n */\n\n/**\n * Each segmenter specified here will override the default segmenter for the\n * corresponding geometry type. To exclude all geometries of a specific geometry type from being snapped to,\n * set the segmenter to `null`.\n * @typedef {Object} Segmenters\n * @property {Segmenter<import(\"../geom/Point.js\").default>|null} [Point] Point segmenter.\n * @property {Segmenter<import(\"../geom/LineString.js\").default>|null} [LineString] LineString segmenter.\n * @property {Segmenter<import(\"../geom/Polygon.js\").default>|null} [Polygon] Polygon segmenter.\n * @property {Segmenter<import(\"../geom/Circle.js\").default>|null} [Circle] Circle segmenter.\n * @property {Segmenter<import(\"../geom/GeometryCollection.js\").default>|null} [GeometryCollection] GeometryCollection segmenter.\n * @property {Segmenter<import(\"../geom/MultiPoint.js\").default>|null} [MultiPoint] MultiPoint segmenter.\n * @property {Segmenter<import(\"../geom/MultiLineString.js\").default>|null} [MultiLineString] MultiLineString segmenter.\n * @property {Segmenter<import(\"../geom/MultiPolygon.js\").default>|null} [MultiPolygon] MultiPolygon segmenter.\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../Collection.js\").default<import(\"../Feature.js\").default>} [features] Snap to these features. Either this option or source should be provided.\n * @property {import(\"../source/Vector.js\").default} [source] Snap to features from this source. Either this option or features should be provided\n * @property {boolean} [edge=true] Snap to edges.\n * @property {boolean} [vertex=true] Snap to vertices.\n * @property {boolean} [intersection=false] Snap to intersections between segments.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or\n * vertex for snapping.\n * @property {Segmenters} [segmenters] Custom segmenters by {@link module:ol/geom/Geometry~Type}. By default, the\n * following segmenters are used:\n * - `Point`: A one-dimensional segment (e.g. `[[10, 20]]`) representing the point.\n * - `LineString`: One two-dimensional segment (e.g. `[[10, 20], [30, 40]]`) for each segment of the linestring.\n * - `Polygon`: One two-dimensional segment for each segment of the exterior ring and the interior rings.\n * - `Circle`: One two-dimensional segment for each segment of a regular polygon with 32 points representing the circle circumference.\n * - `GeometryCollection`: All segments of the contained geometries.\n * - `MultiPoint`: One one-dimensional segment for each point.\n * - `MultiLineString`: One two-dimensional segment for each segment of the linestrings.\n * - `MultiPolygon`: One two-dimensional segment for each segment of the polygons.\n */\n\n/**\n * Information about the last snapped state.\n * @typedef {Object} SnappedInfo\n * @property {import(\"../coordinate.js\").Coordinate|null} vertex - The snapped vertex.\n * @property {import(\"../pixel.js\").Pixel|null} vertexPixel - The pixel of the snapped vertex.\n * @property {import(\"../Feature.js\").default|null} feature - The feature being snapped.\n * @property {Segment|null} segment - Segment, or `null` if snapped to a vertex.\n */\n\n/***\n * @type {Object<string, Segmenter>}\n */\nconst GEOMETRY_SEGMENTERS = {\n /**\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {Array<Segment>} Segments\n */\n Circle(geometry, projection) {\n let circleGeometry = geometry;\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n const polygon = fromCircle(circleGeometry);\n if (userProjection) {\n polygon.transform(projection, userProjection);\n }\n return GEOMETRY_SEGMENTERS.Polygon(polygon);\n },\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {Array<Segment>} Segments\n */\n GeometryCollection(geometry, projection) {\n /** @type {Array<Array<Segment>>} */\n const segments = [];\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const segmenter = GEOMETRY_SEGMENTERS[geometries[i].getType()];\n if (segmenter) {\n segments.push(segmenter(geometries[i], projection));\n }\n }\n return segments.flat();\n },\n\n /**\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n LineString(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n for (let i = 0, ii = coordinates.length - stride; i < ii; i += stride) {\n segments.push([\n coordinates.slice(i, i + 2),\n coordinates.slice(i + stride, i + stride + 2),\n ]);\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiLineString(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const ends = geometry.getEnds();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n for (let j = offset, jj = end - stride; j < jj; j += stride) {\n segments.push([\n coordinates.slice(j, j + 2),\n coordinates.slice(j + stride, j + stride + 2),\n ]);\n }\n offset = end;\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiPoint(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n for (let i = 0, ii = coordinates.length; i < ii; i += stride) {\n segments.push([coordinates.slice(i, i + 2)]);\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiPolygon(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const endss = geometry.getEndss();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n for (let k = offset, kk = end - stride; k < kk; k += stride) {\n segments.push([\n coordinates.slice(k, k + 2),\n coordinates.slice(k + stride, k + stride + 2),\n ]);\n }\n offset = end;\n }\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n Point(geometry) {\n return [[geometry.getFlatCoordinates().slice(0, 2)]];\n },\n\n /**\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n Polygon(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const ends = geometry.getEnds();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n for (let j = offset, jj = end - stride; j < jj; j += stride) {\n segments.push([\n coordinates.slice(j, j + 2),\n coordinates.slice(j + stride, j + stride + 2),\n ]);\n }\n offset = end;\n }\n return segments;\n },\n};\n\n/**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @return {import(\"../Feature.js\").default|null} Feature.\n */\nfunction getFeatureFromEvent(evt) {\n if (\n /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt).feature\n ) {\n return /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt)\n .feature;\n }\n if (\n /** @type {import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} */ (\n evt\n ).element\n ) {\n return /** @type {import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} */ (\n evt\n ).element;\n }\n return null;\n}\n\nconst tempSegment = [];\n/** @type {Array<import('../extent.js').Extent>} */\nconst tempExtents = [];\n/** @type {Array<SegmentData>} */\nconst tempSegmentData = [];\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<'snap'|'unsnap', SnapEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'snap'|'unsnap', Return>} SnapOnSignature\n */\n\n/**\n * @classdesc\n * Handles snapping of vector features while modifying or drawing them. The\n * features can come from a {@link module:ol/source/Vector~VectorSource} or {@link module:ol/Collection~Collection}\n * Any interaction object that allows the user to interact\n * with the features using the mouse can benefit from the snapping, as long\n * as it is added before.\n *\n * The snap interaction modifies map browser event `coordinate` and `pixel`\n * properties to force the snap to occur to any interaction that uses them.\n *\n * Example:\n *\n * import Snap from 'ol/interaction/Snap.js';\n *\n * const snap = new Snap({\n * source: source\n * });\n *\n * map.addInteraction(snap);\n *\n * @fires SnapEvent\n * @api\n */\nclass Snap extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.handleDownEvent) {\n pointerOptions.handleDownEvent = TRUE;\n }\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /***\n * @type {SnapOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {SnapOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {SnapOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {import(\"../source/Vector.js\").default|null}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.vertex_ = options.vertex !== undefined ? options.vertex : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.edge_ = options.edge !== undefined ? options.edge : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.intersection_ =\n options.intersection !== undefined ? options.intersection : false;\n\n /**\n * @type {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|null}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * @type {Array<import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featuresListenerKeys_ = [];\n\n /**\n * @type {Object<string, import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featureChangeListenerKeys_ = {};\n\n /**\n * Extents are preserved so indexed segment can be quickly removed\n * when its feature geometry changes\n * @type {Object<string, import(\"../extent.js\").Extent>}\n * @private\n */\n this.indexedFeaturesExtents_ = {};\n\n /**\n * If a feature geometry changes while a pointer drag|move event occurs, the\n * feature doesn't get updated right away. It will be at the next 'pointerup'\n * event fired.\n * @type {!Object<string, import(\"../Feature.js\").default>}\n * @private\n */\n this.pendingFeatures_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Segment RTree for each layer\n * @type {import(\"../structs/RBush.js\").default<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * Holds information about the last snapped state.\n * @type {SnappedInfo|null}\n * @private\n */\n this.snapped_ = null;\n\n /**\n * @type {Object<string, Segmenter>}\n * @private\n */\n this.segmenters_ = Object.assign(\n {},\n GEOMETRY_SEGMENTERS,\n options.segmenters,\n );\n }\n\n /**\n * Add a feature to the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {boolean} [register] Whether to listen to the feature change or not\n * Defaults to `true`.\n * @api\n */\n addFeature(feature, register) {\n register = register !== undefined ? register : true;\n const feature_uid = getUid(feature);\n const geometry = feature.getGeometry();\n if (geometry) {\n const segmenter = this.segmenters_[geometry.getType()];\n if (segmenter) {\n this.indexedFeaturesExtents_[feature_uid] =\n geometry.getExtent(createEmpty());\n const segments = segmenter(\n geometry,\n this.getMap().getView().getProjection(),\n );\n let segmentCount = segments.length;\n for (let i = 0; i < segmentCount; ++i) {\n const segment = segments[i];\n tempExtents[i] = boundingExtent(segment);\n tempSegmentData[i] = {\n feature: feature,\n segment: segment,\n };\n }\n tempExtents.length = segmentCount;\n tempSegmentData.length = segmentCount;\n\n if (this.intersection_) {\n for (let j = 0, jj = segments.length; j < jj; ++j) {\n const segment = segments[j];\n if (segment.length === 1) {\n continue;\n }\n const extent = tempExtents[j];\n // Calculate intersections with own segments\n for (let k = 0, kk = segments.length; k < kk; ++k) {\n if (j === k || j - 1 === k || j + 1 === k) {\n // Exclude self and neighbours\n continue;\n }\n const otherSegment = segments[k];\n if (!intersectsExtent(extent, tempExtents[k])) {\n continue;\n }\n const intersection = getIntersectionPoint(segment, otherSegment);\n if (!intersection) {\n continue;\n }\n const intersectionSegment = [intersection];\n tempExtents[segmentCount] = boundingExtent(intersectionSegment);\n tempSegmentData[segmentCount++] = {\n feature,\n segment: intersectionSegment,\n isIntersection: true,\n };\n }\n // Calculate intersections with existing segments\n const otherSegments = this.rBush_.getInExtent(tempExtents[j]);\n for (const {segment: otherSegment} of otherSegments) {\n if (otherSegment.length === 1) {\n continue;\n }\n const intersection = getIntersectionPoint(segment, otherSegment);\n if (!intersection) {\n continue;\n }\n const intersectionSegment = [intersection];\n tempExtents[segmentCount] = boundingExtent(intersectionSegment);\n tempSegmentData[segmentCount++] = {\n feature,\n segment: intersectionSegment,\n isIntersection: true,\n };\n }\n }\n }\n\n if (segmentCount === 1) {\n this.rBush_.insert(tempExtents[0], tempSegmentData[0]);\n } else {\n this.rBush_.load(tempExtents, tempSegmentData);\n }\n }\n }\n\n if (register) {\n this.featureChangeListenerKeys_[feature_uid] = listen(\n feature,\n EventType.CHANGE,\n this.handleFeatureChange_,\n this,\n );\n }\n }\n\n /**\n * @return {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|Array<import(\"../Feature.js\").default>} Features.\n * @private\n */\n getFeatures_() {\n /** @type {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|Array<import(\"../Feature.js\").default>} */\n let features;\n if (this.features_) {\n features = this.features_;\n } else if (this.source_) {\n features = this.source_.getFeatures();\n }\n return features;\n }\n\n /**\n * Checks if two snap data sets are equal.\n * Compares the segment and the feature.\n *\n * @param {SnappedInfo} data1 The first snap data set.\n * @param {SnappedInfo} data2 The second snap data set.\n * @return {boolean} `true` if the data sets are equal, otherwise `false`.\n * @private\n */\n areSnapDataEqual_(data1, data2) {\n return data1.segment === data2.segment && data1.feature === data2.feature;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(evt) {\n const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);\n\n if (result) {\n evt.coordinate = result.vertex.slice(0, 2);\n evt.pixel = result.vertexPixel;\n\n // Dispatch UNSNAP event if already snapped\n if (this.snapped_ && !this.areSnapDataEqual_(this.snapped_, result)) {\n this.dispatchEvent(new SnapEvent(SnapEventType.UNSNAP, this.snapped_));\n }\n\n this.snapped_ = {\n vertex: evt.coordinate,\n vertexPixel: evt.pixel,\n feature: result.feature,\n segment: result.segment,\n };\n this.dispatchEvent(new SnapEvent(SnapEventType.SNAP, this.snapped_));\n } else if (this.snapped_) {\n // Dispatch UNSNAP event if no longer snapped\n this.dispatchEvent(new SnapEvent(SnapEventType.UNSNAP, this.snapped_));\n this.snapped_ = null;\n }\n\n return super.handleEvent(evt);\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n const feature = getFeatureFromEvent(evt);\n if (feature) {\n this.addFeature(feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n const feature = getFeatureFromEvent(evt);\n if (feature) {\n this.removeFeature(feature);\n }\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n const feature = /** @type {import(\"../Feature.js\").default} */ (evt.target);\n if (this.handlingDownUpSequence) {\n const uid = getUid(feature);\n if (!(uid in this.pendingFeatures_)) {\n this.pendingFeatures_[uid] = feature;\n }\n } else {\n this.updateFeature_(feature);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(evt) {\n const featuresToUpdate = Object.values(this.pendingFeatures_);\n if (featuresToUpdate.length) {\n for (const feature of featuresToUpdate) {\n this.updateFeature_(feature);\n }\n }\n return false;\n }\n\n /**\n * Remove a feature from the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {boolean} [unlisten] Whether to unlisten to the feature change\n * or not. Defaults to `true`.\n * @api\n */\n removeFeature(feature, unlisten) {\n const unregister = unlisten !== undefined ? unlisten : true;\n const feature_uid = getUid(feature);\n const extent = this.indexedFeaturesExtents_[feature_uid];\n if (extent) {\n const rBush = this.rBush_;\n const nodesToRemove = [];\n rBush.forEachInExtent(extent, function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n });\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n rBush.remove(nodesToRemove[i]);\n }\n }\n\n if (unregister) {\n unlistenByKey(this.featureChangeListenerKeys_[feature_uid]);\n delete this.featureChangeListenerKeys_[feature_uid];\n }\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 const currentMap = this.getMap();\n const keys = this.featuresListenerKeys_;\n let features = this.getFeatures_();\n if (!Array.isArray(features)) {\n features = features.getArray();\n }\n\n if (currentMap) {\n keys.forEach(unlistenByKey);\n keys.length = 0;\n this.rBush_.clear();\n Object.values(this.featureChangeListenerKeys_).forEach(unlistenByKey);\n this.featureChangeListenerKeys_ = {};\n }\n super.setMap(map);\n\n if (map) {\n if (this.features_) {\n keys.push(\n listen(\n this.features_,\n CollectionEventType.ADD,\n this.handleFeatureAdd_,\n this,\n ),\n listen(\n this.features_,\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_,\n this,\n ),\n );\n } else if (this.source_) {\n keys.push(\n listen(\n this.source_,\n VectorEventType.ADDFEATURE,\n this.handleFeatureAdd_,\n this,\n ),\n listen(\n this.source_,\n VectorEventType.REMOVEFEATURE,\n this.handleFeatureRemove_,\n this,\n ),\n );\n }\n for (const feature of features) {\n this.addFeature(feature);\n }\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate Coordinate\n * @param {import(\"../Map.js\").default} map Map.\n * @return {SnappedInfo|null} Snap result\n */\n snapTo(pixel, pixelCoordinate, map) {\n const projection = map.getView().getProjection();\n const projectedCoordinate = fromUserCoordinate(pixelCoordinate, projection);\n\n const box = toUserExtent(\n buffer(\n boundingExtent([projectedCoordinate]),\n map.getView().getResolution() * this.pixelTolerance_,\n ),\n projection,\n );\n\n const segments = this.rBush_.getInExtent(box);\n const segmentsLength = segments.length;\n if (segmentsLength === 0) {\n return null;\n }\n\n let closestVertex;\n let minSquaredDistance = Infinity;\n let closestFeature;\n let closestSegment = null;\n let isIntersection;\n\n const squaredPixelTolerance = this.pixelTolerance_ * this.pixelTolerance_;\n const getResult = () => {\n if (closestVertex) {\n const vertexPixel = map.getPixelFromCoordinate(closestVertex);\n const squaredPixelDistance = squaredDistance(pixel, vertexPixel);\n if (\n squaredPixelDistance <= squaredPixelTolerance &&\n ((isIntersection && this.intersection_) ||\n (!isIntersection && (this.vertex_ || this.edge_)))\n ) {\n return {\n vertex: closestVertex,\n vertexPixel: [\n Math.round(vertexPixel[0]),\n Math.round(vertexPixel[1]),\n ],\n feature: closestFeature,\n segment: closestSegment,\n };\n }\n }\n return null;\n };\n\n if (this.vertex_ || this.intersection_) {\n for (let i = 0; i < segmentsLength; ++i) {\n const segmentData = segments[i];\n if (segmentData.feature.getGeometry().getType() !== 'Circle') {\n for (const vertex of segmentData.segment) {\n const tempVertexCoord = fromUserCoordinate(vertex, projection);\n const delta = squaredDistance(projectedCoordinate, tempVertexCoord);\n if (delta < minSquaredDistance) {\n closestVertex = vertex;\n minSquaredDistance = delta;\n closestFeature = segmentData.feature;\n isIntersection = segmentData.isIntersection;\n }\n }\n }\n }\n const result = getResult();\n if (result) {\n return result;\n }\n }\n\n if (this.edge_) {\n for (let i = 0; i < segmentsLength; ++i) {\n let vertex = null;\n const segmentData = segments[i];\n if (segmentData.feature.getGeometry().getType() === 'Circle') {\n let circleGeometry = segmentData.feature.getGeometry();\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n vertex = closestOnCircle(\n projectedCoordinate,\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry),\n );\n } else {\n const [segmentStart, segmentEnd] = segmentData.segment;\n // points have only one coordinate\n if (segmentEnd) {\n tempSegment[0] = fromUserCoordinate(segmentStart, projection);\n tempSegment[1] = fromUserCoordinate(segmentEnd, projection);\n vertex = closestOnSegment(projectedCoordinate, tempSegment);\n }\n }\n if (vertex) {\n const delta = squaredDistance(projectedCoordinate, vertex);\n if (delta < minSquaredDistance) {\n closestVertex = toUserCoordinate(vertex, projection);\n closestSegment =\n segmentData.feature.getGeometry().getType() === 'Circle'\n ? null\n : segmentData.segment;\n minSquaredDistance = delta;\n closestFeature = segmentData.feature;\n }\n }\n }\n\n const result = getResult();\n if (result) {\n return result;\n }\n }\n\n return null;\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @private\n */\n updateFeature_(feature) {\n this.removeFeature(feature, false);\n this.addFeature(feature, false);\n }\n}\n\nexport default Snap;\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_interaction_Translate_js"],{
|
|
2
|
+
|
|
3
|
+
/***/ "./node_modules/ol/interaction/Translate.js":
|
|
4
|
+
/*!**************************************************!*\
|
|
5
|
+
!*** ./node_modules/ol/interaction/Translate.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 */ "TranslateEvent": () => (/* binding */ TranslateEvent),
|
|
12
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
|
+
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
|
|
15
|
+
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
|
|
16
|
+
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
|
|
17
|
+
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
|
|
18
|
+
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
|
|
19
|
+
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
|
|
20
|
+
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
|
|
21
|
+
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/interaction/Property.js");
|
|
22
|
+
/**
|
|
23
|
+
* @module ol/interaction/Translate
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @enum {string}
|
|
36
|
+
*/
|
|
37
|
+
const TranslateEventType = {
|
|
38
|
+
/**
|
|
39
|
+
* Triggered upon feature translation start.
|
|
40
|
+
* @event TranslateEvent#translatestart
|
|
41
|
+
* @api
|
|
42
|
+
*/
|
|
43
|
+
TRANSLATESTART: 'translatestart',
|
|
44
|
+
/**
|
|
45
|
+
* Triggered upon feature translation.
|
|
46
|
+
* @event TranslateEvent#translating
|
|
47
|
+
* @api
|
|
48
|
+
*/
|
|
49
|
+
TRANSLATING: 'translating',
|
|
50
|
+
/**
|
|
51
|
+
* Triggered upon feature translation end.
|
|
52
|
+
* @event TranslateEvent#translateend
|
|
53
|
+
* @api
|
|
54
|
+
*/
|
|
55
|
+
TRANSLATEEND: 'translateend',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A function that takes a {@link module:ol/Feature~Feature} or
|
|
60
|
+
* {@link module:ol/render/Feature~RenderFeature} and a
|
|
61
|
+
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
62
|
+
* translated or `false` otherwise.
|
|
63
|
+
* @typedef {function(Feature, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {Object} Options
|
|
68
|
+
* @property {import("../events/condition.js").Condition} [condition] A function that
|
|
69
|
+
* takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
70
|
+
* boolean to indicate whether that event should be handled.
|
|
71
|
+
* Default is {@link module:ol/events/condition.always}.
|
|
72
|
+
* @property {Collection<Feature>} [features] Features contained in this collection will be able to be translated together.
|
|
73
|
+
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers] A list of layers from which features should be
|
|
74
|
+
* translated. Alternatively, a filter function can be provided. The
|
|
75
|
+
* function will be called for each layer in the map and should return
|
|
76
|
+
* `true` for layers that you want to be translatable. If the option is
|
|
77
|
+
* absent, all visible layers will be considered translatable.
|
|
78
|
+
* Not used if `features` is provided.
|
|
79
|
+
* @property {FilterFunction} [filter] A function
|
|
80
|
+
* that takes a {@link module:ol/Feature~Feature} and an
|
|
81
|
+
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
82
|
+
* translated or `false` otherwise. Not used if `features` is provided.
|
|
83
|
+
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
|
|
84
|
+
* will be checked for features.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @classdesc
|
|
89
|
+
* Events emitted by {@link module:ol/interaction/Translate~Translate} instances
|
|
90
|
+
* are instances of this type.
|
|
91
|
+
*/
|
|
92
|
+
class TranslateEvent extends _events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
93
|
+
/**
|
|
94
|
+
* @param {TranslateEventType} type Type.
|
|
95
|
+
* @param {Collection<Feature>} features The features translated.
|
|
96
|
+
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
|
97
|
+
* @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started
|
|
98
|
+
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
|
99
|
+
*/
|
|
100
|
+
constructor(type, features, coordinate, startCoordinate, mapBrowserEvent) {
|
|
101
|
+
super(type);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The features being translated.
|
|
105
|
+
* @type {Collection<Feature>}
|
|
106
|
+
* @api
|
|
107
|
+
*/
|
|
108
|
+
this.features = features;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The coordinate of the drag event.
|
|
112
|
+
* @const
|
|
113
|
+
* @type {import("../coordinate.js").Coordinate}
|
|
114
|
+
* @api
|
|
115
|
+
*/
|
|
116
|
+
this.coordinate = coordinate;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The coordinate of the start position before translation started.
|
|
120
|
+
* @const
|
|
121
|
+
* @type {import("../coordinate.js").Coordinate}
|
|
122
|
+
* @api
|
|
123
|
+
*/
|
|
124
|
+
this.startCoordinate = startCoordinate;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
|
128
|
+
* @type {import("../MapBrowserEvent.js").default}
|
|
129
|
+
* @api
|
|
130
|
+
*/
|
|
131
|
+
this.mapBrowserEvent = mapBrowserEvent;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/***
|
|
136
|
+
* @template Return
|
|
137
|
+
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
|
138
|
+
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
|
139
|
+
* 'change:active', import("../Object").ObjectEvent, Return> &
|
|
140
|
+
* import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent, Return> &
|
|
141
|
+
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
|
142
|
+
* 'change:active'|'translateend'|'translatestart'|'translating', Return>} TranslateOnSignature
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @classdesc
|
|
147
|
+
* Interaction for translating (moving) features.
|
|
148
|
+
* If you want to translate multiple features in a single action (for example,
|
|
149
|
+
* the collection used by a select interaction), construct the interaction with
|
|
150
|
+
* the `features` option.
|
|
151
|
+
*
|
|
152
|
+
* @fires TranslateEvent
|
|
153
|
+
* @api
|
|
154
|
+
*/
|
|
155
|
+
class Translate extends _Pointer_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
156
|
+
/**
|
|
157
|
+
* @param {Options} [options] Options.
|
|
158
|
+
*/
|
|
159
|
+
constructor(options) {
|
|
160
|
+
options = options ? options : {};
|
|
161
|
+
|
|
162
|
+
super(/** @type {import("./Pointer.js").Options} */ (options));
|
|
163
|
+
|
|
164
|
+
/***
|
|
165
|
+
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
|
166
|
+
*/
|
|
167
|
+
this.on;
|
|
168
|
+
|
|
169
|
+
/***
|
|
170
|
+
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
|
171
|
+
*/
|
|
172
|
+
this.once;
|
|
173
|
+
|
|
174
|
+
/***
|
|
175
|
+
* @type {TranslateOnSignature<void>}
|
|
176
|
+
*/
|
|
177
|
+
this.un;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The last position we translated to.
|
|
181
|
+
* @type {import("../coordinate.js").Coordinate}
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
this.lastCoordinate_ = null;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The start position before translation started.
|
|
188
|
+
* @type {import("../coordinate.js").Coordinate}
|
|
189
|
+
* @private
|
|
190
|
+
*/
|
|
191
|
+
this.startCoordinate_ = null;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @type {Collection<Feature>|null}
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
this.features_ = options.features !== undefined ? options.features : null;
|
|
198
|
+
|
|
199
|
+
/** @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} */
|
|
200
|
+
let layerFilter;
|
|
201
|
+
if (options.layers && !this.features_) {
|
|
202
|
+
if (typeof options.layers === 'function') {
|
|
203
|
+
layerFilter = options.layers;
|
|
204
|
+
} else {
|
|
205
|
+
const layers = options.layers;
|
|
206
|
+
layerFilter = function (layer) {
|
|
207
|
+
return layers.includes(layer);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
layerFilter = _functions_js__WEBPACK_IMPORTED_MODULE_3__.TRUE;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @private
|
|
216
|
+
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
|
|
217
|
+
*/
|
|
218
|
+
this.layerFilter_ = layerFilter;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @private
|
|
222
|
+
* @type {FilterFunction}
|
|
223
|
+
*/
|
|
224
|
+
this.filter_ = options.filter && !this.features_ ? options.filter : _functions_js__WEBPACK_IMPORTED_MODULE_3__.TRUE;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @private
|
|
228
|
+
* @type {number}
|
|
229
|
+
*/
|
|
230
|
+
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @private
|
|
234
|
+
* @type {import("../events/condition.js").Condition}
|
|
235
|
+
*/
|
|
236
|
+
this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_4__.always;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @type {Feature}
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
this.lastFeature_ = null;
|
|
243
|
+
|
|
244
|
+
this.addChangeListener(
|
|
245
|
+
_Property_js__WEBPACK_IMPORTED_MODULE_5__["default"].ACTIVE,
|
|
246
|
+
this.handleActiveChanged_,
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Handle pointer down events.
|
|
252
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
253
|
+
* @return {boolean} If the event was consumed.
|
|
254
|
+
* @override
|
|
255
|
+
*/
|
|
256
|
+
handleDownEvent(event) {
|
|
257
|
+
if (!event.originalEvent || !this.condition_(event)) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
|
|
261
|
+
if (!this.lastCoordinate_ && this.lastFeature_) {
|
|
262
|
+
this.startCoordinate_ = event.coordinate;
|
|
263
|
+
this.lastCoordinate_ = event.coordinate;
|
|
264
|
+
this.handleMoveEvent(event);
|
|
265
|
+
|
|
266
|
+
const features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_6__["default"]([this.lastFeature_]);
|
|
267
|
+
|
|
268
|
+
this.dispatchEvent(
|
|
269
|
+
new TranslateEvent(
|
|
270
|
+
TranslateEventType.TRANSLATESTART,
|
|
271
|
+
features,
|
|
272
|
+
event.coordinate,
|
|
273
|
+
this.startCoordinate_,
|
|
274
|
+
event,
|
|
275
|
+
),
|
|
276
|
+
);
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Handle pointer up events.
|
|
284
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
285
|
+
* @return {boolean} If the event was consumed.
|
|
286
|
+
* @override
|
|
287
|
+
*/
|
|
288
|
+
handleUpEvent(event) {
|
|
289
|
+
if (this.lastCoordinate_) {
|
|
290
|
+
this.lastCoordinate_ = null;
|
|
291
|
+
this.handleMoveEvent(event);
|
|
292
|
+
|
|
293
|
+
const features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_6__["default"]([this.lastFeature_]);
|
|
294
|
+
|
|
295
|
+
this.dispatchEvent(
|
|
296
|
+
new TranslateEvent(
|
|
297
|
+
TranslateEventType.TRANSLATEEND,
|
|
298
|
+
features,
|
|
299
|
+
event.coordinate,
|
|
300
|
+
this.startCoordinate_,
|
|
301
|
+
event,
|
|
302
|
+
),
|
|
303
|
+
);
|
|
304
|
+
// cleanup
|
|
305
|
+
this.startCoordinate_ = null;
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Handle pointer drag events.
|
|
313
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
314
|
+
* @override
|
|
315
|
+
*/
|
|
316
|
+
handleDragEvent(event) {
|
|
317
|
+
if (this.lastCoordinate_) {
|
|
318
|
+
const newCoordinate = event.coordinate;
|
|
319
|
+
const projection = event.map.getView().getProjection();
|
|
320
|
+
|
|
321
|
+
const newViewCoordinate = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(newCoordinate, projection);
|
|
322
|
+
const lastViewCoordinate = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.fromUserCoordinate)(
|
|
323
|
+
this.lastCoordinate_,
|
|
324
|
+
projection,
|
|
325
|
+
);
|
|
326
|
+
const deltaX = newViewCoordinate[0] - lastViewCoordinate[0];
|
|
327
|
+
const deltaY = newViewCoordinate[1] - lastViewCoordinate[1];
|
|
328
|
+
|
|
329
|
+
const features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_6__["default"]([this.lastFeature_]);
|
|
330
|
+
const userProjection = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getUserProjection)();
|
|
331
|
+
|
|
332
|
+
features.forEach(function (feature) {
|
|
333
|
+
const geom = feature.getGeometry();
|
|
334
|
+
if (userProjection) {
|
|
335
|
+
geom.transform(userProjection, projection);
|
|
336
|
+
geom.translate(deltaX, deltaY);
|
|
337
|
+
geom.transform(projection, userProjection);
|
|
338
|
+
} else {
|
|
339
|
+
geom.translate(deltaX, deltaY);
|
|
340
|
+
}
|
|
341
|
+
feature.setGeometry(geom);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
this.lastCoordinate_ = newCoordinate;
|
|
345
|
+
|
|
346
|
+
this.dispatchEvent(
|
|
347
|
+
new TranslateEvent(
|
|
348
|
+
TranslateEventType.TRANSLATING,
|
|
349
|
+
features,
|
|
350
|
+
newCoordinate,
|
|
351
|
+
this.startCoordinate_,
|
|
352
|
+
event,
|
|
353
|
+
),
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Handle pointer move events.
|
|
360
|
+
* @param {import("../MapBrowserEvent.js").default} event Event.
|
|
361
|
+
* @override
|
|
362
|
+
*/
|
|
363
|
+
handleMoveEvent(event) {
|
|
364
|
+
const elem = event.map.getViewport();
|
|
365
|
+
|
|
366
|
+
// Change the cursor to grab/grabbing if hovering any of the features managed
|
|
367
|
+
// by the interaction
|
|
368
|
+
if (this.featuresAtPixel_(event.pixel, event.map)) {
|
|
369
|
+
elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');
|
|
370
|
+
elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');
|
|
371
|
+
} else {
|
|
372
|
+
elem.classList.remove('ol-grab', 'ol-grabbing');
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Tests to see if the given coordinates intersects any of our selected
|
|
378
|
+
* features.
|
|
379
|
+
* @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
|
|
380
|
+
* @param {import("../Map.js").default} map Map to test the intersection on.
|
|
381
|
+
* @return {Feature} Returns the feature found at the specified pixel
|
|
382
|
+
* coordinates.
|
|
383
|
+
* @private
|
|
384
|
+
*/
|
|
385
|
+
featuresAtPixel_(pixel, map) {
|
|
386
|
+
return map.forEachFeatureAtPixel(
|
|
387
|
+
pixel,
|
|
388
|
+
(feature, layer) => {
|
|
389
|
+
if (!(feature instanceof _Feature_js__WEBPACK_IMPORTED_MODULE_7__["default"]) || !this.filter_(feature, layer)) {
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
if (this.features_ && !this.features_.getArray().includes(feature)) {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
return feature;
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
layerFilter: this.layerFilter_,
|
|
399
|
+
hitTolerance: this.hitTolerance_,
|
|
400
|
+
},
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Returns the Hit-detection tolerance.
|
|
406
|
+
* @return {number} Hit tolerance in pixels.
|
|
407
|
+
* @api
|
|
408
|
+
*/
|
|
409
|
+
getHitTolerance() {
|
|
410
|
+
return this.hitTolerance_;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Hit-detection tolerance. Pixels inside the radius around the given position
|
|
415
|
+
* will be checked for features.
|
|
416
|
+
* @param {number} hitTolerance Hit tolerance in pixels.
|
|
417
|
+
* @api
|
|
418
|
+
*/
|
|
419
|
+
setHitTolerance(hitTolerance) {
|
|
420
|
+
this.hitTolerance_ = hitTolerance;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Remove the interaction from its current map and attach it to the new map.
|
|
425
|
+
* Subclasses may set up event handlers to get notified about changes to
|
|
426
|
+
* the map here.
|
|
427
|
+
* @param {import("../Map.js").default} map Map.
|
|
428
|
+
* @override
|
|
429
|
+
*/
|
|
430
|
+
setMap(map) {
|
|
431
|
+
const oldMap = this.getMap();
|
|
432
|
+
super.setMap(map);
|
|
433
|
+
this.updateState_(oldMap);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
handleActiveChanged_() {
|
|
440
|
+
this.updateState_(null);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @param {import("../Map.js").default} oldMap Old map.
|
|
445
|
+
* @private
|
|
446
|
+
*/
|
|
447
|
+
updateState_(oldMap) {
|
|
448
|
+
let map = this.getMap();
|
|
449
|
+
const active = this.getActive();
|
|
450
|
+
if (!map || !active) {
|
|
451
|
+
map = map || oldMap;
|
|
452
|
+
if (map) {
|
|
453
|
+
const elem = map.getViewport();
|
|
454
|
+
elem.classList.remove('ol-grab', 'ol-grabbing');
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Translate);
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
/***/ })
|
|
464
|
+
|
|
465
|
+
}])
|
|
466
|
+
//# sourceMappingURL=vendors-node_modules_ol_interaction_Translate_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_ol_interaction_Translate_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC0C;AACN;AACG;AACO;AACT;AAC4B;AACnB;AACE;;AAEhD;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,iCAAiC;AAC7D,IAAI,8CAA8C;AAClD,IAAI,mCAAmC;AACvC;AACA,aAAa,oGAAoG;AACjH;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,4CAA4C;AAC1D,YAAY,iDAAiD;AAC7D;AACA,eAAe,wCAAwC;AACvD,cAAc,qBAAqB;AACnC,cAAc,uIAAuI;AACrJ;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B,iBAAiB,iCAAiC;AAClD,IAAI,mCAAmC;AACvC;AACA,cAAc,QAAQ;AACtB;AACA;;AAEA;AACA;AACA,sBAAsB,iDAAiD;AACvE;AACA;AACO,6BAA6B,wDAAK;AACzC;AACA,aAAa,oBAAoB;AACjC,aAAa,qBAAqB;AAClC,aAAa,uCAAuC;AACpD,aAAa,uCAAuC;AACpD,aAAa,yCAAyC;AACtD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,mBAAmB,gDAAgD;AACnE,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+EAA+E;AAC/E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mDAAkB;AAC1C;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;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA,eAAe,4FAA4F;AAC3G;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,oBAAoB,+CAAI;AACxB;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,wEAAwE,+CAAI;;AAE5E;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,8DAA8D,wDAAM;;AAEpE;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,MAAM,2DAA0B;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6CAA6C,sDAAU;;AAEvD;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;;AAEA,6CAA6C,sDAAU;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,4DAAkB;AAClD,iCAAiC,4DAAkB;AACnD;AACA;AACA;AACA;AACA;;AAEA,6CAA6C,sDAAU;AACvD,6BAA6B,2DAAiB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,OAAO;;AAEP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C,aAAa,6BAA6B;AAC1C,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,mDAAO;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,SAAS,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/interaction/Translate.js"],"sourcesContent":["/**\n * @module ol/interaction/Translate\n */\nimport Collection from '../Collection.js';\nimport Feature from '../Feature.js';\nimport Event from '../events/Event.js';\nimport {always} from '../events/condition.js';\nimport {TRUE} from '../functions.js';\nimport {fromUserCoordinate, getUserProjection} from '../proj.js';\nimport PointerInteraction from './Pointer.js';\nimport InteractionProperty from './Property.js';\n\n/**\n * @enum {string}\n */\nconst TranslateEventType = {\n /**\n * Triggered upon feature translation start.\n * @event TranslateEvent#translatestart\n * @api\n */\n TRANSLATESTART: 'translatestart',\n /**\n * Triggered upon feature translation.\n * @event TranslateEvent#translating\n * @api\n */\n TRANSLATING: 'translating',\n /**\n * Triggered upon feature translation end.\n * @event TranslateEvent#translateend\n * @api\n */\n TRANSLATEEND: 'translateend',\n};\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} or\n * {@link module:ol/render/Feature~RenderFeature} and a\n * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be\n * translated or `false` otherwise.\n * @typedef {function(Feature, import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>):boolean} FilterFunction\n */\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 {Collection<Feature>} [features] Features contained in this collection will be able to be translated together.\n * @property {Array<import(\"../layer/Layer.js\").default>|function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} [layers] A list of layers from which features should be\n * translated. Alternatively, a filter function can be provided. The\n * function will be called for each layer in the map and should return\n * `true` for layers that you want to be translatable. If the option is\n * absent, all visible layers will be considered translatable.\n * Not used if `features` is provided.\n * @property {FilterFunction} [filter] A function\n * that takes a {@link module:ol/Feature~Feature} and an\n * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be\n * translated or `false` otherwise. Not used if `features` is provided.\n * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Translate~Translate} instances\n * are instances of this type.\n */\nexport class TranslateEvent extends Event {\n /**\n * @param {TranslateEventType} type Type.\n * @param {Collection<Feature>} features The features translated.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} startCoordinate The original coordinates before.translation started\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n */\n constructor(type, features, coordinate, startCoordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being translated.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * The coordinate of the start position before translation started.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.startCoordinate = startCoordinate;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\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<'translateend'|'translatestart'|'translating', TranslateEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'translateend'|'translatestart'|'translating', Return>} TranslateOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for translating (moving) features.\n * If you want to translate multiple features in a single action (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option.\n *\n * @fires TranslateEvent\n * @api\n */\nclass Translate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {TranslateOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {TranslateOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {TranslateOnSignature<void>}\n */\n this.un;\n\n /**\n * The last position we translated to.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.lastCoordinate_ = null;\n\n /**\n * The start position before translation started.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.startCoordinate_ = null;\n\n /**\n * @type {Collection<Feature>|null}\n * @private\n */\n this.features_ = options.features !== undefined ? options.features : null;\n\n /** @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} */\n let layerFilter;\n if (options.layers && !this.features_) {\n if (typeof options.layers === 'function') {\n layerFilter = options.layers;\n } else {\n const layers = options.layers;\n layerFilter = function (layer) {\n return layers.includes(layer);\n };\n }\n } else {\n layerFilter = TRUE;\n }\n\n /**\n * @private\n * @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean}\n */\n this.layerFilter_ = layerFilter;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter && !this.features_ ? options.filter : TRUE;\n\n /**\n * @private\n * @type {number}\n */\n this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : always;\n\n /**\n * @type {Feature}\n * @private\n */\n this.lastFeature_ = null;\n\n this.addChangeListener(\n InteractionProperty.ACTIVE,\n this.handleActiveChanged_,\n );\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(event) {\n if (!event.originalEvent || !this.condition_(event)) {\n return false;\n }\n this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);\n if (!this.lastCoordinate_ && this.lastFeature_) {\n this.startCoordinate_ = event.coordinate;\n this.lastCoordinate_ = event.coordinate;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATESTART,\n features,\n event.coordinate,\n this.startCoordinate_,\n event,\n ),\n );\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(event) {\n if (this.lastCoordinate_) {\n this.lastCoordinate_ = null;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATEEND,\n features,\n event.coordinate,\n this.startCoordinate_,\n event,\n ),\n );\n // cleanup\n this.startCoordinate_ = null;\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n handleDragEvent(event) {\n if (this.lastCoordinate_) {\n const newCoordinate = event.coordinate;\n const projection = event.map.getView().getProjection();\n\n const newViewCoordinate = fromUserCoordinate(newCoordinate, projection);\n const lastViewCoordinate = fromUserCoordinate(\n this.lastCoordinate_,\n projection,\n );\n const deltaX = newViewCoordinate[0] - lastViewCoordinate[0];\n const deltaY = newViewCoordinate[1] - lastViewCoordinate[1];\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n const userProjection = getUserProjection();\n\n features.forEach(function (feature) {\n const geom = feature.getGeometry();\n if (userProjection) {\n geom.transform(userProjection, projection);\n geom.translate(deltaX, deltaY);\n geom.transform(projection, userProjection);\n } else {\n geom.translate(deltaX, deltaY);\n }\n feature.setGeometry(geom);\n });\n\n this.lastCoordinate_ = newCoordinate;\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATING,\n features,\n newCoordinate,\n this.startCoordinate_,\n event,\n ),\n );\n }\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n handleMoveEvent(event) {\n const elem = event.map.getViewport();\n\n // Change the cursor to grab/grabbing if hovering any of the features managed\n // by the interaction\n if (this.featuresAtPixel_(event.pixel, event.map)) {\n elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');\n elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');\n } else {\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n\n /**\n * Tests to see if the given coordinates intersects any of our selected\n * features.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel coordinate to test for intersection.\n * @param {import(\"../Map.js\").default} map Map to test the intersection on.\n * @return {Feature} Returns the feature found at the specified pixel\n * coordinates.\n * @private\n */\n featuresAtPixel_(pixel, map) {\n return map.forEachFeatureAtPixel(\n pixel,\n (feature, layer) => {\n if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {\n return undefined;\n }\n if (this.features_ && !this.features_.getArray().includes(feature)) {\n return undefined;\n }\n return feature;\n },\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n },\n );\n }\n\n /**\n * Returns the Hit-detection tolerance.\n * @return {number} Hit tolerance in pixels.\n * @api\n */\n getHitTolerance() {\n return this.hitTolerance_;\n }\n\n /**\n * Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @api\n */\n setHitTolerance(hitTolerance) {\n this.hitTolerance_ = hitTolerance;\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 const oldMap = this.getMap();\n super.setMap(map);\n this.updateState_(oldMap);\n }\n\n /**\n * @private\n */\n handleActiveChanged_() {\n this.updateState_(null);\n }\n\n /**\n * @param {import(\"../Map.js\").default} oldMap Old map.\n * @private\n */\n updateState_(oldMap) {\n let map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n map = map || oldMap;\n if (map) {\n const elem = map.getViewport();\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n }\n}\n\nexport default Translate;\n"],"names":[],"sourceRoot":""}
|