mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-30 20:41:08 +00:00
Respect height and width settings on annotationImage property
This commit is contained in:
+11
-2
@@ -133,7 +133,16 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<MapView> {
|
||||
try {
|
||||
Drawable image = drawableFromUrl(mapView, annotationURL);
|
||||
SpriteFactory spriteFactory = view.getSpriteFactory();
|
||||
Sprite icon = spriteFactory.fromDrawable(image);
|
||||
Sprite icon;
|
||||
|
||||
if (annotationImage.hasKey("height")) {
|
||||
int height = annotationImage.getInt("height");
|
||||
int width = annotationImage.getInt("width");
|
||||
icon = spriteFactory.fromDrawable(image, width, height);
|
||||
} else {
|
||||
icon = spriteFactory.fromDrawable(image);
|
||||
}
|
||||
|
||||
marker.icon(icon);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -316,4 +325,4 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<MapView> {
|
||||
public MapView getMapView() {
|
||||
return mapView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user