Thursday, March 27, 2014

dragstart event summary

I know this is a little bit difficult to explain in english

I will just simply try to say

case 
I have to two event library in same div
 1. hammer event 
 2. scroller

problem if hammer drag event catch then 
In hammer Drag event 

I use this function ev.gesture.preventDefault(); then
never scroller working

so I try to delete ev.gesture.preventDefault(); then
hammer "drag" event called irregularly

so I try to find usage of hammer 

then I Found  "dragstart"

dragstart -> drag called


this event tell me chagement of x, Y position
so I can catch the what the people want to do

example)

                    case 'dragstart' : 
var movingX = ev.gesture.deltaX;
var movingY = ev.gesture.deltaY;
if(Math.abs(movingX) > Math.abs(movingY)){  // willing to moving left or right
currentScreenStatus.isLeftScrolling = false;
}else{
currentScreenStatus.isLeftScrolling = true; //willing to mving up or down
}
break;
                   case 'touch':
                        break;

                    case 'drag':
if(currentScreenStatus.isLeftScrolling){   //if up or down will use scroller event
return;
}
                                        ev.gesture.preventDefault();

No comments:

Post a Comment