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.

Get and set visibleCoordinateBounds calculated differently #14134

Closed

Description

@TimWatson

With contentInset set, if you tell the map to set the visible coordinate bounds to the current visible coordinate bounds the map moves since getting the visible coordinate bounds doesn't take into account the map content inset but setting it does

Get:

return [self convertRect:self.bounds toCoordinateBoundsFromView:self];

Set:

mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets);
padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInset);

Steps to reproduce

  1. Set mapView.contentInset = UIEdgeInsets(top: 50, left: 10, bottom: 100, right: 10)
  2. Call mapView.setVisibleCoordinateBounds(mapView.visibleCoordinateBounds)
  3. Map jumps to different region

Expected behavior

Get visible coordinate bounds would take into account content inset and the map would stay put

Corrected Get:
return [self convertRect:self.bounds.inset(by: self.contentInset) toCoordinateBoundsFromView:self];

Actual behavior

Map jumps to different region

Configuration

Mapbox SDK versions: ios-v4.9.0
iOS/macOS versions: iOS 12.1.4
Device/simulator models: iPhoneX
Xcode version: 10.1

Activity

  1. added
    iOS
    on Mar 18, 2019
  2. added
    archived
    on Sep 14, 2019
  3. stale commented on Sep 14, 2019

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

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

    archivediOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions