scroll - 无法在移动设备上使用 OpenLayers 地图滚动页面
问题描述
我的 Cordova 移动应用程序中有一个包含 OpenLayers 地图的页面。看起来 OpenLayers 捕获了拖动事件,因此当用户触摸地图时无法滚动页面(仅当拖动事件在地图外开始时才有效)。我在这里发现了几个类似的问题(例如,Openlayers 在触摸和拖动地图时无法垂直滚动页面)。所以我的代码现在看起来像这样:
HTML:
<div id="map" tabindex="1"></div>
JS:
var interactions = ol.interaction.defaults({
onFocusOnly: true,
altShiftDragRotate: false,
pinchRotate: false,
doubleClickZoom: false,
pinchZoom: false,
dragZoom: false,
dragPan: false,
dragRotate: false,
mouseWheelZoom: false
});
new ol.Map({
target: "map"
interactions: interactions,
layers: [],
view: new ol.View({
center: ol.proj.transform([15.523, 49.718], 'EPSG:4326', 'EPSG:3857'),
zoom: 8,
minZoom: 7,
maxZoom: 18
})
});
不幸的是,无法使用此代码滚动页面事件。
解决方案
推荐阅读
- firebase - 在 Flutter 中从 Firebase 加载图像时使用 CircularProgressIndicator 小部件
- firebase - 如何在 FLUTTER 中杀死应用程序时将位置数据发送到 Firestore 数据库
- spring-boot - 多个微服务及其通信
- bazel - 如何获取在 Bazel 的 execpath 中创建的文件的文件对象?
- sql-server-2016 - WebSphere 应用程序 (V 8.5.5.0) 到 SQL Server 2016 数据库连接错误
- sql - Concat 然后在 Hive 中分组
- c# - 如何将变量数据从控制器传递到视图(MVC)
- javascript - 如果Server以text/html类型响应,Client会识别不出来吗?
- flutter - 如何获取待处理通知的[scheduledDate](颤动本地通知)
- python - 如何通过特定列的值创建数据框的两个子集?