Like mentioned what is the best way of detecting in w开发者_如何学运维hich direction the user is dragging horizontally. I'm trying to create a camera class that responds to this gesture but am having problems determining which direction they are dragging. Any suggestions are appreciated.
Admittedly I haven't tested this, but the documentation suggests that you should check the value of GestureSample.Delta.X
, which should be negative for a left movement, and positive for a rightwards one.
Because the delta is only for that particular gesture sample (not the overall gesture), you may need to accumulate it, and only trigger your drag action if the accumulated value is above some threshold (possibly upon receiving a DragComplete
).
精彩评论