views:

113

answers:

2

We're using the Controls.PreviewContactDown, PreviewContactUp, and PreviewContactChanged events to capture tagged items being placed, removed, and moved on the Surface, which works great in the Simulator application that comes with the surface.

On an actual Surface if you moved a tagged item too quickly the cameras actually lose focus of the tag, assume it was removed, and then re-capture it when it stops moving. That provides a pretty poor experience for our clients.

What I'm proposing is a way to override or create a new event that would respond to tagged item events, but not fire the event handler until after a delay... i.e. if "ContactUp" is fired, wait 100ms and THEN execute the event handler. Ideally we'd just be able to use an alternate attached property to define these event handlers, i.e.

<Panel local:TagDown="TagDownEventHandler" />  

And if we could get it to use ICommand objects instead of event handlers that'd be even better.

+1  A: 

How about just using the TagVisualizer? This already handles tag lost/found by giving you a default fade out animation before the visual is removed from screen.

Its harder to do the same thing with fingers because once the contact is lost there is no connection between the original contact and the new one.

Schneider
TagVisualizer won't work as easily because we don't specifically know what tags we're working with, and I'm pretty sure TagVisualizer requires you to specify what tag values to listen for - the client could be using any subset of the 00-FF tags.At the same time, the TagVisualizer might actually suffer from the same problem - what happens on our Dev surface unit is if you "drag" a tagged object across the surface at any decent speed it actually drops the tracking of that object - I think it's more a hardware limitation of the internal cameras than anything else.
RTigger
If you dont know what tag, then how about just matching all (you can do this programatically too)? Problem solved. Yes the dropping contacts IS a fundamental problem... but as I said TV gets around it because it does not immediately remove visuals, so if it loses contact while moving it smoothly tracks back once it redetects.
Schneider
+1  A: 

We found the same thing with the real Surface and the contact events.

What we did (and this will depend on your needs) is to create a base class for a "contact container", which has it's own method of handling ContactUp where we fire off a timer with a set of eventArgs that contain the object/tag that is being removed and add it to a list. If the timer ticks, then we remove the object/tag from the container and the queued list.

When the contactDown fires, we confirm there's no matching object in the queue, if there is we stop the timer and remove it from the queue and ignore the new tag, as it's still already in the container. If not then we handle the new tag being placed.

We're still tweaking the code to ensure its robust, once it is if I can I'll post the solution on Codeplex.

HTH

Chris Nicol