rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.22k stars 838 forks source link

onPress and symbol layer with text, icon and iconTextFit: "both" #634

Closed zanaviska closed 4 years ago

zanaviska commented 4 years ago

Describe the bug If you create symbolLayer with textField and some Icon pinned and set iconTextFit: "both", onPress will be called on the whole icon area before scaling

To Reproduce

<MapboxGL.ShapeSource onPress={() => console.log('I.ve been pressed')}>
  <MapboxGL.SymbolLayer
    style={{
      textField="someText"
      iconImage: ['get', 'icon],
      iconTextFit: 'both'
    }} 
  />
</MapboxGL.ShapeSource>
<MapboxGL.Images images={{example: exampleIcon, assets: ['pin']}} />

Expected behavior If you press outside of a scaled image or text, but inside of a non-scaled image(which can't be seen), nothing happens.

Actual behavior After pressing outside of a scaled image or text, but inside of a non-scaled image onPress is called

Versions (please complete the following information):

Additional context Add any other context about the problem here.

mfazekas commented 4 years ago

If you press outside of a scaled image or text, but inside of a non-scaled image(which can't be seen), nothing happens.

What do you mean by scaled ?!

update: nevermind, scaled means the scale caused by icon-text-fit both

mfazekas commented 4 years ago

On android we use:

https://github.com/react-native-mapbox-gl/maps/blob/master/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.java#L547

So it must be an an upstream queryRenderedFeatures issue with iconTextFit both.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

vadim312 commented 1 year ago

I can see this issue as well here is the issue video https://user-images.githubusercontent.com/75946509/203498379-83ddac9a-0b83-4fa4-8f22-03fb65e7d34a.mov