Fix image resizing behavior.

This commit is contained in:
Benoit Marty
2026-06-01 14:41:26 +02:00
parent 81ed41d580
commit f52fc9c1c2
@@ -316,11 +316,13 @@ private fun BoxScope.CropEditorCanvas(
) { change, dragAmount ->
val activeTarget = dragTarget ?: return@detectDragGestures
change.consume()
val gestureAreaWidth = imageRect.width.takeIf { it > 0f } ?: size.width.toFloat()
val gestureAreaHeight = imageRect.height.takeIf { it > 0f } ?: size.height.toFloat()
onCropRectChange(
latestCropRect.applyChange(
dragTarget = activeTarget,
deltaX = dragAmount.x / size.width.toFloat(),
deltaY = dragAmount.y / size.height.toFloat(),
deltaX = dragAmount.x / gestureAreaWidth,
deltaY = dragAmount.y / gestureAreaHeight,
)
)
}