mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Fix image resizing behavior.
This commit is contained in:
+4
-2
@@ -316,11 +316,13 @@ private fun BoxScope.CropEditorCanvas(
|
|||||||
) { change, dragAmount ->
|
) { change, dragAmount ->
|
||||||
val activeTarget = dragTarget ?: return@detectDragGestures
|
val activeTarget = dragTarget ?: return@detectDragGestures
|
||||||
change.consume()
|
change.consume()
|
||||||
|
val gestureAreaWidth = imageRect.width.takeIf { it > 0f } ?: size.width.toFloat()
|
||||||
|
val gestureAreaHeight = imageRect.height.takeIf { it > 0f } ?: size.height.toFloat()
|
||||||
onCropRectChange(
|
onCropRectChange(
|
||||||
latestCropRect.applyChange(
|
latestCropRect.applyChange(
|
||||||
dragTarget = activeTarget,
|
dragTarget = activeTarget,
|
||||||
deltaX = dragAmount.x / size.width.toFloat(),
|
deltaX = dragAmount.x / gestureAreaWidth,
|
||||||
deltaY = dragAmount.y / size.height.toFloat(),
|
deltaY = dragAmount.y / gestureAreaHeight,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user