rombdn / img-touch-canvas

Add touch gestures (pinch zoom) to images based on Canvas (vanilla HTML5 / JS)
MIT License
148 stars 110 forks source link

Image flickers around #3

Open fredericoschardong opened 11 years ago

fredericoschardong commented 11 years ago

It seems that img-touch-canvas fills the canvas based on the image's width. If the canvas has a fixed size then some blank space is left on the bottom of the canvas. The problem is that zooming the image until it fills the whole canvas makes the image flickers around.

Perhaps zooming the image in the initialization to fit the whole canvas would be one way to avoid that. What should I do to get the image zoomed to fit the canva's area in the initialization?

rombdn commented 11 years ago

Normally this issue is handled in the init part of the animate function : the canvas is filled by zooming the image based on either image width or height. See https://github.com/rombdn/img-touch-canvas/blob/master/img-touch-canvas.js#L55

scooterlord commented 11 years ago

Hello. First of all good job with the plugin! Would you care to explain how to do what the above user also requested? Meaning to have the image fit inside the container and not be cropped?

kevinmcalear commented 7 years ago

+1