Function
transformCoord
({
videoPoint,
originCoordsRightBottom,
originCoordsLeftTop,
videoHeight,
videoWidth
})
Source from the content-addressed store, hash-verified
| 1 | export const transformCoord = ({ |
| 2 | videoPoint, |
| 3 | originCoordsRightBottom, |
| 4 | originCoordsLeftTop, |
| 5 | videoHeight, |
| 6 | videoWidth |
| 7 | }) => { |
| 8 | let perWidth = Math.abs(originCoordsRightBottom.lng - originCoordsLeftTop.lng) / videoWidth; |
| 9 | let perHeight = Math.abs(originCoordsRightBottom.lat - originCoordsLeftTop.lat) / videoHeight; |
| 10 | return [videoPoint[0] * perWidth + originCoordsLeftTop.lng, originCoordsLeftTop.lat - videoPoint[1] * perHeight]; |
| 11 | }; |
| 12 | |
| 13 | export const transformCoordReverse = ({ |
| 14 | coord, |
Tested by
no test coverage detected