Skip to content

Add rotate direction option .rotateTo() #818

Closed

Description

@bsudekum

Currently, the rotateTo() function only allows for rotation in the clockwise direction. It would ideal if the direction could be controlled as an option or if it did it automatically in background depending on current rotation and the new specified rotation.

The use case is car navigation: if the map can rotate only one direction when taking a 90 degree left hand turn, it rotates a whole 270 degrees in the opposite direction.

cc @mourner

Activity

  1. modified the milestone: v0.4.1 on Nov 7, 2014
  2. mourner commented on Nov 8, 2014

    @mourner
    Member

    Yes. Pretty easy to add. Looks like for this use case, it would be sufficient to rotate to the closest angle automatically instead of having an option.

  3. added a commit that references this issue on Nov 10, 2014
    f5c640a
  4. mourner commented on Nov 10, 2014

    @mourner
    Member

    See PR #821, should make all animations rotate to the closest bearing now.

  5. knutole commented on Dec 7, 2014

    @knutole

    Would be nice to have option for rotate direction anyhow. When doing .flyTo's for example, it's nice to decide which way it goes. I can't find where in the code this should be added, any clues?

  6. mourner commented on Dec 7, 2014

    @mourner
    Member

    @knutole it's in easings.js, _normalizeBearing method.

  7. knutole commented on Dec 7, 2014

    @knutole

    So the rotation is decided simply from bearing being a positive or negative integer?

  8. mourner commented on Dec 7, 2014

    @mourner
    Member

    @knutole no, it's decided based on what direction it's closer to rotate to.

  9. knutole commented on Dec 8, 2014

    @knutole

    Thank you.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions