Page and map scrolling work both now satisfying.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 11 Jan 2021 22:03:53 +0000 (23:03 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 11 Jan 2021 22:03:53 +0000 (23:03 +0100)
wrmap.js

index d7d051a8909fb624b7ed45868f981caeab8c4c52..f0ac4b69324a99f482544cdc5335e0ae9c8ebe48 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -229,16 +229,23 @@ function init_wrmap(i, jq_map) {
                        }
                }),
                interactions: ol.interaction.defaults({
-                       mouseWheelZoom: false
-               })
-       });
-
-
-       let select_hover = new ol.interaction.Select({
-               condition: ol.events.condition.pointerMove,
-               style: style_function_highlight,
+                       mouseWheelZoom: false,
+                       dragPan: false,
+               }).extend([
+                       new ol.interaction.DragPan({
+                               condition: function (event) {
+                                       return this.getPointerCount() === 2 || ol.events.condition.platformModifierKeyOnly(event);
+                               },
+                       }),
+                       new ol.interaction.MouseWheelZoom({
+                               condition: ol.events.condition.platformModifierKeyOnly,
+                       }),
+                       new ol.interaction.Select({
+                               condition: ol.events.condition.pointerMove,
+                               style: style_function_highlight,
+                       })
+               ])
        });
-       map.addInteraction(select_hover);
 
        let select_click = new ol.interaction.Select({
                condition: ol.events.condition.click,