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

[android] - make query point annotations depend on screendensity #5988

Merged
merged 1 commit into from
Aug 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.exceptions.IconBitmapChangedException;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.location.LocationListener;
import com.mapbox.mapboxsdk.location.LocationServices;
import com.mapbox.mapboxsdk.maps.widgets.CompassView;
Expand Down Expand Up @@ -1156,7 +1155,6 @@ List<Marker> getMarkersInRect(@NonNull RectF rect) {
return new ArrayList<>();
}

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

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

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

List<Long> idsList = new ArrayList<>(ids.length);
Expand Down Expand Up @@ -1727,11 +1724,12 @@ public boolean onSingleTapConfirmed(MotionEvent e) {
PointF tapPoint = new PointF(e.getX(), e.getY());
float toleranceSides = 4 * mScreenDensity;
float toleranceTopBottom = 10 * mScreenDensity;
RectF tapRect = new RectF(tapPoint.x - mAverageIconWidth / 2 - toleranceSides,
tapPoint.y - mAverageIconHeight / 2 - toleranceTopBottom,
tapPoint.x + mAverageIconWidth / 2 + toleranceSides,
tapPoint.y + mAverageIconHeight / 2 + toleranceTopBottom);

RectF tapRect = new RectF((tapPoint.x - mAverageIconWidth / 2 - toleranceSides) / mScreenDensity,
(tapPoint.y - mAverageIconHeight / 2 - toleranceTopBottom) / mScreenDensity,
(tapPoint.x + mAverageIconWidth / 2 + toleranceSides) / mScreenDensity,
(tapPoint.y + mAverageIconHeight / 2 + toleranceTopBottom) / mScreenDensity);

List<Marker> nearbyMarkers = getMarkersInRect(tapRect);
long newSelectedMarkerId = -1;

Expand Down