create-expo-cljs-app
Version:
Create a react native application with Expo and Shadow-CLJS!
14 lines (13 loc) • 517 B
JavaScript
import { PROPS_CLIENT_XY } from './input-consts';
import getDistance from './get-distance';
/**
* @private
* calculate the scale factor between two pointersets
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} scale
*/
export default function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}