jonom / jquery-focuspoint

jQuery plugin for 'responsive cropping'. Dynamically crop images to fill available space without cutting out the image's subject. Great for full-screen images.
Other
3.14k stars 210 forks source link

allow transform #26

Closed g-van-vreckem closed 10 years ago

g-van-vreckem commented 10 years ago

This is rather rough... To avoid adding dependencies, I added a transform parameter, where the proper prefixed name for the transform (or false) must be supplied outside of the code.

Also, the focusPoint settings where not available in the adjustFocus function, so I simply added them as parameters, I'm sure that's not a good jQuery pattern. Someone knowledgeable on jQuery plugin options and settings patterns better take a look at this.

But it is a proof of concept that the formula is good...

Note that the transform % are expressed in relation to the image size while the left/top % are expressed in relation to the container size.

jonom commented 10 years ago

Thanks for this proof of concept, I will think about the best way to roll it in.

g-van-vreckem commented 10 years ago

improved performance significantly by using scaling instead of width/height constraint. Persisted the transform name in the element to allow the helper to work again. Kept the bug correction I made available separately. Optimized the calcShift in the case of the transform Started to remove extraneous var

jonom commented 10 years ago

@g-van-vreckem Thanks again, great to see you continuing to work on this. Finding it difficult to follow along with changes in the last commit though - would it be difficult to undo that last commit and separate it in to two separate ones, one for 'using scale instead of width/height' and a separate one for 'Started to remove extraneous var'?

jonom commented 10 years ago

p.s. could you please change the pull request to target a new branch with a suitable name e.g. 'allow-transform'. I can't see a way to do it at my end.

g-van-vreckem commented 10 years ago

I made the requested change in #28