YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Change to pointers - Mobile Web Development

Get Embed Code
4 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

  1. Since the conference app doesn't use touch that much, we're
  2. going to have you take a look at adding touch support
  3. to a different example. Let's take a look at how we
  4. would code a simple drawing application on a web page. First,
  5. let's look at this, as we would write it for the
  6. mouse. You can see where we've hooked the mouse down, mouse
  7. move and mouse up events. And you can see are handlers
  8. for each one of these simply creates a new stroke and
  9. the adds points to that stroke as we go.
  10. Now, we'd like you to change this code to use
  11. pointer events. Don't forget to set the touch action attribute
  12. on the HTML element that you're using as an event
  13. listener. We've already included the polymer polyfill, so you
  14. don't need to worry about doing that. Just change the
  15. event handlers to be pointer events and then make any
  16. appropriate changes to the handlers themselves if there are any.