[NUI] Add InterceptTouchEvent (#2098)
authorJoogabYun <40262755+JoogabYun@users.noreply.github.com>
Tue, 20 Oct 2020 01:27:36 +0000 (10:27 +0900)
committerGitHub <noreply@github.com>
Tue, 20 Oct 2020 01:27:36 +0000 (10:27 +0900)
The Touch event calls the TouchEvent callback by going back from the last child actor to the parent via hitTest.
InterceptTouchEvent checks the touch event in the parent first.
Returning false from interceptTouchEvent allows child actors to receive TouchEvents.
If it returns true, the actor will receive a TouchEvent.

for example

   View parent = new View();
   View child = new View();
   parent.Add(child);
   child.TouchEvent += childFunctor;
   parent.TouchEvent += parentFunctor;

The callbacks are called in the order childFunctor -> parentFunctor.

If you connect interceptTouchSignal to parentActor.

   parent.InterceptTouchEvent += interceptFunctor;

When interceptFunctor returns false, it is called in the same order childFunctor -> parentFunctor.
If intereptFunctor returns true, it means that the TouchEvent was intercepted.
So the child actor will not be able to receive touch events.
Only the parentFunctor is called.


No differences found