When hover event is registered, only motion comes. You can't know that the hover has started on that actor.
So, when the hover starts on the new actor, set it to STARTED state.
Change-Id: If25595536bce2279529847056ed962c515632165
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- // Another motion event inside actor, signalled with motion
+ // Another motion event inside actor, signalled with start. This is because a new hover event was started on that actor.
application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// We do not want to listen to leave events anymore
data.Reset();
rootData.Reset();
- // Another motion event inside actor, signalled with motion
+ // Another motion event inside actor, signalled with start. This is because a new hover event was started on that actor.
application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f)));
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
- DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
Dali::Actor consumedActor;
if(currentRenderTask)
{
- consumedActor = EmitHoverSignals(hoverEvent->GetHitActor(0), hoverEventHandle);
+ Dali::Actor hitActor = hoverEvent->GetHitActor(0);
+ // If the actor is hit first, the hover is started.
+ if(hitActor &&
+ mLastPrimaryHitActor.GetActor() != hitActor &&
+ state == PointState::MOTION)
+ {
+ Actor* hitActorImpl = &GetImplementation(hitActor);
+ if(hitActorImpl->GetLeaveRequired())
+ {
+ hoverEvent->GetPoint(0).SetState(PointState::STARTED);
+ }
+ }
+ consumedActor = EmitHoverSignals(hitActor, hoverEventHandle);
}
Integration::Point primaryPoint = hoverEvent->GetPoint(0);
Actor* lastPrimaryHitActor(mLastPrimaryHitActor.GetActor());
Actor* lastConsumedActor(mLastConsumedActor.GetActor());
- if((primaryPointState == PointState::MOTION) || (primaryPointState == PointState::FINISHED) || (primaryPointState == PointState::STATIONARY))
+ if((primaryPointState == PointState::STARTED) || (primaryPointState == PointState::MOTION) || (primaryPointState == PointState::FINISHED) || (primaryPointState == PointState::STATIONARY))
{
if(mLastRenderTask)
{
leaveEventConsumer = EmitHoverSignals(mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, PointState::LEAVE);
}
}
- else
+ else if(primaryPointState != PointState::STARTED)
{
// At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one.
// An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
EmitHoverSignals(lastConsumedActor, lastRenderTaskImpl, hoverEvent, PointState::LEAVE);
}
}
- else
+ else if(primaryPointState != PointState::STARTED)
{
// At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one.
// An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
#define DALI_ACTOR_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
/**
* @brief The flag whether an actor should receive a notification when touch or hover motion events leave.
+ * In the case of the hover event, when the hover event enters the actor, it will receive started state.
* @details Name "leaveRequired", type Property::BOOLEAN
* @SINCE_1_0.0
*/
#define DALI_HOVER_EVENT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
* @param[in] point The point required
* @return The state of the point specified
* @note If point is greater than GetPointCount() then this method will return PointState::FINISHED.
+ * If you set Actor::Property::LEAVE_REQUIRED to true, when the hover event enters the actor, it will receive STARTED state.
+ * an actor that received a hover PointState::MOTION event will receive PointState::INTERRUPTED event when Actor::Property::SENSITIVE is changed to false.
+ * However, an actor that received a hover PointState::STARTED event will not receive any event when Actor::Property::SENSITIVE is changed to false.
* @see State
*/
PointState::Type GetState(std::size_t point) const;