About this Blog

fGroove is a audio loop player that allows multiple people to select audio loops that will play in time and at the correct tempo. Think of it as a multitouch version of a groove matrix. Note, I'm just learning to program the surface. While code examples here should work, they may not be the "correct" or "official" way of doing things

Sunday, December 20, 2009

onHold Vs Sizechanged (and possibly rotate)

One thing I'm finding when programming for the Surface is that if you trap one Gesture it will upset the operation of another gesture. So for instance (in my program) the PreviewContactDown is trapped to start a trap operation, this was also used to start a drag and drop operation, which interfered with each other. So I decided to start a drag drop operation by trapping the PreviewContactHoldgesture for the Scatterview item.

This though has a side effect. If a user tries to resize (and probably rotate) a scatterviewitem then one finger has to placed on the item and held. This will fire the PreviewContactHoldgesture for that item. So inside the PreviewContactHoldgesture handler, once the item that is being operated on then you need to find the number of contacts on that item. if it's more than one then it's not a plain Hold gesture. Here's the code I used:

int ContactsCaptured=draggedElement.ContactsCaptured.Count;
if (ContactsCaptured > 1){
//We may be rotating or scaling so we don't want to drag and drop
return;
}

No comments:

Post a Comment