FIX DA CALCULATION!!!!!!

Holy shit this took me a while. Basically we should be treating the original image center as the scale origin rather than the scaled image center. Otherwise expanding feels unsteady.
This commit is contained in:
Dan Abramov
2024-10-31 14:32:57 +00:00
parent e1d1735f56
commit aeda009b2f
+4 -4
View File
@@ -331,14 +331,14 @@ function interpolateTransform(
const thumbnailCenterX = thumbnailDims.pageX + thumbnailDims.width / 2
const thumbnailCenterY = thumbnailDims.pageY + thumbnailDims.height / 2
const initialTranslateX = thumbnailCenterX - screenCenterX
const initialTranslateY = thumbnailCenterY - screenCenterY
const initialScale = thumbnailDims.width / screenSize.width
const initialTranslateX = (thumbnailCenterX - screenCenterX) / initialScale
const initialTranslateY = (thumbnailCenterY - screenCenterY) / initialScale
const scale = interpolate(progress, [0, 1], [initialScale, 1])
const translateX = interpolate(progress, [0, 1], [initialTranslateX, 0])
const translateY = interpolate(progress, [0, 1], [initialTranslateY, 0])
return [{scale}, {translateX}, {translateY}]
const scale = interpolate(progress, [0, 1], [initialScale, 1])
return [{translateX}, {translateY}, {scale}]
}
const styles = StyleSheet.create({