Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Created September 2, 2012 13:36
Show Gist options
  • Save dezinezync/3598948 to your computer and use it in GitHub Desktop.
Save dezinezync/3598948 to your computer and use it in GitHub Desktop.
imageWin = Ti.UI.createWindow({
width: Ti.UI.FILL,
height: Ti.UI.FILL,
backgroundColor:'#99000000',
opacity: 0
});
var scrollView = Ti.UI.createScrollView({
contentWidth: '100%',
contentHeight: Ti.UI.SIZE,
width: Ti.UI.FILL,
height: Ti.UI.FILL,
showVerticalScrollIndicator:false,
showHorizontalScrollIndicator:false,
//backgroundColor: 'black',
maxZoomScale:2,
minZoomScale:1,
zoomScale: 1,
scale: 1
});
scrollView.add(Ti.UI.createImageView({
image: url,
preventDefaultImage: true,
shadow: {
shadowOffset: {x: 0, y: 0},
shadowRadius: 6,
shadowOpacity: 1
}
}));
scrollView.addEventListener('dblclick', function(e) {
if(scrollView.zoomScale == 1) {
scrollView.zoomScale = 2;
scrollView.setContentOffset({x: e.x, y : e.y});
}
else if(scrollView.zoomScale > 1) scrollView.zoomScale = 1;
});
imageWin.add(scrollView);
imageWin.addEventListener('close', function() {
imageWin = null;
scrollView = null;
});
imageWin.open();
imageWin.animate({
opacity: 1,
duration: 300
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment