Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const updatePoint = () => {
if (isGesture) {
const [firstTouch, secondTouch] = points;
const newDistance = distance(firstTouch, secondTouch);
const newRotation = angle(firstTouch, secondTouch);
output.scale = scale * (newDistance / initialDistance);
output.rotate = rotate + (newRotation - initialRotation);
}
update(output);
};
action(({ update }) => {
const output = {
touches: points,
scale,
rotate
};
let initialDistance = 0.0;
let initialRotation = 0.0;
const isGesture = points.length > 1;
if (isGesture) {
const [firstTouch, secondTouch] = points;
initialDistance = distance(firstTouch, secondTouch);
initialRotation = angle(firstTouch, secondTouch);
}
const updatePoint = () => {
if (isGesture) {
const [firstTouch, secondTouch] = points;
const newDistance = distance(firstTouch, secondTouch);
const newRotation = angle(firstTouch, secondTouch);
output.scale = scale * (newDistance / initialDistance);
output.rotate = rotate + (newRotation - initialRotation);
}
update(output);
};
const onMove = (e: TouchEvent) => {