odyniec / imgareaselect

ImgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).
http://odyniec.net/projects/imgareaselect/
686 stars 197 forks source link

Allow aspectRatio to be passed as a float #87

Open CheeseSucker opened 8 years ago

CheeseSucker commented 8 years ago

Currently, aspect ratio must be supplied as two numbers separated by a colon.

options = {
    aspectRatio: "4:3"
}

However, it is often useful to provide the aspect ratio as a single number. Especially if the aspect ratio is calculated by code.

This patch allows configurations such as:

options = {
    aspectRatio: 1.5
}
willherzog commented 6 years ago

I agree that this would be useful. Since I already calculate the aspect ratio in my code, I hacked my version of the plugin to only take a float, but supporting both possibilities (string or float) is probably best.