javascript - MapBox - How to disable all movement in mapbox-gl-js except rotation and zoom to a set point - Stack Overflow

I 'am trying to disable all movement of the map, except rotation and zoom to a set point.But on a

I 'am trying to disable all movement of the map, except rotation and zoom to a set point. But on a touch device I can still move the 'camera' from the set point with two fingers, it works fine on a non touch device.

This is what I currently have, and that is not fully working I can still move the camera center point with two fingers on a touch device. I 'am using typescript with ionic/angular.

this.map = new mapboxgl.Map({
      container: 'game_map',
      style: 'mapbox://styles/mapbox/light-v10',
      center: [coords],
      zoom: 20,
      touchZoomRotate: {around: 'center'},
      scrollZoom: {around: 'center'},
      pitch: 60,
      bearing: -60,
      antialias: true,
      attributionControl: false,
      maxZoom: 22,
      minZoom: 17
    });

I 'am trying to disable all movement of the map, except rotation and zoom to a set point. But on a touch device I can still move the 'camera' from the set point with two fingers, it works fine on a non touch device.

This is what I currently have, and that is not fully working I can still move the camera center point with two fingers on a touch device. I 'am using typescript with ionic/angular.

this.map = new mapboxgl.Map({
      container: 'game_map',
      style: 'mapbox://styles/mapbox/light-v10',
      center: [coords],
      zoom: 20,
      touchZoomRotate: {around: 'center'},
      scrollZoom: {around: 'center'},
      pitch: 60,
      bearing: -60,
      antialias: true,
      attributionControl: false,
      maxZoom: 22,
      minZoom: 17
    });
Share Improve this question asked Jan 17, 2020 at 18:27 DaantricalDaantrical 1242 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

You can disable user panning by adding:

 dragPan: false,

to that initialisation statement. More info.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744661117a4586468.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信