Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

MGLMapView.camera.heading goes negative when rotating to face northwest #7723

Closed

Description

@1ec5

When you rotate an MGLMapView so that it faces anywhere between due north and due west, exclusive, its direction property is wrapped to between 0° and 360°, but its camera’s heading goes negative, indicating an invalid direction according to CLLocationDirection semantics. Therefore, if you then set the camera property of any map view to that MGLMapCamera, you wind up facing the wrong direction.

This regression was introduced in #4790 but was not addressed by df0d118.

/cc @incanus @friedbunny

Activity

  1. added
    iOS
    macOS
    on Jan 14, 2017
  2. added this to the milestone on Jan 14, 2017
  3. self-assigned this
    on Jan 14, 2017
  4. 1ec5 commented on Jan 14, 2017

    @1ec5
    ContributorAuthor

    -[MGLMapCamera isEqual:] (correctly) accounts for the heading without wrapping, and methods like -[MGLMapView setCamera:withDuration:animationTimingFunction:completionHandler:] bail if the current and new MGLMapCamera objects are identical. Therefore, I believe this regression could be a minor contributing factor to #7236 and #7723.

    I say minor because the main code path that would be affected, through -didUpdateLocationSignificantlyAnimated:, would normally require the center coordinate to change significantly. So if there are any redundant calls to this method, this issue would indeed contribute to the problem, but the root cause still lies elsewhere.

  5. added
    navigation
    on Jan 14, 2017
  6. 1ec5 commented on Jan 24, 2017

    @1ec5
    ContributorAuthor

    Fixed in #7724 on the release-ios-v3.4.0 branch.

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

Metadata

Metadata

Assignees

Labels

bugiOSmacOSnavigation

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions