Hello,
I am using swipe and pinchZoom, here is my sample code-
$("#styleProfileListUnlocked").swipe( {
swipeStatus:function(event, phase, direction, distance , duration , fingerCount) {
console.log("swiped " + distance + ' px');
if(direction=="right"){
$('#userActualPic').css({'left':''+distance+'px'});
}
if(direction=="left"){
$('#userActualPic').css({'left':'-'+distance+'px'});
}
if(direction=="down"){
$('#userActualPic').css({'top':''+distance+'px'});
}
if(direction=="up"){
$('#userActualPic').css({'top':'-'+distance+'px'});
}
if(phase === $.fn.swipe.phases.PHASE_END || phase === $.fn.swipe.phases.PHASE_CANCEL) {
//The handlers below fire after the status,
// so we can change the text here, and it will be replaced if the handlers below fire
console.log("No swipe was made");
}
},
pinchStatus:function(event, phase, direction, distance , duration , fingerCount, pinchZoom) {
$(this).find('#pinch_text').text("pinched " + distance + " px ");
$('#userActualPic').css('transform','scale('+pinchZoom+')');
if(phase === $.fn.swipe.phases.PHASE_END || phase === $.fn.swipe.phases.PHASE_CANCEL) {
//The handlers below fire after the status,
// so we can change the text here, and it will be replaced if the handlers below fire
console.log("No pinch was made");
}
},
swipe:function(event, direction, distance, duration, fingerCount) {
console.log("You swiped " + direction + " with " + fingerCount + " fingers");
},
pinchIn:function(event, direction, distance, duration, fingerCount, pinchZoom) {
console.log("You pinched " +direction + " by " + distance +"px, zoom scale is "+pinchZoom);
},
pinchOut:function(event, direction, distance, duration, fingerCount, pinchZoom) {
console.log("You pinched " +direction + " by " + distance +"px, zoom scale is "+pinchZoom);
},
fingers:$.fn.swipe.fingers.ALL,
threshold:20
});
Use case- Pinch to zoom, swipe to change position and when again try to pinchZoom, initial pinchZoom is set to 1, which makes my div again scale to zero. How maintain the last zoom state.
Also there is flicker when I try to move from left-center-right position.
Any help will be really helpful!!
Hello, I am using swipe and pinchZoom, here is my sample code- $("#styleProfileListUnlocked").swipe( { swipeStatus:function(event, phase, direction, distance , duration , fingerCount) {
Use case- Pinch to zoom, swipe to change position and when again try to pinchZoom, initial pinchZoom is set to 1, which makes my div again scale to zero. How maintain the last zoom state. Also there is flicker when I try to move from left-center-right position. Any help will be really helpful!!
Cheers