0

我想导航到地图中的用户当前位置。我正在使用 Mapboxgl、Ionic3 和 Angular4。

我使用了以下代码map.addControl(new mapboxgl.GeolocateControl());

这在开发中运行良好,(ie web browser)但我的目标是移动应用程序。我的应用程序将在两者中使用android and ios mobiles

我猜它支持网络浏览器而不是手机中的点击事件。如果我为此编写触摸事件,它可能会起作用。

我更喜欢为此导航编写自定义代码。我的意思是放置一些图标并编写相同的功能而不是mapboxgl.GeolocateControl()

4

1 回答 1

0

由于 MapBox-gl 支持触摸,如果 GeolocateControl 不支持触​​摸事件,我会感到惊讶。

GeolocateControl 应该在 Android 和 iOS 上的 Ionic 中工作。确保您告诉您的应用请求地理定位权限

于 2017-07-04T00:13:58.460 回答