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

Touch API proposal #103

Closed
ystrot opened this issue Feb 21, 2017 · 0 comments
Closed

Touch API proposal #103

ystrot opened this issue Feb 21, 2017 · 0 comments
Assignees
Milestone

Comments

@ystrot
Copy link
Member

ystrot commented Feb 21, 2017

class Node {
  func onTouchPressed (_ f: (TouchEvent) -> ()) -> Disposable
  func onTouchMoved   (_ f: (TouchEvent) -> ()) -> Disposable
  func onTouchReleased(_ f: (TouchEvent) -> ()) -> Disposable
}

class TouchEvent : Event {
  let points: TouchPoint
}

class TouchPoint {
  let id: Int
  let location: Point
}
  1. Each touch point should have an identifier. iOS using timestamp, so just need to map it to an Int.
  2. When we pressed on a node, this node should receive all move and release events, even if such events occurs outside of this node.
  3. Note that we can't just route system touch events to a selected node. Here is an example:
    a. User pressed on the node1.
    b. User pressed on the node2.
    c. User moving both fingers. In this case system will send one touch event with two touches. However Macaw engine should send one event to node1 and another to node2.
  4. Make sure that if some node received onTouchPressed event, it should receive onTouchReleased at some point.
@ystrot ystrot added this to the 0.9.0 milestone Feb 21, 2017
@ystrot ystrot modified the milestones: 0.8.1, 0.9.0 Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants