Last active
January 28, 2020 07:41
-
-
Save crrmacarse/15203116c8dd5f128438d296fa4b25b7 to your computer and use it in GitHub Desktop.
Image Crop Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const scaleX = (baseWidth, width) => Math.round(baseWidth / width); | |
export const scaleY = (baseHeight, width) => Math.round(baseHeight / width); | |
export const cropXvalue = (x, scaleXvalue) => Math.round(x * scaleXvalue); | |
export const cropYvalue = (y, scaleYvalue) => Math.round(y * scaleYvalue); | |
export const cropWidthValue = (width, scaleXValue) => Math.round(width * scaleXValue); | |
export const cropHeightValue = (height, scaleYValue) => Math.round(height * scaleYValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment