Pinch zoom revert zooming


#1

Hi, I have succesfully made an image zoomable in a modal and it looks great. But, when closing the modal the current zoom level is kept also for any other image opened with that modal (reusable modal).

Is there some function available to restore the zoom level back to default somehow?


#2

Are you using ion-scroll or ion-content inside of the modal to hold your image? If so, you can use the $ionicScrollDelegate.zoomTo() method when the modal is open to reset the zoom.

// Reset zoom to default, do not animate, reset top position, reset left position
$ionicScrollDelegate.zoomTo(1, false, 0, 0);

http://ionicframework.com/docs/api/service/$ionicScrollDelegate/