From 385a58a746d2481d4725b3018e6ebf5949aab6ee Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Fri, 22 May 2015 16:28:50 +0100 Subject: [PATCH] Changed grab-handle behavior to work inside Popup Change-Id: I4b94b37b3f4c00f74d67a3429868753cd1b347e3 --- .../internal/text/decorator/text-decorator.cpp | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index f529f70..e92866b 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -530,6 +531,7 @@ struct Decorator::Impl : public ConnectionTracker grabHandle.grabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ); grabHandle.actor.Add( grabHandle.grabArea ); + grabHandle.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched ); mTapDetector.Attach( grabHandle.grabArea ); mPanGestureDetector.Attach( grabHandle.grabArea ); @@ -733,10 +735,6 @@ struct Decorator::Impl : public ConnectionTracker if( Gesture::Started == gesture.state ) { handle.grabDisplacementX = handle.grabDisplacementY = 0; - if( mHandleImages[type][HANDLE_IMAGE_PRESSED] ) - { - handle.actor.SetImage( mHandleImages[type][HANDLE_IMAGE_PRESSED] ); - } } handle.grabDisplacementX += gesture.displacement.x; @@ -804,16 +802,42 @@ struct Decorator::Impl : public ConnectionTracker } } + bool OnGrabHandleTouched( Actor actor, const TouchEvent& event ) + { + // Switch between pressed/release grab-handle images + if( event.GetPointCount() > 0 && + mHandle[GRAB_HANDLE].actor ) + { + const TouchPoint& point = event.GetPoint(0); + + if( TouchPoint::Down == point.state && + mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_PRESSED] ) + { + mHandle[GRAB_HANDLE].actor.SetImage( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_PRESSED] ); + } + else if( TouchPoint::Up == point.state && + mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ) + { + mHandle[GRAB_HANDLE].actor.SetImage( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ); + } + } + + // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area + return true; + } + bool OnHandleOneTouched( Actor actor, const TouchEvent& touch ) { // TODO - return false; + // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area + return true; } bool OnHandleTwoTouched( Actor actor, const TouchEvent& touch ) { // TODO - return false; + // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area + return true; } // Popup -- 2.7.4