Last active
July 15, 2016 04:13
-
-
Save joshuacerbito/d7e34095fb9b230fd01cd84f80e32bb7 to your computer and use it in GitHub Desktop.
Get new width or height while preserving the aspect ratio
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
// Description: Get new width or height while preserving the aspect ratio | |
// TODO: Add AspectRatio related methods | |
var AspectRatio = { | |
getScaled: function ( currentW, currentH, newSize, property ) { | |
return ( property === 'width' )? ((currentH / currentW) * newSize) : (currentW / currentH) * newSize) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment