-
Notifications
You must be signed in to change notification settings - Fork 0
Architectural Decisions
This page is a collection of thoughts why things are implemented this way but not another way. It's for fellow developers to read before trying to "fix" something which actually was not broken in the first place. But was made this way for a reason.
Basically, this page is for valyard because he keeps forgetting stuff.
PressGesture fires immediately and would ultimately kill every other non-friendly gesture. So one would have to manually make it friendly with everything in a general use-case. That's why it's made friendly with everyone by default.
But there are cases when one would like to determine if parent container was pressed or its child. In current implementation both PressGestures will fire.
One approach would be to somehow make parent's PressGesture not friendly with child's one. But looking at how gesture recognition works we can see that this won't work. Since we would like child's gesture to fail parent's gesture. When child's PressGesture is recognized the system asks it if it can prevent parent's gesture, and it obviously can't because it's friendly with everything. And it doesn't matter that parent's gesture can be prevented by child's one... because child's one can't prevent parent's gesture and this is asked first.
This is basically what IgnoreChildren is for. It makes parent's PressGesture only listen for TouchPoints which lend directly on it.
Right now touchesBegan/touchesMoved/touchesEnded methods in Gesture class accept IList as their argument which seems to overcomplicate a lot of stuff and just calling touchBegan(TouchPoint) would be easier.
The later approach was tried in 7.0 and reverted in 8.0 since it introduced a really hard to fix gesture priority issue. If with lists a gesture knows all touches changed during current frame, individual touchMoved calls have to be buffered till the end of frame. But there's no way to execute gesture recognition logic at the end of frame in the right hierarchical order. This concern resulted in the following issue: https://github.com/TouchScript/TouchScript/issues/203