Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 112789a

Browse files
committed
[android] - make query source features depend on screendensity
1 parent c57a54d commit 112789a

File tree

1 file changed

+5
-7
lines changed
  • platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps

1 file changed

+5
-7
lines changed

platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
import com.mapbox.mapboxsdk.constants.Style;
7878
import com.mapbox.mapboxsdk.exceptions.IconBitmapChangedException;
7979
import com.mapbox.mapboxsdk.geometry.LatLng;
80-
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
8180
import com.mapbox.mapboxsdk.location.LocationListener;
8281
import com.mapbox.mapboxsdk.location.LocationServices;
8382
import com.mapbox.mapboxsdk.maps.widgets.CompassView;
@@ -1156,7 +1155,6 @@ List<Marker> getMarkersInRect(@NonNull RectF rect) {
11561155
return new ArrayList<>();
11571156
}
11581157

1159-
// TODO: filter in JNI using C++ parameter to queryPointAnnotations
11601158
long[] ids = mNativeMapView.queryPointAnnotations(rect);
11611159

11621160
List<Long> idsList = new ArrayList<>(ids.length);
@@ -1182,7 +1180,6 @@ public List<MarkerView> getMarkerViewsInRect(@NonNull RectF rect) {
11821180
return new ArrayList<>();
11831181
}
11841182

1185-
// TODO: filter in JNI using C++ parameter to queryPointAnnotations
11861183
long[] ids = mNativeMapView.queryPointAnnotations(rect);
11871184

11881185
List<Long> idsList = new ArrayList<>(ids.length);
@@ -1727,11 +1724,12 @@ public boolean onSingleTapConfirmed(MotionEvent e) {
17271724
PointF tapPoint = new PointF(e.getX(), e.getY());
17281725
float toleranceSides = 4 * mScreenDensity;
17291726
float toleranceTopBottom = 10 * mScreenDensity;
1730-
RectF tapRect = new RectF(tapPoint.x - mAverageIconWidth / 2 - toleranceSides,
1731-
tapPoint.y - mAverageIconHeight / 2 - toleranceTopBottom,
1732-
tapPoint.x + mAverageIconWidth / 2 + toleranceSides,
1733-
tapPoint.y + mAverageIconHeight / 2 + toleranceTopBottom);
17341727

1728+
RectF tapRect = new RectF((tapPoint.x - mAverageIconWidth / 2 - toleranceSides) / mScreenDensity,
1729+
(tapPoint.y - mAverageIconHeight / 2 - toleranceTopBottom) / mScreenDensity,
1730+
(tapPoint.x + mAverageIconWidth / 2 + toleranceSides) / mScreenDensity,
1731+
(tapPoint.y + mAverageIconHeight / 2 + toleranceTopBottom) / mScreenDensity);
1732+
17351733
List<Marker> nearbyMarkers = getMarkersInRect(tapRect);
17361734
long newSelectedMarkerId = -1;
17371735

0 commit comments

Comments
 (0)