23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 9<br />

Input and Sensors<br />

Touch is clearly one of the most exciting means of interacting with a computer that has finally come of<br />

age. Sure, we’ve had touch-sensitive devices for many years: I remember working with a touch-enabled<br />

screen in my college days, which I have to admit is almost an embarrassingly long time ago now! In that<br />

case, the touch sensor was a series of transparent wires embedded in a plastic sheet over the screen,<br />

with an overall touch resolution of around 60 wide by 40 high…and, to really date myself, the monitor<br />

itself was only a text terminal!<br />

Fortunately, touch screens have progressed tremendously in recent years. They are responsive<br />

enough for general purpose use (that is, you don’t have to stab them to register a point), are built into<br />

high-resolution displays, are relatively inexpensive, and are capable of doing something more than<br />

replicating the mouse—namely, supporting multitouch and sophisticated gestures.<br />

Great touch interaction is thus now a fundamental feature of great apps, and designing for touch<br />

means in many ways thinking through UI concerns anew. In your layout, for example, it means making<br />

hit targets a size that’s suitable for a variety of fingers. In your content navigation, it means utilizing<br />

direct gestures such as swipes and pinches rather than relying on only item selection and navigation<br />

controls. Similarly, designing for touch means thinking though how gestures might enrich the user<br />

experience—and also how to provide for discoverability and user feedback that has generally relied on<br />

mouse-only events like hover.<br />

All in all, approach your design as if touch was the only means of interaction that your users might<br />

have. At the same time, it’s very important to remember that new methods of input seldom obsolete<br />

existing ones. Sure, punch cards did eventually disappear, but the introduction of the mouse did not<br />

obsolete keyboards. The availability of speech recognition or handwriting has obsoleted neither mouse<br />

nor keyboard. I think the same is true for touch: it’s really a complementary input method that has its<br />

own particular virtues but is unlikely to wholly supplant the others. As Bill Buxton of Microsoft Research<br />

has said, “Every modality, including touch, is best for something and worst for something else.” I expect,<br />

in time, we’ll see ourselves using keyboard, mouse, and touch together, just as we learned to integrate<br />

the mouse in what was once a keyboard-only reality.<br />

Windows is designed to work well with all forms of input—to work great with touch, to work great<br />

with mice, to work great with keyboards, and, well, to just work great on diverse hardware! (And<br />

Windows Store certification requires this for apps as well.) For this reason, Windows provides a unified<br />

pointer-based input model wherein you can differentiate the different inputs if you really need to but<br />

can otherwise treat them equally. You can also focus more on higher-level gestures as well, which can<br />

arise from any input source, and not worry about raw pointer events at all. Indeed, the very fact that we<br />

haven’t even brought this subject up until now, midway through this book, gives testimony to just how<br />

natural it is to work with all kinds of pointer input without having to think about it: the controls and<br />

363

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!