[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)
commit7a206f9c23f89004d89e69c645d8116b117fb201
tree1dacaeec28f1d76323266f6dfb404a6c51e47c48
parent024b0479a7aebf47279e1b4d63ddc2649a54a83e
[NUI] Add InterceptTouchEvent (#2098)

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.
src/Tizen.NUI/src/internal/InterceptTouchSignal.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.ActorSignal.cs
src/Tizen.NUI/src/internal/Interop/Interop.TouchSignal.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs