c# - XNA wp7 gesture detection issue -
i have use both type of input in app (gestures , simple touch). , got problem it. example use double tap gesture , before detected have 1 detection of simple touch. in not way expect, because simple touch has own logic, brings me lot of problems. same issue drag, before detecting drag again first decetced simple touch. how can handle gestures without handling simple touch logic. here way im trying that:
touchpanel.enabledgestures = gesturetype.doubletap | gesturetype.verticaldrag; while (touchpanel.isgestureavailable) { isgesture = true; gesturesample gesturesample = touchpanel.readgesture(); switch (gesturesample.gesturetype) { case gesturetype.doubletap: //some logic break; case gesturetype.horizontaldrag: //some logic break; } } if (consts.touchcollection.count == 1) { var touch = consts.touchcollection[0]; //here needed first touch switch (touch.state) { case touchlocationstate.pressed: //this 1 called first if used double tap break; case touchlocatiomstate.moved: //smth break; case touchlocationstate.released: //smth break; } }
when double tap gesture used code calls pressed -> released -> doubletap -> pressed want handle double tap case. how fix this? feel sorry english, hope question clear. appreciated
to avoid handling simple touch event after handling gestures, add boolean flag set @ beginning of touch handling true
, lets call handlesimpletouch
. if process gesture, set handlesimpletouch
false. before process simple touch, check valu of handlesimpletouch
, if it's true, process normally, otherwise, nothing.
Comments
Post a Comment