I wrote the function by referring to this article.
article
onPointerDown={(e) => {
e.stopPropagation();
if (visibleBounds) {
setIsDrag(true)
setStartPointClick(new Vector2(e.point.x, e.point.y))
}
}}
onPointerMove={(e) => {
e.stopPropagation();
if (visibleBounds && start && isDrag) {
const boxSize = new Vector3()
const center = new Vector3()
visibleBounds.getSize(boxSize)
visibleBounds.getCenter(center)
const dX = e.point.x - startPointClick.x
const dY = e.point.y - startPointClick.y
const sX = 1 + 2 * dX / boxSize.x
const sY = 1 + 2 * dY / boxSize.y
boxRef.current.scale.set(
boxRef.current.scale.x * sX,
boxRef.current.scale.y * sY,
1)
setStartPointClick(new Vector2(e.point.x, e.point.y))
}
}}
But it didn’t work correctly. I didn’t understand that article. Any advice please?