From d9fc681a8047eb7fda8ce89cc13806d3feaa9a88 Mon Sep 17 00:00:00 2001 From: Eugene Maksymenko Date: Sun, 29 Sep 2024 23:54:26 +0300 Subject: [PATCH] Add terrain double tap support in Android version. --- .../kotlin/earth/worldwind/gesture/SelectDragDetector.kt | 5 +++-- .../kotlin/earth/worldwind/gesture/SelectDragCallback.kt | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/worldwind/src/androidMain/kotlin/earth/worldwind/gesture/SelectDragDetector.kt b/worldwind/src/androidMain/kotlin/earth/worldwind/gesture/SelectDragDetector.kt index 517f511ef..4f8be1ae1 100644 --- a/worldwind/src/androidMain/kotlin/earth/worldwind/gesture/SelectDragDetector.kt +++ b/worldwind/src/androidMain/kotlin/earth/worldwind/gesture/SelectDragDetector.kt @@ -107,8 +107,9 @@ open class SelectDragDetector(protected val wwd: WorldWindow) : SimpleOnGestureL val callback = callback ?: return false return runBlocking { val (renderable, position) = awaitPickResult(false) - if (renderable is Renderable && position != null) { - callback.onRenderableDoubleTap(renderable, position) + if (position != null) { + if (renderable is Renderable) callback.onRenderableDoubleTap(renderable, position) + else callback.onTerrainDoubleTap(position) wwd.requestRedraw() true } else false diff --git a/worldwind/src/commonMain/kotlin/earth/worldwind/gesture/SelectDragCallback.kt b/worldwind/src/commonMain/kotlin/earth/worldwind/gesture/SelectDragCallback.kt index e6860426f..cc63ec860 100644 --- a/worldwind/src/commonMain/kotlin/earth/worldwind/gesture/SelectDragCallback.kt +++ b/worldwind/src/commonMain/kotlin/earth/worldwind/gesture/SelectDragCallback.kt @@ -87,4 +87,11 @@ interface SelectDragCallback { * @param position picked terrain or renderable center position */ fun onRenderableDoubleTap(renderable: Renderable, position: Position) {} + + /** + * Terrain position was double-tapped or double-clicked + * + * @param position picked terrain position + */ + fun onTerrainDoubleTap(position: Position) {} } \ No newline at end of file