From 743a300bc0445f62573b3b3d9db3e5092af53852 Mon Sep 17 00:00:00 2001 From: spvessel Date: Mon, 14 Sep 2020 11:15:51 +0300 Subject: [PATCH] Fixed Draggable & Scalable for desktop. --- .../kotlin/example/imageviewer/view/Draggable.kt | 7 ++++--- .../commonMain/kotlin/example/imageviewer/view/Scalable.kt | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Draggable.kt b/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Draggable.kt index 17df851e0c..510080346f 100755 --- a/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Draggable.kt +++ b/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Draggable.kt @@ -24,7 +24,7 @@ import androidx.compose.foundation.InteractionState import androidx.compose.ui.semantics.semantics import androidx.compose.ui.geometry.Offset import androidx.compose.ui.gesture.DragObserver -import androidx.compose.ui.gesture.dragGestureFilter +import androidx.compose.ui.gesture.rawDragGestureFilter import androidx.compose.runtime.mutableStateOf import example.imageviewer.core.EventLocker import example.imageviewer.style.Transparent @@ -37,8 +37,9 @@ fun Draggable( ) { Surface( color = Transparent, - modifier = modifier.dragGestureFilter( - dragObserver = onDrag + modifier = modifier.rawDragGestureFilter( + dragObserver = onDrag, + canStartDragging = { true } ) ) { children() diff --git a/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Scalable.kt b/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Scalable.kt index 4bb8748483..54f7e8ab8d 100755 --- a/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Scalable.kt +++ b/examples/imageviewer/common/src/commonMain/kotlin/example/imageviewer/view/Scalable.kt @@ -37,7 +37,8 @@ fun Scalable( Surface( color = Transparent, modifier = modifier.rawScaleGestureFilter( - scaleObserver = onScale + scaleObserver = onScale, + canStartScaling = { true } ).doubleTapGestureFilter(onDoubleTap = { onScale.resetFactor() }), ) { children()