diff --git a/api/android-for-maptiler.api b/api/android-for-maptiler.api index 3ba82ef..35e2827 100644 --- a/api/android-for-maptiler.api +++ b/api/android-for-maptiler.api @@ -133,7 +133,7 @@ public final class com.mapconductor.maptiler.MapTilerMapViewControllerInterface$ public final class com.mapconductor.maptiler.MapTilerMapViewControllerMarkerTilesKt { public static final com.mapconductor.maptiler.marker.MapTilerMarkerTileRenderer tileRenderer(com.mapconductor.maptiler.MapTilerMapViewController); public static final java.lang.Object renderTiledMarkers(com.mapconductor.maptiler.MapTilerMapViewController, java.util.List, kotlin.coroutines.Continuation); - public static final boolean handleMarkerTap(com.mapconductor.maptiler.MapTilerMapViewController, com.mapconductor.core.features.GeoPoint, double); + public static final boolean handleMarkerTap(com.mapconductor.maptiler.MapTilerMapViewController, com.mapconductor.core.features.GeoPoint); public static final com.mapconductor.core.marker.MarkerRenderingSupport createMarkerRenderingSupport(com.mapconductor.maptiler.MapTilerMapViewController); } public final class com.mapconductor.maptiler.MapTilerMapViewHolder implements com.mapconductor.core.map.MapViewHolderInterface { @@ -294,6 +294,7 @@ public final class com.mapconductor.maptiler.marker.MapTilerMarkerTileRenderer { public final com.mapconductor.core.raster.RasterLayerState render(java.util.List); public final java.lang.String getRasterLayerId(); public final void clear(); + public final com.mapconductor.core.marker.MarkerState findMarkerAt(com.mapconductor.core.features.GeoPointInterface, kotlin.jvm.functions.Function1); public final com.mapconductor.core.marker.MarkerState findMarkerAt(com.mapconductor.core.features.GeoPointInterface, double); } final class com.mapconductor.maptiler.marker.MapTilerMarkerTileRenderer$Companion { diff --git a/src/main/java/com/mapconductor/maptiler/MapTilerMapView.kt b/src/main/java/com/mapconductor/maptiler/MapTilerMapView.kt index b066bc6..9e8ec3b 100644 --- a/src/main/java/com/mapconductor/maptiler/MapTilerMapView.kt +++ b/src/main/java/com/mapconductor/maptiler/MapTilerMapView.kt @@ -249,7 +249,7 @@ fun MapTilerMapSurface( // MapTiler のタイルレンダラでヒットテストするのでここで先に見る。 val markerHit = runCatching { - controller.handleMarkerTap(point, mtController.getZoom()) + controller.handleMarkerTap(point) }.getOrDefault(false) if (!markerHit && !controller.dispatchOverlayTap(point)) { onClick?.invoke(point) diff --git a/src/main/java/com/mapconductor/maptiler/MapTilerMapViewControllerMarkerTiles.kt b/src/main/java/com/mapconductor/maptiler/MapTilerMapViewControllerMarkerTiles.kt index 2359d0d..895f6de 100644 --- a/src/main/java/com/mapconductor/maptiler/MapTilerMapViewControllerMarkerTiles.kt +++ b/src/main/java/com/mapconductor/maptiler/MapTilerMapViewControllerMarkerTiles.kt @@ -39,14 +39,12 @@ internal suspend fun MapTilerMapViewController.renderTiledMarkers(data: List Offset?, + ): MarkerState? { + if (markers.isEmpty()) return null + val touchScreen = project(tap) ?: return null + val bounds = MarkerHitPick.searchBounds(tap, touchScreen, project) ?: return null + val candidates = markers.filter { bounds.contains(it.position) } + return MarkerHitPick.pickBy(touchScreen, candidates, { it }, project) + } + + /** + * 旧来の判定(先端からの距離だけを見る)。ラベルやアイコンの大きさを見ないので、 + * 指の下に描かれているマーカーより先端の近い別のマーカーを選ぶことがある。 */ + @Deprecated( + "先端からの距離だけで選ぶ旧来の判定。findMarkerAt(tap, project) を使う。", + ReplaceWith("findMarkerAt(tap, project)"), + ) fun findMarkerAt( tap: GeoPointInterface, nativeZoom: Double,