Skip to content

Conversation

@davor-bauk-sh
Copy link
Contributor

Description

Fixes #4115

Commit 1: chore: example for testing screen coordinates

Added an example under "Map > Screen Coordinates" (/example/src/examples/Map/ScreenCoordinates.tsx`)
Buggy behavior on Android can be observed by resetting to this commit

Commit 2: fix(android): screen coordinate conversion on android

Fixed conversion between density-independent pixels (as expected by the JS layer) and physical pixels (as expected by the native Android Mapbox SDK)

Replaced usage of PointF with ScreenCoordinates and RectF with ScreenBox to avoid loss of precision when converting between float and Double.

In JS, I added a ScreenPointPayload type for onPress and onLongPress events.

Commit 3: fix(ios): avoid loss of precision Double -> Float -> CGFloat

Fixed instances of double conversion Double -> Float -> CGFloat (which is backed by Double)

Commit 4: fix: improve docs

Modified JSDocs to provide more information about array parameters and return values (e.g. [x, y], [top, left, bottom, right], [lon, lat], [minLon, minLat, maxLon, maxLat])

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 13, 2025 01:27 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh force-pushed the fix-android-coordinates branch from db68a06 to 2a0b049 Compare December 13, 2025 03:44
@davor-bauk-sh davor-bauk-sh force-pushed the fix-android-coordinates branch from 2a0b049 to 3d5f7a2 Compare December 13, 2025 04:18
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh temporarily deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Inactive
@davor-bauk-sh davor-bauk-sh deployed to CI with Mapbox Tokens December 26, 2025 05:43 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Screen coordinates on Android expected/returned in physical pixels, rather than density independent pixels

1 participant