Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide API for motion events #78

Closed
jkrause opened this issue Sep 18, 2014 · 5 comments
Closed

Provide API for motion events #78

jkrause opened this issue Sep 18, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@jkrause
Copy link
Member

jkrause commented Sep 18, 2014

No description provided.

@mpost
Copy link
Member

mpost commented Sep 18, 2014

After discussion with the client team, we will provide support for MouseDown, MouseUp and MouseMove events which should be backed up by matching tabris-js nomenclature.

@hstaudacher hstaudacher modified the milestones: M1, M2 Sep 30, 2014
@tbuschto
Copy link
Member

tbuschto commented Oct 1, 2014

The existing mouse events are unsuitable to base touch events on. They don't bubble, don't enable multi-touche/gesture events and don't offer "cancel" or "tap" events to recognize if an element was released outside it's bounds.

Here is a draft for "real" touch events in tabris-js, inspired mostly by HTML5 (http://www.w3.org/TR/touch-events/). Note that there is also a effort by MS to get their own pointer/gesture events to be standarized (http://www.w3.org/TR/pointerevents/, http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh441180.aspx#properties).

  {
    type: "touchstart" | "touchmove" | "touchend" | "touchcancel", // "touchcancel" = touchend outside widget
    time: number, // like all events have
    cancelBubble : fn, // unlike SWT mouse event, these do bubble
    touches : [ { x: number, y: number, id: string }, ... ], // only those that started on the target, in order of age (oldset first)
    target: widget, // the target is always the widget where the touches started
  }      

A minimal implementation would only require the "touches" array, the other fields are noted here mostly for behavior documentation. There could also be an "changedTouches" array.

In addition to these "low-level" events there could be event for simple one-touch-single-event gestures fired after a touch session, like "tap", "longpress" and possibly double-top and/or fling. (MS calls it "InertiaStart"). These may require some intelligence since only of of them should be fired per touch session, even if there are multiple available targets. Multi-touch gesture will very likely require a more complex API than simple listener.

@tbuschto
Copy link
Member

tbuschto commented Oct 2, 2014

As an intermediate solution we will transform the mouse events into touch events in the JavaScript code. This means that there will be potentially breaking changes (in behavior, not necessarily API) when we then implement propper touch events. The native client will have to fix the behavior of mouse events in case of multiple touches though.

@ralfstx ralfstx added the api label Oct 7, 2014
@mpost
Copy link
Member

mpost commented Oct 7, 2014

@tbuschto The android client filters touch events beyond the first finger already. Meaning you will not receive Mouse events for a second finger while one is already down.

Not though... That we do send a second MouseDown for finger 1 after the "long press duration" with button = 3 (other mouse events use button = 1.

@tbuschto
Copy link
Member

Commit adc067e renamed the events as suggested and introduces the "touches" array. I will close this issue for now (since this is all we will do fo for this feature in M2). I will open another issue for multi-touch/gesture support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants