Firefox/Projects/Multitouch Polish/DOM Events

From MozillaWiki
Jump to navigation Jump to search

Multitouch events

This wiki page will be used to describe the current state of the touch events being implemented, and to discuss what the format of these events should be, what kind of information they should provide, etc.

The current implementation is being done in Windows 7 with the touch API, but the design should be platform agnostic.

Current events

  • MozTouchDown
  • MozTouchMove
  • MozTouchRelease

Currently they inherit from MouseEvent and adds a streamId property which uniquely identifies a tracking point. In Win7 this id is provided by the OS/driver layer and is valid only while the same touch point is being tracked. After its finger release, the id can be (and will be) reused.

Each event is related to each single touch point, so if there are 3 fingers touching the screen, 3 MozTouchMove events can possibly be dispatched for each loop in the message loop.

Things to add

Number of touch points

Some uses of touch events may need to track various points at once. This can be handled by observing MozTouchDown/Release, but a field with the current number of touch points could be added to simplify things

Size and pressure

Touch input also may provide detailed information about the contact area or pressure, but it depends on the platform and type of screen. We already have MozPressure attribute on MouseEvent, which is currently only used in some gtk. code. Win7 provides width and height of contact area.

Question to ask