Skip to content

Add a setter for dragRotate pitchWithRotate option #9666

Open

Description

@allison-strandberg

We want to be able to enable and disable the user's ability to pitch the map after it has been created, and we always want to allow map rotation. Since there is no setter for the pitchWithRotate property, our current approach is to update the value of map.dragRotate._pitchWithRotate as suggested in this issue. After upgrading to version 1.10.0, this no longer works to change the pitchWithRotate setting.

A setter for pitchWithRotate would be the best solution, but is there another way to achieve this effect currently?

mapbox-gl-js version: v1.10.0

browser: Chrome for Mac Version 80.0.3987.163

Steps to Trigger Behavior

  1. When the map is loaded, drag the map by holding the right mouse button. The map should rotate but not tilt.
  2. Click the Enable Tilt button.
  3. Drag the map again: it should now be possible to tilt.

Link to Demonstration

v1.9.1 JSFiddle with intended behavior
v1.10.0 JSFiddle with error

Expected Behavior

The map should start out with rotation enabled and pitch disabled. When the button is clicked, pitch should be enabled.

Actual Behavior

Pitch is not enabled when the button is clicked.

Activity

  1. ryanhamley commented on May 7, 2020

    @ryanhamley
    Contributor

    @ansis Would we consider this a regression that we should fix for the patch or no since it's technically not part of the public API?

  2. asheemmamoowala commented on May 13, 2020

    @asheemmamoowala
    Contributor

    Would we consider this a regression that we should fix

    We don't support internal methods and variables as used here. This is not a regression .

    A setter for pitchWithRotate would be the best solution, but is there another way to achieve this effect currently?

    @allison-strandberg Have you considered setting the max/min pitch using Map#set[Min/Max]Pitch to lock the pitch to a specific value when the dragstart event is fired?

  3. allison-strandberg commented on May 14, 2020

    @allison-strandberg
    ContributorAuthor

    Thanks @asheemmamoowala, I'll try that.

  4. changed the title [-]pitchWithRotate can no longer be updated in v1.10.0[/-] [+]Add a setter for dragRotate pitchWithRotate option[/+] on May 25, 2020
  5. mourner commented on May 25, 2020

    @mourner
    Member

    We might want to add a public setter for this. After v1.10.0, the workaround is to call map.dragRotate._mousePitch.disable().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions