-#ifndef __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
-#define __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+#ifndef DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H
+#define DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
#include <dali/internal/event/events/pinch-gesture-detector-impl.h>
#include <dali/internal/event/events/gesture-processor.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
{
-namespace Integration
-{
-class GestureManager;
-struct GestureEvent;
-struct PinchGestureEvent;
-}
-
namespace Internal
{
+class Scene;
class Stage;
+struct PinchGestureEvent;
+
/**
* Pinch Gesture Event Processing:
*
* When we receive a pinch gesture event, we do the following:
- * - Determine the hit actor underneath the center of the pinch gesture event.
- * - Determine whether this actor is, or is a child of, the actor attached to any of the detectors.
- * - Emit the gesture when all the above conditions are met.
+ * - Find the hit actor that requires a pinch underneath the center-point of the pinch.
+ * - Emit the gesture if the event satisfies the detector conditions.
*
* The above is only checked when our gesture starts. We continue sending the pinch gesture to this
* detector until the pinch ends or is cancelled.
*/
-class PinchGestureProcessor : public GestureProcessor
+class PinchGestureProcessor : public GestureProcessor, public RecognizerObserver<PinchGestureEvent>
{
public:
/**
* Create a pinch gesture processor.
- * @param[in] stage The stage.
* @param[in] gestureManager The gesture manager
*/
- PinchGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
+ PinchGestureProcessor();
/**
* Non-virtual destructor; PinchGestureProcessor is not a base class
public: // To be called by GestureEventProcessor
/**
+ * This method sets the minimum distance to start a pinch
+ * @param[in] value The distance in pixels
+ */
+ void SetMinimumPinchDistance( float value );
+
+ /**
* This method is called whenever a pinch gesture event occurs.
+ * @param[in] scene The scene the pinch gesture event occurs in.
* @param[in] pinchEvent The event that has occurred.
*/
- void Process(const Integration::PinchGestureEvent& pinchEvent);
+ void Process( Scene& scene, const PinchGestureEvent& pinchEvent );
/**
* Adds a gesture detector to this gesture processor.
* gesture with the adaptor.
* @param[in] gestureDetector The gesture detector being added.
*/
- void AddGestureDetector(PinchGestureDetector* gestureDetector);
+ void AddGestureDetector(PinchGestureDetector* gestureDetector, Scene& scene);
/**
* Removes the specified gesture detector from this gesture processor. If, after removing this
*/
void OnGesturedActorStageDisconnection();
+ /**
+ * @copydoc GestureProcessor::CheckGestureDetector()
+ */
+ bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
+
+ /**
+ * @copydoc GestureProcessor::EmitGestureSignal()
+ */
+ void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
+
private:
- Stage& mStage;
- Integration::GestureManager& mGestureManager;
- PinchGestureDetectorContainer mGestureDetectors;
- PinchGestureDetectorContainer mCurrentPinchEmitters;
- Dali::RenderTask mCurrentRenderTask;
+ PinchGestureDetectorContainer mPinchGestureDetectors;
+ GestureDetectorContainer mCurrentPinchEmitters;
+ RenderTaskPtr mCurrentRenderTask;
+
+ const PinchGestureEvent* mCurrentPinchEvent; ///< Pointer to current PinchEvent, used when calling ProcessAndEmit()
- struct PinchEventFunctor;
+ float mMinimumPinchDistance;
};
} // namespace Internal
} // namespace Dali
-#endif // __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
+#endif // DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H