matiasgali / guillotine

jQuery plugin to crop images within an area (fully responsive), allowing to drag (touch support), zoom and rotate.
http://guillotine.js.org
326 stars 100 forks source link

Zooming in/out on touch events #2

Closed mohsinali1317 closed 10 years ago

mohsinali1317 commented 10 years ago

Hey,

It is a fine plugin you have there. Do you think you can put together a code which would allow zooming in/out on touch events? Like panning?

matiasgali commented 10 years ago

I'm not quite sure what you mean by panning in this context but I'm guessing you refer to zoom in and out with multi-touch.

It might be a good feature to add in the future, as long as it doesn't mean considerably increasing the size/weight of the plugin. However, given that it's not a critical feature, you shouldn't expect it any time soon. I'll have to look into it in my spare time.

Wait, don't lose hope just yet... if it's a must have for you, I have some good news. You could use something like Hammer.js (JS library for multi-touch gestures), bind touch events to zoom methods ('zoomIn' and 'zoomOut') and set the zoomStep option to as little as you need. For further control you might get Guillotine's instance with gllt = img.guillotine('instance') and use private methods such as _offset(left, top) and _zoom(factor) to perfectly set position and zoom.

Let me know if the plugin gives you a hard time trying to implement this and I'll try to help you as much as I can.