Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map pin icons are different sizes on iOS and Android; blurry on iOS #316

Closed
Tracked by #343
ltseng opened this issue Aug 22, 2023 · 8 comments
Closed
Tracked by #343

Map pin icons are different sizes on iOS and Android; blurry on iOS #316

ltseng opened this issue Aug 22, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@ltseng
Copy link
Contributor

ltseng commented Aug 22, 2023

Description

The pins are enormous on iOS, but not on Android. The following screenshots have been taken on both iOS and Android at roughly the same scale, aka whatever scale the map is set to upon first opening the app.

Android

Screenshot_20230822-163031_Terraso LandPKS.jpg

iOS

image

@ltseng ltseng added bug Something isn't working landpks labels Aug 22, 2023
@ltseng ltseng added this to Terraso Aug 22, 2023
@github-project-automation github-project-automation bot moved this to Todo in Terraso Aug 22, 2023
@ltseng ltseng added this to the LandPKS 2023-08 milestone Aug 22, 2023
@shrouxm
Copy link
Member

shrouxm commented Aug 23, 2023

@paulschreiber can you look into this? i think the only relevant values should be in dev-client/src/components/home/SiteMap.tsx. we specify the size in these two places:

i'm guessing one (hopefully not both 😱) of the values behaves differently per platform, so if you could find a set of values that creates the same size icon on android and iOS that should resolve the issue. See e.g. here in the design for the expected size. (We aren't displaying the cluster icons or increasing the icon size when it is selected yet).

@paulschreiber
Copy link
Member

Filed rnmapbox/maps#3009

@paulschreiber
Copy link
Member

Please retest on build 24 or later.

@shrouxm shrouxm moved this from Todo to QA in Terraso Aug 25, 2023
@ltseng
Copy link
Contributor Author

ltseng commented Aug 25, 2023

Map markers on Android are now tiny. On iPad and iPhone, they're a good size, but blurry.

Android

Screenshot_20230825-085046_Terraso LandPKS.jpg

iPad

image

iPhone

image

@ltseng ltseng assigned paulschreiber and unassigned ltseng Aug 25, 2023
@ltseng ltseng moved this from QA to In Progress in Terraso Aug 25, 2023
@ltseng
Copy link
Contributor Author

ltseng commented Aug 25, 2023

This is leading to a secondary issue of me not being able to select the correct pin when two are moderately close together

Upload.from.GitHub.for.iOS.MOV

@shrouxm
Copy link
Member

shrouxm commented Aug 29, 2023

huh that's weird, paul confirmed that this was working for both clients on his dev build 🤔 i will take a look at this this week! it does seem to confirm that the underlying issue is a style parameter that doesn't get correctly applied to the android build

@ltseng ltseng changed the title Pin icons are huge on iOS Icons are different sizes on iOS and Android; blurry on Android Aug 29, 2023
@ltseng ltseng changed the title Icons are different sizes on iOS and Android; blurry on Android Icons are different sizes on iOS and Android; blurry on iOS Aug 29, 2023
@shrouxm
Copy link
Member

shrouxm commented Aug 29, 2023

ok soooooo i have tried:

  • to coax rnmapbox to accept SVGs in many different ways
  • to upload the SVG to mapbox studio
  • to convert the SVG to SDF
  • to convert PNGs to SDF
  • to just use PNGs

and nothing works perfectly. it seems that the reason nothing works perfectly is outlined in this little snippet buried in the mapbox docs:

Vector formats, like SVGs, can also be good candidates for generating an SDF. Although SVGs are a vector image format, the Mapbox GL renderer cannot treat them as vector data in the same way it handles vector tiles or GeoJSON. Converting them to SDFs, however, makes it possible to add a scalable, recolorable SVG to your map.

while they mention earlier that SDFs are a raster format and so look terrible when scaled. in fact even in the official mapbox docs for SDFs the demo map they display has jagged pixelated icons. the inability to render vector icons also explains why even if i upload an svg to mapbox studio, it will look blurry

so i think our only option is to programmatically pre-generate raster icons for each size and color we need at appropriate pixel densities for the running device. which will hopefully not be as difficult as it sounds because of RN's PixelRatio function and the existing vector icon getImageSource method

i will attempt to implement this at a time that is later 👍

i do feel like i'm missing something because this seems ridiculous, but at the same time the docs are clearly stating that they can't render vector symbols (even though the entire core innovation of Mapbox as a company is rendering maps from vector data)

@shrouxm shrouxm self-assigned this Aug 29, 2023
@paulschreiber paulschreiber changed the title Icons are different sizes on iOS and Android; blurry on iOS Map pin icons are different sizes on iOS and Android; blurry on iOS Aug 30, 2023
@shrouxm shrouxm moved this from In Progress to In Review in Terraso Aug 31, 2023
@ltseng ltseng moved this from In Review to QA in Terraso Aug 31, 2023
@ltseng
Copy link
Contributor Author

ltseng commented Aug 31, 2023

This is looking good on both Android and iOS now!

@ltseng ltseng closed this as completed Aug 31, 2023
@github-project-automation github-project-automation bot moved this from QA to Done in Terraso Aug 31, 2023
@david-code david-code moved this from Done to QA in Terraso Aug 31, 2023
@ltseng ltseng moved this from QA to Done in Terraso Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants