From: Joogab Yun Date: Fri, 12 Mar 2021 02:51:25 +0000 (+0900) Subject: 1. It should be touched as much as the area set by the TOUCH_AREA property in the... X-Git-Tag: accepted/tizen/6.0/unified/20211216.155548~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2a7ad48f34809bfd73e9de833fdadba8ed0826a;p=platform%2Fcore%2Fuifw%2Fdali-core.git 1. It should be touched as much as the area set by the TOUCH_AREA property in the View. There was no consideration for TouchArea in SphereTest(). For information 'TouchArea' sets the touch area of ​​the View. 2. Change TOUCH_AREA to TOUCH_AREA_OFFSET You can set offset the touch area. for example) Actor actor = Actor::New(); actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(-100, 100, 100, -100)); actor.TouchedSignal().Connect(OnTouchCallback); then touch area is 210x210. this is actor.width + touchAreaOffset.right - touchAreaOffset.left and actor.height + touchAreaOffset.bottom -touchAreaOffset.top Change-Id: I472bf191e68990e88f73abcf680066b140b73be9 --- diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 1093bf7..217be4a 100755 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -7926,20 +7926,20 @@ int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void) END_TEST; } -int UtcDaliActorTouchAreaPropertyP(void) +int UtcDaliActorTouchAreaOffsetPropertyP(void) { TestApplication application; - Actor actor = Actor::New(); - Vector2 touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get(); - DALI_TEST_EQUALS(touchArea, Vector2::ZERO, TEST_LOCATION); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(10.f, 10.f)); - touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get(); - DALI_TEST_EQUALS(touchArea, Vector2(10.f, 10.f), TEST_LOCATION); + Actor actor = Actor::New(); + Rect touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get>(); + DALI_TEST_EQUALS(Rect(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(10, 20, 30, 40)); + touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get>(); + DALI_TEST_EQUALS(Rect(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION); END_TEST; } -int UtcDaliActorTouchAreaPropertyN(void) +int UtcDaliActorTouchAreaOffsetPropertyN(void) { TestApplication application; @@ -7948,12 +7948,12 @@ int UtcDaliActorTouchAreaPropertyN(void) // Make sure setting invalid types does not cause a crash try { - actor.SetProperty(DevelActor::Property::TOUCH_AREA, 1.0f); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2::ONE); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector3::ONE); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector4::ONE); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Map()); - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Array()); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map()); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array()); tet_result(TET_PASS); } catch(...) diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp old mode 100755 new mode 100644 index d82eacb..ac66e4d --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -2087,7 +2087,6 @@ int UtcDaliTouchEventIntegNewTouchEvent(void) END_TEST; } - int UtcDaliTouchEventIntercept(void) { TestApplication application; @@ -2111,7 +2110,6 @@ int UtcDaliTouchEventIntercept(void) TouchEventFunctor functor(data, false /* Do not consume */); actor.TouchedSignal().Connect(&application, functor); - // Connect to parent's touched signal SignalData parentData; TouchEventFunctor parentFunctor(parentData, false /* Do not consume */); @@ -2139,7 +2137,7 @@ int UtcDaliTouchEventIntercept(void) END_TEST; } -int UtcDaliTouchArea(void) +int UtcDaliTouchAreaOffset(void) { TestApplication application; @@ -2165,14 +2163,29 @@ int UtcDaliTouchArea(void) data.Reset(); // set a bigger touch area - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(200.0f, 200.0f)); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(-70, 70, 70, -70)); // left, right, bottom, top // Render and notify application.SendNotification(); application.Render(); // Emit a down signal - application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(110.0f, 110.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(150.0f, 150.0f))); + // The actor touched signal is called because the touch area is inside touchArea. + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + data.Reset(); + + // set a offset touch area + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(50, 100, -50, 0)); // left, right, bottom, top + + // Render and notify + application.SendNotification(); + application.Render(); + + // Emit a down signal + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(190.0f, 25.0f))); // The actor touched signal is called because the touch area is inside touchArea. DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); @@ -2180,20 +2193,20 @@ int UtcDaliTouchArea(void) data.Reset(); // set a smaller touch area - actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(50.0f, 50.0f)); + actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(50, 0, 0, 50)); // Render and notify application.SendNotification(); application.Render(); // Emit a down signal - application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(80.0f, 80.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(40.0f, 40.0f))); // The actor touched signal is not called because the touch area is outside touchArea. DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal - application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(30.0f, 30.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(90.0f, 90.0f))); // The actor touched signal is called because the touch area is inside touchArea. DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); diff --git a/dali/devel-api/actors/actor-devel.h b/dali/devel-api/actors/actor-devel.h index 6c9eba0..88fc86b 100755 --- a/dali/devel-api/actors/actor-devel.h +++ b/dali/devel-api/actors/actor-devel.h @@ -2,7 +2,7 @@ #define DALI_ACTOR_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -120,18 +120,36 @@ enum Type CAPTURE_ALL_TOUCH_AFTER_START, /** - * @brief If you set the TOUCH_AREA on an actor, when you touch the actor, the touch area is used rather than the size of the actor - * @details Name "touchArea", type Property::Vector2 - * @note Default is Vector2::ZERO. + * @brief If you set the TOUCH_AREA_OFFSET on an actor, when you touch the actor, the touch area is expand from the size of actor. + * @details Name "touchAreaOffset", type Property::Rect (left, right, bottom, top) * @note for example * Actor actor = Actor::New(); - * actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); - * actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(200.0f, 200.0f)); + * actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f)); + * actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect(-10, 20, 30, -40)); * actor.TouchedSignal().Connect(OnTouchCallback); * - * If you want to reset the touch area to an area different with the size of the actor, you can set this TOUCH_AREA property. + * +---------------------+ + * | ^ | + * | | | + * | | -40 | + * | | | + * | | | + * | +----+----+ | + * | | | | + * | -10| | 20 | + * |<---+ +----->| + * | | | | + * | | | | + * | +----+----+ | + * | | | + * | | 30 | + * | | | + * | v | + * +---------------------+ + + * The actual touched size is actor.width + touchAreaOffset.right - touchAreaOffset.left and actor.height + touchAreaOffset.bottom - touchAreaOffset.top */ - TOUCH_AREA + TOUCH_AREA_OFFSET, }; } // namespace Property diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp old mode 100755 new mode 100644 index eccc527..5fb9d4f --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,54 +19,51 @@ #include // EXTERNAL INCLUDES -#include #include #include +#include // INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include #include +#include +#include #include #include -#include -#include #include -#include +#include +#include #include -#include -#include #include +#include #include -#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include +#include +#include +#include +#include -using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::AnimatableProperty; +using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::PropertyBase; #if defined(DEBUG_ENABLED) -Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" ); -Debug::Filter* gLogRelayoutFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_TIMER" ); +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER"); +Debug::Filter* gLogRelayoutFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_TIMER"); #endif namespace Dali { - namespace Internal { - namespace // unnamed namespace { - // Properties /** @@ -75,89 +72,89 @@ namespace // unnamed namespace * Name Type writable animatable constraint-input enum for index-checking */ DALI_PROPERTY_TABLE_BEGIN -DALI_PROPERTY( "parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN ) -DALI_PROPERTY( "parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X ) -DALI_PROPERTY( "parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y ) -DALI_PROPERTY( "parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z ) -DALI_PROPERTY( "anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT ) -DALI_PROPERTY( "anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X ) -DALI_PROPERTY( "anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y ) -DALI_PROPERTY( "anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z ) -DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE ) -DALI_PROPERTY( "sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH ) -DALI_PROPERTY( "sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT ) -DALI_PROPERTY( "sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH ) -DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION ) -DALI_PROPERTY( "positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X ) -DALI_PROPERTY( "positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y ) -DALI_PROPERTY( "positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z ) -DALI_PROPERTY( "worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION ) -DALI_PROPERTY( "worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X ) -DALI_PROPERTY( "worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y ) -DALI_PROPERTY( "worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z ) -DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION ) -DALI_PROPERTY( "worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION ) -DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE ) -DALI_PROPERTY( "scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X ) -DALI_PROPERTY( "scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y ) -DALI_PROPERTY( "scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z ) -DALI_PROPERTY( "worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE ) -DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE ) -DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR ) -DALI_PROPERTY( "colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED ) -DALI_PROPERTY( "colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN ) -DALI_PROPERTY( "colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE ) -DALI_PROPERTY( "colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA ) -DALI_PROPERTY( "worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR ) -DALI_PROPERTY( "worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX ) -DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME ) -DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE ) -DALI_PROPERTY( "leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED ) -DALI_PROPERTY( "inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION ) -DALI_PROPERTY( "inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE ) -DALI_PROPERTY( "colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE ) -DALI_PROPERTY( "drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE ) -DALI_PROPERTY( "sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR ) -DALI_PROPERTY( "widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY ) -DALI_PROPERTY( "heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY ) -DALI_PROPERTY( "sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY ) -DALI_PROPERTY( "widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT ) -DALI_PROPERTY( "heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH ) -DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING ) -DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE ) -DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE ) -DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION ) -DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE ) -DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION ) -DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION ) -DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY ) -DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION ) -DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT ) -DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED ) -DALI_PROPERTY( "id", INTEGER, false, false, false, Dali::Actor::Property::ID ) -DALI_PROPERTY( "hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH ) -DALI_PROPERTY( "isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT ) -DALI_PROPERTY( "isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER ) -DALI_PROPERTY( "connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE ) -DALI_PROPERTY( "keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE ) -DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER ) -DALI_PROPERTY( "updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT ) -DALI_PROPERTY( "captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START ) -DALI_PROPERTY( "touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA ) -DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties ) +DALI_PROPERTY("parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN) +DALI_PROPERTY("parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X) +DALI_PROPERTY("parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y) +DALI_PROPERTY("parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z) +DALI_PROPERTY("anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT) +DALI_PROPERTY("anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X) +DALI_PROPERTY("anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y) +DALI_PROPERTY("anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z) +DALI_PROPERTY("size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE) +DALI_PROPERTY("sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH) +DALI_PROPERTY("sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT) +DALI_PROPERTY("sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH) +DALI_PROPERTY("position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION) +DALI_PROPERTY("positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X) +DALI_PROPERTY("positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y) +DALI_PROPERTY("positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z) +DALI_PROPERTY("worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION) +DALI_PROPERTY("worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X) +DALI_PROPERTY("worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y) +DALI_PROPERTY("worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z) +DALI_PROPERTY("orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION) +DALI_PROPERTY("worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION) +DALI_PROPERTY("scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE) +DALI_PROPERTY("scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X) +DALI_PROPERTY("scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y) +DALI_PROPERTY("scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z) +DALI_PROPERTY("worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE) +DALI_PROPERTY("visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE) +DALI_PROPERTY("color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR) +DALI_PROPERTY("colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED) +DALI_PROPERTY("colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN) +DALI_PROPERTY("colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE) +DALI_PROPERTY("colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA) +DALI_PROPERTY("worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR) +DALI_PROPERTY("worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX) +DALI_PROPERTY("name", STRING, true, false, false, Dali::Actor::Property::NAME) +DALI_PROPERTY("sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE) +DALI_PROPERTY("leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED) +DALI_PROPERTY("inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION) +DALI_PROPERTY("inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE) +DALI_PROPERTY("colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE) +DALI_PROPERTY("drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE) +DALI_PROPERTY("sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR) +DALI_PROPERTY("widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY) +DALI_PROPERTY("heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY) +DALI_PROPERTY("sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY) +DALI_PROPERTY("widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT) +DALI_PROPERTY("heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH) +DALI_PROPERTY("padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING) +DALI_PROPERTY("minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE) +DALI_PROPERTY("maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE) +DALI_PROPERTY("inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION) +DALI_PROPERTY("clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE) +DALI_PROPERTY("layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION) +DALI_PROPERTY("inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION) +DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY) +DALI_PROPERTY("screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION) +DALI_PROPERTY("positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT) +DALI_PROPERTY("culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED) +DALI_PROPERTY("id", INTEGER, false, false, false, Dali::Actor::Property::ID) +DALI_PROPERTY("hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH) +DALI_PROPERTY("isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT) +DALI_PROPERTY("isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER) +DALI_PROPERTY("connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE) +DALI_PROPERTY("keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE) +DALI_PROPERTY("siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER) +DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT) +DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START) +DALI_PROPERTY("touchAreaOffset", RECTANGLE, true, false, false, Dali::DevelActor::Property::TOUCH_AREA_OFFSET) +DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties) // Signals -const char* const SIGNAL_HOVERED = "hovered"; -const char* const SIGNAL_WHEEL_EVENT = "wheelEvent"; -const char* const SIGNAL_ON_SCENE = "onScene"; -const char* const SIGNAL_OFF_SCENE = "offScene"; -const char* const SIGNAL_ON_RELAYOUT = "onRelayout"; -const char* const SIGNAL_TOUCHED = "touched"; -const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged"; +const char* const SIGNAL_HOVERED = "hovered"; +const char* const SIGNAL_WHEEL_EVENT = "wheelEvent"; +const char* const SIGNAL_ON_SCENE = "onScene"; +const char* const SIGNAL_OFF_SCENE = "offScene"; +const char* const SIGNAL_ON_RELAYOUT = "onRelayout"; +const char* const SIGNAL_TOUCHED = "touched"; +const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged"; const char* const SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged"; -const char* const SIGNAL_CHILD_ADDED = "childAdded"; -const char* const SIGNAL_CHILD_REMOVED = "childRemoved"; +const char* const SIGNAL_CHILD_ADDED = "childAdded"; +const char* const SIGNAL_CHILD_REMOVED = "childRemoved"; // Actions @@ -169,21 +166,21 @@ BaseHandle CreateActor() return Dali::Actor::New(); } -TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties ); +TypeRegistration mType(typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties); -SignalConnectorType signalConnector2( mType, SIGNAL_HOVERED, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector3( mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector5( mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector7( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector8( mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector9( mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector10( mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal ); -SignalConnectorType signalConnector11( mType, SIGNAL_CHILD_REMOVED, &Actor::DoConnectSignal ); +SignalConnectorType signalConnector2(mType, SIGNAL_HOVERED, &Actor::DoConnectSignal); +SignalConnectorType signalConnector3(mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal); +SignalConnectorType signalConnector4(mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal); +SignalConnectorType signalConnector5(mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal); +SignalConnectorType signalConnector6(mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal); +SignalConnectorType signalConnector7(mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal); +SignalConnectorType signalConnector8(mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal); +SignalConnectorType signalConnector9(mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal); +SignalConnectorType signalConnector10(mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal); +SignalConnectorType signalConnector11(mType, SIGNAL_CHILD_REMOVED, &Actor::DoConnectSignal); -TypeAction a1( mType, ACTION_SHOW, &Actor::DoAction ); -TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction ); +TypeAction a1(mType, ACTION_SHOW, &Actor::DoAction); +TypeAction a2(mType, ACTION_HIDE, &Actor::DoAction); /** * @brief Extract a given dimension from a Vector2 @@ -192,9 +189,9 @@ TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction ); * @param[in] dimension The dimension to extract * @return Return the value for the dimension */ -constexpr float GetDimensionValue( const Vector2& values, Dimension::Type dimension ) +constexpr float GetDimensionValue(const Vector2& values, Dimension::Type dimension) { - switch( dimension ) + switch(dimension) { case Dimension::WIDTH: { @@ -219,9 +216,9 @@ constexpr float GetDimensionValue( const Vector2& values, Dimension::Type dimens * @param[in] dimension The dimension to extract * @return Return the value for the dimension */ -float GetDimensionValue( const Vector3& values, Dimension::Type dimension ) +float GetDimensionValue(const Vector3& values, Dimension::Type dimension) { - return GetDimensionValue( values.GetVectorXY(), dimension ); + return GetDimensionValue(values.GetVectorXY(), dimension); } /** @@ -230,17 +227,17 @@ float GetDimensionValue( const Vector3& values, Dimension::Type dimension ) * @param[in] visible The new visibility of the actor * @param[in] type Whether the actor's visible property has changed or a parent's */ -void EmitVisibilityChangedSignalRecursively( ActorPtr actor, bool visible, DevelActor::VisibilityChange::Type type ) +void EmitVisibilityChangedSignalRecursively(ActorPtr actor, bool visible, DevelActor::VisibilityChange::Type type) { - if( actor ) + if(actor) { - actor->EmitVisibilityChangedSignal( visible, type ); + actor->EmitVisibilityChangedSignal(visible, type); - if( actor->GetChildCount() > 0 ) + if(actor->GetChildCount() > 0) { - for( auto& child : actor->GetChildrenInternal() ) + for(auto& child : actor->GetChildrenInternal()) { - EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT ); + EmitVisibilityChangedSignalRecursively(child, visible, DevelActor::VisibilityChange::PARENT); } } } @@ -248,14 +245,14 @@ void EmitVisibilityChangedSignalRecursively( ActorPtr actor, bool visible, Devel /// Helper for emitting a signal template -bool EmitConsumingSignal( Actor& actor, Signal& signal, const Event& event ) +bool EmitConsumingSignal(Actor& actor, Signal& signal, const Event& event) { bool consumed = false; - if( !signal.Empty() ) + if(!signal.Empty()) { - Dali::Actor handle( &actor ); - consumed = signal.Emit( handle, event ); + Dali::Actor handle(&actor); + consumed = signal.Emit(handle, event); } return consumed; @@ -263,59 +260,59 @@ bool EmitConsumingSignal( Actor& actor, Signal& signal, const Event& event ) /// Helper for emitting signals with multiple parameters template -void EmitSignal( Actor& actor, Signal& signal, Param... params) +void EmitSignal(Actor& actor, Signal& signal, Param... params) { - if( !signal.Empty() ) + if(!signal.Empty()) { - Dali::Actor handle( &actor ); - signal.Emit( handle, params... ); + Dali::Actor handle(&actor); + signal.Emit(handle, params...); } } bool ScreenToLocalInternal( - const Matrix& viewMatrix, - const Matrix& projectionMatrix, - const Matrix& worldMatrix, - const Viewport& viewport, - const Vector3& currentSize, - float& localX, - float& localY, - float screenX, - float screenY ) + const Matrix& viewMatrix, + const Matrix& projectionMatrix, + const Matrix& worldMatrix, + const Viewport& viewport, + const Vector3& currentSize, + float& localX, + float& localY, + float screenX, + float screenY) { // Get the ModelView matrix Matrix modelView; - Matrix::Multiply( modelView, worldMatrix, viewMatrix ); + Matrix::Multiply(modelView, worldMatrix, viewMatrix); // Calculate the inverted ModelViewProjection matrix; this will be used for 2 unprojects - Matrix invertedMvp( false/*don't init*/); - Matrix::Multiply( invertedMvp, modelView, projectionMatrix ); + Matrix invertedMvp(false /*don't init*/); + Matrix::Multiply(invertedMvp, modelView, projectionMatrix); bool success = invertedMvp.Invert(); // Convert to GL coordinates - Vector4 screenPos( screenX - static_cast( viewport.x ), static_cast( viewport.height ) - screenY - static_cast( viewport.y ), 0.f, 1.f ); + Vector4 screenPos(screenX - static_cast(viewport.x), static_cast(viewport.height) - screenY - static_cast(viewport.y), 0.f, 1.f); Vector4 nearPos; - if( success ) + if(success) { - success = Unproject( screenPos, invertedMvp, static_cast( viewport.width ), static_cast( viewport.height ), nearPos ); + success = Unproject(screenPos, invertedMvp, static_cast(viewport.width), static_cast(viewport.height), nearPos); } Vector4 farPos; - if( success ) + if(success) { screenPos.z = 1.0f; - success = Unproject( screenPos, invertedMvp, static_cast( viewport.width ), static_cast( viewport.height ), farPos ); + success = Unproject(screenPos, invertedMvp, static_cast(viewport.width), static_cast(viewport.height), farPos); } - if( success ) + if(success) { Vector4 local; - if( XyPlaneIntersect( nearPos, farPos, local ) ) + if(XyPlaneIntersect(nearPos, farPos, local)) { Vector3 size = currentSize; - localX = local.x + size.x * 0.5f; - localY = local.y + size.y * 0.5f; + localX = local.x + size.x * 0.5f; + localY = local.y + size.y * 0.5f; } else { @@ -331,7 +328,7 @@ bool ScreenToLocalInternal( ActorPtr Actor::New() { // pass a reference to actor, actor does not own its node - ActorPtr actor( new Actor( BASIC, *CreateNode() ) ); + ActorPtr actor(new Actor(BASIC, *CreateNode())); // Second-phase construction actor->Initialize(); @@ -342,23 +339,23 @@ ActorPtr Actor::New() const SceneGraph::Node* Actor::CreateNode() { // create node. Nodes are owned by the update manager - SceneGraph::Node* node = SceneGraph::Node::New(); - OwnerPointer< SceneGraph::Node > transferOwnership( node ); - Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); + SceneGraph::Node* node = SceneGraph::Node::New(); + OwnerPointer transferOwnership(node); + Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); - DALI_ASSERT_ALWAYS( tls && "ThreadLocalStorage is null" ); + DALI_ASSERT_ALWAYS(tls && "ThreadLocalStorage is null"); - AddNodeMessage( tls->GetUpdateManager(), transferOwnership ); + AddNodeMessage(tls->GetUpdateManager(), transferOwnership); return node; } -void Actor::SetName( const std::string& name ) +void Actor::SetName(const std::string& name) { mName = name; // ATTENTION: string for debug purposes is not thread safe. - DALI_LOG_SET_OBJECT_STRING( const_cast< SceneGraph::Node* >( &GetNode() ), name ); + DALI_LOG_SET_OBJECT_STRING(const_cast(&GetNode()), name); } uint32_t Actor::GetId() const @@ -371,67 +368,67 @@ Dali::Layer Actor::GetLayer() Dali::Layer layer; // Short-circuit for Layer derived actors - if( mIsLayer ) + if(mIsLayer) { - layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( this ) ); // static cast as we trust the flag + layer = Dali::Layer(static_cast(this)); // static cast as we trust the flag } // Find the immediate Layer parent - for( Actor* parent = mParent; !layer && parent != nullptr; parent = parent->GetParent() ) + for(Actor* parent = mParent; !layer && parent != nullptr; parent = parent->GetParent()) { - if( parent->IsLayer() ) + if(parent->IsLayer()) { - layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( parent ) ); // static cast as we trust the flag + layer = Dali::Layer(static_cast(parent)); // static cast as we trust the flag } } return layer; } -void Actor::Add( Actor& child ) +void Actor::Add(Actor& child) { - DALI_ASSERT_ALWAYS( this != &child && "Cannot add actor to itself" ); - DALI_ASSERT_ALWAYS( !child.IsRoot() && "Cannot add root actor" ); + DALI_ASSERT_ALWAYS(this != &child && "Cannot add actor to itself"); + DALI_ASSERT_ALWAYS(!child.IsRoot() && "Cannot add root actor"); - if( !mChildren ) + if(!mChildren) { mChildren = new ActorContainer; } - Actor* const oldParent( child.mParent ); + Actor* const oldParent(child.mParent); // child might already be ours - if( this != oldParent ) + if(this != oldParent) { // if we already have parent, unparent us first - if( oldParent ) + if(oldParent) { - oldParent->Remove( child ); // This causes OnChildRemove callback & ChildRemoved signal + oldParent->Remove(child); // This causes OnChildRemove callback & ChildRemoved signal // Old parent may need to readjust to missing child - if( oldParent->RelayoutDependentOnChildren() ) + if(oldParent->RelayoutDependentOnChildren()) { oldParent->RelayoutRequest(); } } // Guard against Add() during previous OnChildRemove callback - if( !child.mParent ) + if(!child.mParent) { // Do this first, since user callbacks from within SetParent() may need to remove child - mChildren->push_back( ActorPtr( &child ) ); + mChildren->push_back(ActorPtr(&child)); // SetParent asserts that child can be added - child.SetParent( this ); + child.SetParent(this); // Notification for derived classes - OnChildAdd( child ); - EmitChildAddedSignal( child ); + OnChildAdd(child); + EmitChildAddedSignal(child); - InheritLayoutDirectionRecursively( ActorPtr( &child ), mLayoutDirection ); + InheritLayoutDirectionRecursively(ActorPtr(&child), mLayoutDirection); // Only put in a relayout request if there is a suitable dependency - if( RelayoutDependentOnChildren() ) + if(RelayoutDependentOnChildren()) { RelayoutRequest(); } @@ -439,9 +436,9 @@ void Actor::Add( Actor& child ) } } -void Actor::Remove( Actor& child ) +void Actor::Remove(Actor& child) { - if( (this == &child) || (!mChildren) ) + if((this == &child) || (!mChildren)) { // no children or removing itself return; @@ -451,76 +448,76 @@ void Actor::Remove( Actor& child ) // Find the child in mChildren, and unparent it ActorIter end = mChildren->end(); - for( ActorIter iter = mChildren->begin(); iter != end; ++iter ) + for(ActorIter iter = mChildren->begin(); iter != end; ++iter) { ActorPtr actor = (*iter); - if( actor.Get() == &child ) + if(actor.Get() == &child) { // Keep handle for OnChildRemove notification removed = actor; // Do this first, since user callbacks from within SetParent() may need to add the child - mChildren->erase( iter ); + mChildren->erase(iter); - DALI_ASSERT_DEBUG( actor->GetParent() == this ); - actor->SetParent( nullptr ); + DALI_ASSERT_DEBUG(actor->GetParent() == this); + actor->SetParent(nullptr); break; } } - if( removed ) + if(removed) { // Only put in a relayout request if there is a suitable dependency - if( RelayoutDependentOnChildren() ) + if(RelayoutDependentOnChildren()) { RelayoutRequest(); } } // Notification for derived classes - OnChildRemove( child ); - EmitChildRemovedSignal( child ); + OnChildRemove(child); + EmitChildRemovedSignal(child); } void Actor::Unparent() { - if( mParent ) + if(mParent) { // Remove this actor from the parent. The remove will put a relayout request in for // the parent if required - mParent->Remove( *this ); + mParent->Remove(*this); // mParent is now NULL! } } uint32_t Actor::GetChildCount() const { - return ( nullptr != mChildren ) ? static_cast( mChildren->size() ) : 0; // only 4,294,967,295 children per actor + return (nullptr != mChildren) ? static_cast(mChildren->size()) : 0; // only 4,294,967,295 children per actor } -ActorPtr Actor::GetChildAt( uint32_t index ) const +ActorPtr Actor::GetChildAt(uint32_t index) const { - DALI_ASSERT_ALWAYS( index < GetChildCount() ); + DALI_ASSERT_ALWAYS(index < GetChildCount()); - return ( ( mChildren ) ? ( *mChildren )[ index ] : ActorPtr() ); + return ((mChildren) ? (*mChildren)[index] : ActorPtr()); } -ActorPtr Actor::FindChildByName( const std::string& actorName ) +ActorPtr Actor::FindChildByName(const std::string& actorName) { ActorPtr child = nullptr; - if( actorName == mName ) + if(actorName == mName) { child = this; } - else if( mChildren ) + else if(mChildren) { - for( const auto& actor : *mChildren ) + for(const auto& actor : *mChildren) { - child = actor->FindChildByName( actorName ); + child = actor->FindChildByName(actorName); - if( child ) + if(child) { break; } @@ -529,20 +526,20 @@ ActorPtr Actor::FindChildByName( const std::string& actorName ) return child; } -ActorPtr Actor::FindChildById( const uint32_t id ) +ActorPtr Actor::FindChildById(const uint32_t id) { ActorPtr child = nullptr; - if( id == GetId() ) + if(id == GetId()) { child = this; } - else if( mChildren ) + else if(mChildren) { - for( const auto& actor : *mChildren ) + for(const auto& actor : *mChildren) { - child = actor->FindChildById( id ); + child = actor->FindChildById(id); - if( child ) + if(child) { break; } @@ -551,18 +548,18 @@ ActorPtr Actor::FindChildById( const uint32_t id ) return child; } -void Actor::SetParentOrigin( const Vector3& origin ) +void Actor::SetParentOrigin(const Vector3& origin) { // node is being used in a separate thread; queue a message to set the value & base value - SetParentOriginMessage( GetEventThreadServices(), GetNode(), origin ); + SetParentOriginMessage(GetEventThreadServices(), GetNode(), origin); // Cache for event-thread access - if( !mParentOrigin ) + if(!mParentOrigin) { // not allocated, check if different from default - if( ParentOrigin::DEFAULT != origin ) + if(ParentOrigin::DEFAULT != origin) { - mParentOrigin = new Vector3( origin ); + mParentOrigin = new Vector3(origin); } } else @@ -575,21 +572,21 @@ void Actor::SetParentOrigin( const Vector3& origin ) const Vector3& Actor::GetCurrentParentOrigin() const { // Cached for event-thread access - return ( mParentOrigin ) ? *mParentOrigin : ParentOrigin::DEFAULT; + return (mParentOrigin) ? *mParentOrigin : ParentOrigin::DEFAULT; } -void Actor::SetAnchorPoint( const Vector3& anchor ) +void Actor::SetAnchorPoint(const Vector3& anchor) { // node is being used in a separate thread; queue a message to set the value & base value - SetAnchorPointMessage( GetEventThreadServices(), GetNode(), anchor ); + SetAnchorPointMessage(GetEventThreadServices(), GetNode(), anchor); // Cache for event-thread access - if( !mAnchorPoint ) + if(!mAnchorPoint) { // not allocated, check if different from default - if( AnchorPoint::DEFAULT != anchor ) + if(AnchorPoint::DEFAULT != anchor) { - mAnchorPoint = new Vector3( anchor ); + mAnchorPoint = new Vector3(anchor); } } else @@ -602,57 +599,57 @@ void Actor::SetAnchorPoint( const Vector3& anchor ) const Vector3& Actor::GetCurrentAnchorPoint() const { // Cached for event-thread access - return ( mAnchorPoint ) ? *mAnchorPoint : AnchorPoint::DEFAULT; + return (mAnchorPoint) ? *mAnchorPoint : AnchorPoint::DEFAULT; } -void Actor::SetPosition( float x, float y ) +void Actor::SetPosition(float x, float y) { - SetPosition( Vector3( x, y, 0.0f ) ); + SetPosition(Vector3(x, y, 0.0f)); } -void Actor::SetPosition( float x, float y, float z ) +void Actor::SetPosition(float x, float y, float z) { - SetPosition( Vector3( x, y, z ) ); + SetPosition(Vector3(x, y, z)); } -void Actor::SetPosition( const Vector3& position ) +void Actor::SetPosition(const Vector3& position) { mTargetPosition = position; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::Bake, position ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::Bake, position); } -void Actor::SetX( float x ) +void Actor::SetX(float x) { mTargetPosition.x = x; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeX, x ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeX, x); } -void Actor::SetY( float y ) +void Actor::SetY(float y) { mTargetPosition.y = y; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeY, y ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeY, y); } -void Actor::SetZ( float z ) +void Actor::SetZ(float z) { mTargetPosition.z = z; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z); } -void Actor::TranslateBy( const Vector3& distance ) +void Actor::TranslateBy(const Vector3& distance) { mTargetPosition += distance; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, distance ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, distance); } const Vector3& Actor::GetCurrentPosition() const @@ -664,68 +661,68 @@ const Vector3& Actor::GetCurrentPosition() const const Vector3& Actor::GetCurrentWorldPosition() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex()); } const Vector2 Actor::GetCurrentScreenPosition() const { - if( mScene && OnScene() ) + if(mScene && OnScene()) { - Vector3 worldPosition = GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); - Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); + Vector3 worldPosition = GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex()); + Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex()); worldPosition -= cameraPosition; Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale(); - Vector2 halfSceneSize( mScene->GetSize() * 0.5f ); // World position origin is center of scene - Vector3 halfActorSize( actorSize * 0.5f ); - Vector3 anchorPointOffSet = halfActorSize - actorSize * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); + Vector2 halfSceneSize(mScene->GetSize() * 0.5f); // World position origin is center of scene + Vector3 halfActorSize(actorSize * 0.5f); + Vector3 anchorPointOffSet = halfActorSize - actorSize * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT); - return Vector2( halfSceneSize.width + worldPosition.x - anchorPointOffSet.x, - halfSceneSize.height + worldPosition.y - anchorPointOffSet.y ); + return Vector2(halfSceneSize.width + worldPosition.x - anchorPointOffSet.x, + halfSceneSize.height + worldPosition.y - anchorPointOffSet.y); } return Vector2::ZERO; } -void Actor::SetInheritPosition( bool inherit ) +void Actor::SetInheritPosition(bool inherit) { - if( mInheritPosition != inherit ) + if(mInheritPosition != inherit) { // non animatable so keep local copy mInheritPosition = inherit; - SetInheritPositionMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritPositionMessage(GetEventThreadServices(), GetNode(), inherit); } } -void Actor::SetOrientation( const Radian& angle, const Vector3& axis ) +void Actor::SetOrientation(const Radian& angle, const Vector3& axis) { - Vector3 normalizedAxis( axis.x, axis.y, axis.z ); + Vector3 normalizedAxis(axis.x, axis.y, axis.z); normalizedAxis.Normalize(); - Quaternion orientation( angle, normalizedAxis ); + Quaternion orientation(angle, normalizedAxis); - SetOrientation( orientation ); + SetOrientation(orientation); } -void Actor::SetOrientation( const Quaternion& orientation ) +void Actor::SetOrientation(const Quaternion& orientation) { mTargetOrientation = orientation; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::Bake, orientation ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::Bake, orientation); } -void Actor::RotateBy( const Radian& angle, const Vector3& axis ) +void Actor::RotateBy(const Radian& angle, const Vector3& axis) { - RotateBy( Quaternion(angle, axis) ); + RotateBy(Quaternion(angle, axis)); } -void Actor::RotateBy( const Quaternion& relativeRotation ) +void Actor::RotateBy(const Quaternion& relativeRotation) { - mTargetOrientation *= Quaternion( relativeRotation ); + mTargetOrientation *= Quaternion(relativeRotation); // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, relativeRotation ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, relativeRotation); } const Quaternion& Actor::GetCurrentOrientation() const @@ -737,49 +734,49 @@ const Quaternion& Actor::GetCurrentOrientation() const const Quaternion& Actor::GetCurrentWorldOrientation() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldOrientation( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldOrientation(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetScale( float scale ) +void Actor::SetScale(float scale) { - SetScale( Vector3( scale, scale, scale ) ); + SetScale(Vector3(scale, scale, scale)); } -void Actor::SetScale( float x, float y, float z ) +void Actor::SetScale(float x, float y, float z) { - SetScale( Vector3( x, y, z ) ); + SetScale(Vector3(x, y, z)); } -void Actor::SetScale( const Vector3& scale ) +void Actor::SetScale(const Vector3& scale) { mTargetScale = scale; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::Bake, scale ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::Bake, scale); } -void Actor::SetScaleX( float x ) +void Actor::SetScaleX(float x) { mTargetScale.x = x; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeX, x ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeX, x); } -void Actor::SetScaleY( float y ) +void Actor::SetScaleY(float y) { mTargetScale.y = y; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeY, y ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeY, y); } -void Actor::SetScaleZ( float z ) +void Actor::SetScaleZ(float z) { mTargetScale.z = z; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z); } void Actor::ScaleBy(const Vector3& relativeScale) @@ -787,7 +784,7 @@ void Actor::ScaleBy(const Vector3& relativeScale) mTargetScale *= relativeScale; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeRelativeMultiply, relativeScale ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeRelativeMultiply, relativeScale); } const Vector3& Actor::GetCurrentScale() const @@ -799,17 +796,17 @@ const Vector3& Actor::GetCurrentScale() const const Vector3& Actor::GetCurrentWorldScale() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldScale( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldScale(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetInheritScale( bool inherit ) +void Actor::SetInheritScale(bool inherit) { - if( mInheritScale != inherit ) + if(mInheritScale != inherit) { // non animatable so keep local copy mInheritScale = inherit; // node is being used in a separate thread; queue a message to set the value - SetInheritScaleMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritScaleMessage(GetEventThreadServices(), GetNode(), inherit); } } @@ -818,23 +815,23 @@ Matrix Actor::GetCurrentWorldMatrix() const return GetNode().GetWorldMatrix(0); } -void Actor::SetVisible( bool visible ) +void Actor::SetVisible(bool visible) { - SetVisibleInternal( visible, SendMessage::TRUE ); + SetVisibleInternal(visible, SendMessage::TRUE); } bool Actor::IsVisible() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().IsVisible( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().IsVisible(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetOpacity( float opacity ) +void Actor::SetOpacity(float opacity) { mTargetColor.a = opacity; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeW, opacity ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeW, opacity); } float Actor::GetCurrentOpacity() const @@ -845,39 +842,39 @@ float Actor::GetCurrentOpacity() const const Vector4& Actor::GetCurrentWorldColor() const { - return GetNode().GetWorldColor( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldColor(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetColor( const Vector4& color ) +void Actor::SetColor(const Vector4& color) { mTargetColor = color; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::Bake, color ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::Bake, color); } -void Actor::SetColorRed( float red ) +void Actor::SetColorRed(float red) { mTargetColor.r = red; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeX, red ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeX, red); } -void Actor::SetColorGreen( float green ) +void Actor::SetColorGreen(float green) { mTargetColor.g = green; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeY, green ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeY, green); } -void Actor::SetColorBlue( float blue ) +void Actor::SetColorBlue(float blue) { mTargetColor.b = blue; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeZ, blue ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeZ, blue); } const Vector4& Actor::GetCurrentColor() const @@ -886,18 +883,18 @@ const Vector4& Actor::GetCurrentColor() const return GetNode().GetColor(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetInheritOrientation( bool inherit ) +void Actor::SetInheritOrientation(bool inherit) { - if( mInheritOrientation != inherit ) + if(mInheritOrientation != inherit) { // non animatable so keep local copy mInheritOrientation = inherit; // node is being used in a separate thread; queue a message to set the value - SetInheritOrientationMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritOrientationMessage(GetEventThreadServices(), GetNode(), inherit); } } -void Actor::SetSizeModeFactor( const Vector3& factor ) +void Actor::SetSizeModeFactor(const Vector3& factor) { EnsureRelayouter(); @@ -906,7 +903,7 @@ void Actor::SetSizeModeFactor( const Vector3& factor ) const Vector3& Actor::GetSizeModeFactor() const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->sizeModeFactor; } @@ -914,79 +911,79 @@ const Vector3& Actor::GetSizeModeFactor() const return Relayouter::DEFAULT_SIZE_MODE_FACTOR; } -void Actor::SetColorMode( ColorMode colorMode ) +void Actor::SetColorMode(ColorMode colorMode) { // non animatable so keep local copy mColorMode = colorMode; // node is being used in a separate thread; queue a message to set the value - SetColorModeMessage( GetEventThreadServices(), GetNode(), colorMode ); + SetColorModeMessage(GetEventThreadServices(), GetNode(), colorMode); } -void Actor::SetSize( float width, float height ) +void Actor::SetSize(float width, float height) { - SetSize( Vector2( width, height ) ); + SetSize(Vector2(width, height)); } -void Actor::SetSize( float width, float height, float depth ) +void Actor::SetSize(float width, float height, float depth) { - SetSize( Vector3( width, height, depth ) ); + SetSize(Vector3(width, height, depth)); } -void Actor::SetSize( const Vector2& size ) +void Actor::SetSize(const Vector2& size) { - SetSize( Vector3( size.width, size.height, 0.f ) ); + SetSize(Vector3(size.width, size.height, 0.f)); } -void Actor::SetSizeInternal( const Vector2& size ) +void Actor::SetSizeInternal(const Vector2& size) { - SetSizeInternal( Vector3( size.width, size.height, 0.f ) ); + SetSizeInternal(Vector3(size.width, size.height, 0.f)); } -void Actor::SetSize( const Vector3& size ) +void Actor::SetSize(const Vector3& size) { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) + if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout) { // TODO we cannot just ignore the given Z but that means rewrite the size negotiation!! - SetPreferredSize( size.GetVectorXY() ); + SetPreferredSize(size.GetVectorXY()); } else { - SetSizeInternal( size ); + SetSizeInternal(size); } } -void Actor::SetSizeInternal( const Vector3& size ) +void Actor::SetSizeInternal(const Vector3& size) { // dont allow recursive loop - DALI_ASSERT_ALWAYS( !mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet" ); + DALI_ASSERT_ALWAYS(!mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet"); // check that we have a node AND the new size width, height or depth is at least a little bit different from the old one - if( ( fabsf( mTargetSize.width - size.width ) > Math::MACHINE_EPSILON_1 )|| - ( fabsf( mTargetSize.height- size.height ) > Math::MACHINE_EPSILON_1 )|| - ( fabsf( mTargetSize.depth - size.depth ) > Math::MACHINE_EPSILON_1 ) ) + if((fabsf(mTargetSize.width - size.width) > Math::MACHINE_EPSILON_1) || + (fabsf(mTargetSize.height - size.height) > Math::MACHINE_EPSILON_1) || + (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1)) { mTargetSize = size; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::Bake, mTargetSize ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::Bake, mTargetSize); // Notification for derived classes mInsideOnSizeSet = true; - OnSizeSet( mTargetSize ); + OnSizeSet(mTargetSize); mInsideOnSizeSet = false; // Raise a relayout request if the flag is not locked - if( mRelayoutData && !mRelayoutData->insideRelayout ) + if(mRelayoutData && !mRelayoutData->insideRelayout) { RelayoutRequest(); } } } -void Actor::SetWidth( float width ) +void Actor::SetWidth(float width) { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) + if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout) { - SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); + SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH); mRelayoutData->preferredSize.width = width; } else @@ -994,7 +991,7 @@ void Actor::SetWidth( float width ) mTargetSize.width = width; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeX, width ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeX, width); } mUseAnimatedSize &= ~AnimatedSizeFlag::WIDTH; @@ -1002,11 +999,11 @@ void Actor::SetWidth( float width ) RelayoutRequest(); } -void Actor::SetHeight( float height ) +void Actor::SetHeight(float height) { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) + if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout) { - SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); + SetResizePolicy(ResizePolicy::FIXED, Dimension::HEIGHT); mRelayoutData->preferredSize.height = height; } else @@ -1014,7 +1011,7 @@ void Actor::SetHeight( float height ) mTargetSize.height = height; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeY, height ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeY, height); } mUseAnimatedSize &= ~AnimatedSizeFlag::HEIGHT; @@ -1022,21 +1019,21 @@ void Actor::SetHeight( float height ) RelayoutRequest(); } -void Actor::SetDepth( float depth ) +void Actor::SetDepth(float depth) { mTargetSize.depth = depth; mUseAnimatedSize &= ~AnimatedSizeFlag::DEPTH; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeZ, depth ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeZ, depth); } Vector3 Actor::GetTargetSize() const { Vector3 size = mTargetSize; - if( mUseAnimatedSize & AnimatedSizeFlag::WIDTH ) + if(mUseAnimatedSize & AnimatedSizeFlag::WIDTH) { // Should return animated size if size is animated size.width = mAnimatedSize.width; @@ -1044,25 +1041,25 @@ Vector3 Actor::GetTargetSize() const else { // Should return preferred size if size is fixed as set by SetSize - if( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED ) + if(GetResizePolicy(Dimension::WIDTH) == ResizePolicy::FIXED) { size.width = GetPreferredSize().width; } } - if( mUseAnimatedSize & AnimatedSizeFlag::HEIGHT ) + if(mUseAnimatedSize & AnimatedSizeFlag::HEIGHT) { size.height = mAnimatedSize.height; } else { - if( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED ) + if(GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::FIXED) { size.height = GetPreferredSize().height; } } - if( mUseAnimatedSize & AnimatedSizeFlag::DEPTH ) + if(mUseAnimatedSize & AnimatedSizeFlag::DEPTH) { size.depth = mAnimatedSize.depth; } @@ -1073,28 +1070,28 @@ Vector3 Actor::GetTargetSize() const const Vector3& Actor::GetCurrentSize() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetSize( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetSize(GetEventThreadServices().GetEventBufferIndex()); } Vector3 Actor::GetNaturalSize() const { // It is up to deriving classes to return the appropriate natural size - return Vector3( 0.0f, 0.0f, 0.0f ); + return Vector3(0.0f, 0.0f, 0.0f); } -void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) +void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) { EnsureRelayouter().SetResizePolicy(policy, dimension, mTargetSize); - OnSetResizePolicy( policy, dimension ); + OnSetResizePolicy(policy, dimension); // Trigger relayout on this control RelayoutRequest(); } -ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const +ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->GetResizePolicy(dimension); } @@ -1102,7 +1099,7 @@ ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const return ResizePolicy::DEFAULT; } -void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy ) +void Actor::SetSizeScalePolicy(SizeScalePolicy::Type policy) { EnsureRelayouter(); @@ -1114,7 +1111,7 @@ void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy ) SizeScalePolicy::Type Actor::GetSizeScalePolicy() const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->sizeSetPolicy; } @@ -1122,30 +1119,30 @@ SizeScalePolicy::Type Actor::GetSizeScalePolicy() const return Relayouter::DEFAULT_SIZE_SCALE_POLICY; } -void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency ) +void Actor::SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency) { EnsureRelayouter().SetDimensionDependency(dimension, dependency); } -Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const +Dimension::Type Actor::GetDimensionDependency(Dimension::Type dimension) const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->GetDimensionDependency(dimension); } - return Dimension::ALL_DIMENSIONS; // Default + return Dimension::ALL_DIMENSIONS; // Default } -void Actor::SetRelayoutEnabled( bool relayoutEnabled ) +void Actor::SetRelayoutEnabled(bool relayoutEnabled) { // If relayout data has not been allocated yet and the client is requesting // to disable it, do nothing - if( mRelayoutData || relayoutEnabled ) + if(mRelayoutData || relayoutEnabled) { EnsureRelayouter(); - DALI_ASSERT_DEBUG( mRelayoutData && "mRelayoutData not created" ); + DALI_ASSERT_DEBUG(mRelayoutData && "mRelayoutData not created"); mRelayoutData->relayoutEnabled = relayoutEnabled; } @@ -1158,113 +1155,113 @@ bool Actor::IsRelayoutEnabled() const return mRelayoutData && mRelayoutData->relayoutEnabled; } -void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension ) +void Actor::SetLayoutDirty(bool dirty, Dimension::Type dimension) { EnsureRelayouter().SetLayoutDirty(dirty, dimension); } -bool Actor::IsLayoutDirty( Dimension::Type dimension ) const +bool Actor::IsLayoutDirty(Dimension::Type dimension) const { return mRelayoutData && mRelayoutData->IsLayoutDirty(dimension); } -bool Actor::RelayoutPossible( Dimension::Type dimension ) const +bool Actor::RelayoutPossible(Dimension::Type dimension) const { - return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension ); + return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty(dimension); } -bool Actor::RelayoutRequired( Dimension::Type dimension ) const +bool Actor::RelayoutRequired(Dimension::Type dimension) const { - return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension ); + return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty(dimension); } -uint32_t Actor::AddRenderer( Renderer& renderer ) +uint32_t Actor::AddRenderer(Renderer& renderer) { - if( !mRenderers ) + if(!mRenderers) { mRenderers = new RendererContainer; } - uint32_t index = static_cast( mRenderers->size() ); // 4,294,967,295 renderers per actor - RendererPtr rendererPtr = RendererPtr( &renderer ); - mRenderers->push_back( rendererPtr ); - AttachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() ); + uint32_t index = static_cast(mRenderers->size()); // 4,294,967,295 renderers per actor + RendererPtr rendererPtr = RendererPtr(&renderer); + mRenderers->push_back(rendererPtr); + AttachRendererMessage(GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject()); return index; } uint32_t Actor::GetRendererCount() const { uint32_t rendererCount(0); - if( mRenderers ) + if(mRenderers) { - rendererCount = static_cast( mRenderers->size() ); // 4,294,967,295 renderers per actor + rendererCount = static_cast(mRenderers->size()); // 4,294,967,295 renderers per actor } return rendererCount; } -RendererPtr Actor::GetRendererAt( uint32_t index ) +RendererPtr Actor::GetRendererAt(uint32_t index) { RendererPtr renderer; - if( index < GetRendererCount() ) + if(index < GetRendererCount()) { - renderer = ( *mRenderers )[ index ]; + renderer = (*mRenderers)[index]; } return renderer; } -void Actor::RemoveRenderer( Renderer& renderer ) +void Actor::RemoveRenderer(Renderer& renderer) { - if( mRenderers ) + if(mRenderers) { RendererIter end = mRenderers->end(); - for( RendererIter iter = mRenderers->begin(); iter != end; ++iter ) + for(RendererIter iter = mRenderers->begin(); iter != end; ++iter) { - if( (*iter).Get() == &renderer ) + if((*iter).Get() == &renderer) { - mRenderers->erase( iter ); - DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() ); + mRenderers->erase(iter); + DetachRendererMessage(GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject()); break; } } } } -void Actor::RemoveRenderer( uint32_t index ) +void Actor::RemoveRenderer(uint32_t index) { - if( index < GetRendererCount() ) + if(index < GetRendererCount()) { - RendererPtr renderer = ( *mRenderers )[ index ]; - DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject() ); - mRenderers->erase( mRenderers->begin()+index ); + RendererPtr renderer = (*mRenderers)[index]; + DetachRendererMessage(GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject()); + mRenderers->erase(mRenderers->begin() + index); } } -void Actor::SetDrawMode( DrawMode::Type drawMode ) +void Actor::SetDrawMode(DrawMode::Type drawMode) { // this flag is not animatable so keep the value mDrawMode = drawMode; // node is being used in a separate thread; queue a message to set the value - SetDrawModeMessage( GetEventThreadServices(), GetNode(), drawMode ); + SetDrawModeMessage(GetEventThreadServices(), GetNode(), drawMode); } -bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const { // only valid when on-stage - if( mScene && OnScene() ) + if(mScene && OnScene()) { const RenderTaskList& taskList = mScene->GetRenderTaskList(); - Vector2 converted( screenX, screenY ); + Vector2 converted(screenX, screenY); // do a reverse traversal of all lists (as the default onscreen one is typically the last one) uint32_t taskCount = taskList.GetTaskCount(); - for( uint32_t i = taskCount; i > 0; --i ) + for(uint32_t i = taskCount; i > 0; --i) { - RenderTaskPtr task = taskList.GetTask( i - 1 ); - if( ScreenToLocal( *task, localX, localY, screenX, screenY ) ) + RenderTaskPtr task = taskList.GetTask(i - 1); + if(ScreenToLocal(*task, localX, localY, screenX, screenY)) { // found a task where this conversion was ok so return return true; @@ -1274,30 +1271,30 @@ bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float sc return false; } -bool Actor::ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const { bool retval = false; // only valid when on-stage - if( OnScene() ) + if(OnScene()) { CameraActor* camera = renderTask.GetCameraActor(); - if( camera ) + if(camera) { Viewport viewport; - renderTask.GetViewport( viewport ); + renderTask.GetViewport(viewport); // need to translate coordinates to render tasks coordinate space - Vector2 converted( screenX, screenY ); - if( renderTask.TranslateCoordinates( converted ) ) + Vector2 converted(screenX, screenY); + if(renderTask.TranslateCoordinates(converted)) { - retval = ScreenToLocal( camera->GetViewMatrix(), camera->GetProjectionMatrix(), viewport, localX, localY, converted.x, converted.y ); + retval = ScreenToLocal(camera->GetViewMatrix(), camera->GetProjectionMatrix(), viewport, localX, localY, converted.x, converted.y); } } } return retval; } -bool Actor::ScreenToLocal( const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY) const { return OnScene() && ScreenToLocalInternal(viewMatrix, projectionMatrix, GetNode().GetWorldMatrix(0), viewport, GetCurrentSize(), localX, localY, screenX, screenY); } @@ -1306,102 +1303,102 @@ ActorGestureData& Actor::GetGestureData() { // Likely scenario is that once gesture-data is created for this actor, the actor will require // that gesture for its entire life-time so no need to destroy it until the actor is destroyed - if( nullptr == mGestureData ) + if(nullptr == mGestureData) { mGestureData = new ActorGestureData; } return *mGestureData; } -bool Actor::IsGestureRequired( GestureType::Value type ) const +bool Actor::IsGestureRequired(GestureType::Value type) const { - return mGestureData && mGestureData->IsGestureRequired( type ); + return mGestureData && mGestureData->IsGestureRequired(type); } -bool Actor::EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch ) +bool Actor::EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch) { - return EmitConsumingSignal( *this, mInterceptTouchedSignal, touch ); + return EmitConsumingSignal(*this, mInterceptTouchedSignal, touch); } -bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch ) +bool Actor::EmitTouchEventSignal(const Dali::TouchEvent& touch) { - return EmitConsumingSignal( *this, mTouchedSignal, touch ); + return EmitConsumingSignal(*this, mTouchedSignal, touch); } -bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event ) +bool Actor::EmitHoverEventSignal(const Dali::HoverEvent& event) { - return EmitConsumingSignal( *this, mHoveredSignal, event ); + return EmitConsumingSignal(*this, mHoveredSignal, event); } -bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event ) +bool Actor::EmitWheelEventSignal(const Dali::WheelEvent& event) { - return EmitConsumingSignal( *this, mWheelEventSignal, event ); + return EmitConsumingSignal(*this, mWheelEventSignal, event); } -void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type ) +void Actor::EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type) { - EmitSignal( *this, mVisibilityChangedSignal, visible, type ); + EmitSignal(*this, mVisibilityChangedSignal, visible, type); } -void Actor::EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ) +void Actor::EmitLayoutDirectionChangedSignal(LayoutDirection::Type type) { - EmitSignal( *this, mLayoutDirectionChangedSignal, type ); + EmitSignal(*this, mLayoutDirectionChangedSignal, type); } -void Actor::EmitChildAddedSignal( Actor& child ) +void Actor::EmitChildAddedSignal(Actor& child) { - EmitSignal( child, mChildAddedSignal ); + EmitSignal(child, mChildAddedSignal); } -void Actor::EmitChildRemovedSignal( Actor& child ) +void Actor::EmitChildRemovedSignal(Actor& child) { - EmitSignal( child, mChildRemovedSignal ); + EmitSignal(child, mChildRemovedSignal); } -bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +bool Actor::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor) { - bool connected( true ); - Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type. + bool connected(true); + Actor* actor = static_cast(object); // TypeRegistry guarantees that this is the correct type. - if( 0 == signalName.compare( SIGNAL_HOVERED ) ) + if(0 == signalName.compare(SIGNAL_HOVERED)) { - actor->HoveredSignal().Connect( tracker, functor ); + actor->HoveredSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) ) + else if(0 == signalName.compare(SIGNAL_WHEEL_EVENT)) { - actor->WheelEventSignal().Connect( tracker, functor ); + actor->WheelEventSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_ON_SCENE ) ) + else if(0 == signalName.compare(SIGNAL_ON_SCENE)) { - actor->OnSceneSignal().Connect( tracker, functor ); + actor->OnSceneSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_OFF_SCENE ) ) + else if(0 == signalName.compare(SIGNAL_OFF_SCENE)) { - actor->OffSceneSignal().Connect( tracker, functor ); + actor->OffSceneSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_ON_RELAYOUT ) ) + else if(0 == signalName.compare(SIGNAL_ON_RELAYOUT)) { - actor->OnRelayoutSignal().Connect( tracker, functor ); + actor->OnRelayoutSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_TOUCHED ) ) + else if(0 == signalName.compare(SIGNAL_TOUCHED)) { - actor->TouchedSignal().Connect( tracker, functor ); + actor->TouchedSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) ) + else if(0 == signalName.compare(SIGNAL_VISIBILITY_CHANGED)) { - actor->VisibilityChangedSignal().Connect( tracker, functor ); + actor->VisibilityChangedSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_LAYOUT_DIRECTION_CHANGED ) ) + else if(0 == signalName.compare(SIGNAL_LAYOUT_DIRECTION_CHANGED)) { - actor->LayoutDirectionChangedSignal().Connect( tracker, functor ); + actor->LayoutDirectionChangedSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_CHILD_ADDED ) ) + else if(0 == signalName.compare(SIGNAL_CHILD_ADDED)) { - actor->ChildAddedSignal().Connect( tracker, functor ); + actor->ChildAddedSignal().Connect(tracker, functor); } - else if( 0 == signalName.compare( SIGNAL_CHILD_REMOVED ) ) + else if(0 == signalName.compare(SIGNAL_CHILD_REMOVED)) { - actor->ChildRemovedSignal().Connect( tracker, functor ); + actor->ChildRemovedSignal().Connect(tracker, functor); } else { @@ -1412,16 +1409,16 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra return connected; } -Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node ) -: Object( &node ), - mScene( nullptr ), - mParent( nullptr ), - mChildren( nullptr ), - mRenderers( nullptr ), - mParentOrigin( nullptr ), - mAnchorPoint( nullptr ), - mRelayoutData( nullptr ), - mGestureData( nullptr ), +Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node) +: Object(&node), + mScene(nullptr), + mParent(nullptr), + mChildren(nullptr), + mRenderers(nullptr), + mParentOrigin(nullptr), + mAnchorPoint(nullptr), + mRelayoutData(nullptr), + mGestureData(nullptr), mInterceptTouchedSignal(), mTouchedSignal(), mHoveredSignal(), @@ -1434,36 +1431,36 @@ Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node ) mChildAddedSignal(), mChildRemovedSignal(), mChildOrderChangedSignal(), - mTargetOrientation( Quaternion::IDENTITY ), - mTargetColor( Color::WHITE ), - mTargetSize( Vector3::ZERO ), - mTargetPosition( Vector3::ZERO ), - mTargetScale( Vector3::ONE ), - mAnimatedSize( Vector3::ZERO ), - mTouchArea( Vector2::ZERO ), + mTargetOrientation(Quaternion::IDENTITY), + mTargetColor(Color::WHITE), + mTargetSize(Vector3::ZERO), + mTargetPosition(Vector3::ZERO), + mTargetScale(Vector3::ONE), + mAnimatedSize(Vector3::ZERO), + mTouchAreaOffset(0, 0, 0, 0), mName(), - mSortedDepth( 0u ), - mDepth( 0u ), - mUseAnimatedSize( AnimatedSizeFlag::CLEAR ), - mIsRoot( ROOT_LAYER == derivedType ), - mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ), - mIsOnScene( false ), - mSensitive( true ), - mLeaveRequired( false ), - mKeyboardFocusable( false ), - mOnSceneSignalled( false ), - mInsideOnSizeSet( false ), - mInheritPosition( true ), - mInheritOrientation( true ), - mInheritScale( true ), - mPositionUsesAnchorPoint( true ), - mVisible( true ), - mInheritLayoutDirection( true ), - mCaptureAllTouchAfterStart( false ), - mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ), - mDrawMode( DrawMode::NORMAL ), - mColorMode( Node::DEFAULT_COLOR_MODE ), - mClippingMode( ClippingMode::DISABLED ) + mSortedDepth(0u), + mDepth(0u), + mUseAnimatedSize(AnimatedSizeFlag::CLEAR), + mIsRoot(ROOT_LAYER == derivedType), + mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType), + mIsOnScene(false), + mSensitive(true), + mLeaveRequired(false), + mKeyboardFocusable(false), + mOnSceneSignalled(false), + mInsideOnSizeSet(false), + mInheritPosition(true), + mInheritOrientation(true), + mInheritScale(true), + mPositionUsesAnchorPoint(true), + mVisible(true), + mInheritLayoutDirection(true), + mCaptureAllTouchAfterStart(false), + mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT), + mDrawMode(DrawMode::NORMAL), + mColorMode(Node::DEFAULT_COLOR_MODE), + mClippingMode(ClippingMode::DISABLED) { } @@ -1471,32 +1468,32 @@ void Actor::Initialize() { OnInitialize(); - GetEventThreadServices().RegisterObject( this ); + GetEventThreadServices().RegisterObject(this); } Actor::~Actor() { // Remove mParent pointers from children even if we're destroying core, // to guard against GetParent() & Unparent() calls from CustomActor destructors. - if( mChildren ) + if(mChildren) { - for( const auto& actor : *mChildren ) + for(const auto& actor : *mChildren) { - actor->SetParent( nullptr ); + actor->SetParent(nullptr); } } delete mChildren; delete mRenderers; // Guard to allow handle destruction after Core has been destroyed - if( EventThreadServices::IsCoreRunning() ) + if(EventThreadServices::IsCoreRunning()) { // Root layer will destroy its node in its own destructor - if ( !mIsRoot ) + if(!mIsRoot) { - DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() ); + DestroyNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode()); - GetEventThreadServices().UnregisterObject( this ); + GetEventThreadServices().UnregisterObject(this); } } @@ -1511,22 +1508,22 @@ Actor::~Actor() delete mRelayoutData; } -void Actor::ConnectToScene( uint32_t parentDepth ) +void Actor::ConnectToScene(uint32_t parentDepth) { // This container is used instead of walking the Actor hierarchy. // It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks. ActorContainer connectionList; - if( mScene ) + if(mScene) { mScene->RequestRebuildDepthTree(); } // This stage is atomic i.e. not interrupted by user callbacks. - RecursiveConnectToScene( connectionList, parentDepth + 1 ); + RecursiveConnectToScene(connectionList, parentDepth + 1); // Notify applications about the newly connected actors. - for( const auto& actor : connectionList ) + for(const auto& actor : connectionList) { actor->NotifyStageConnection(); } @@ -1534,12 +1531,12 @@ void Actor::ConnectToScene( uint32_t parentDepth ) RelayoutRequest(); } -void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth ) +void Actor::RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth) { - DALI_ASSERT_ALWAYS( !OnScene() ); + DALI_ASSERT_ALWAYS(!OnScene()); mIsOnScene = true; - mDepth = static_cast< uint16_t >( depth ); // overflow ignored, not expected in practice + mDepth = static_cast(depth); // overflow ignored, not expected in practice ConnectToSceneGraph(); @@ -1547,15 +1544,15 @@ void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t de OnSceneConnectionInternal(); // This stage is atomic; avoid emitting callbacks until all Actors are connected - connectionList.push_back( ActorPtr( this ) ); + connectionList.push_back(ActorPtr(this)); // Recursively connect children - if( mChildren ) + if(mChildren) { - for( const auto& actor : *mChildren ) + for(const auto& actor : *mChildren) { - actor->SetScene( *mScene ); - actor->RecursiveConnectToScene( connectionList, depth + 1 ); + actor->SetScene(*mScene); + actor->RecursiveConnectToScene(connectionList, depth + 1); } } } @@ -1568,10 +1565,10 @@ void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t de */ void Actor::ConnectToSceneGraph() { - DALI_ASSERT_DEBUG( mParent != NULL); + DALI_ASSERT_DEBUG(mParent != NULL); // Reparent Node in next Update - ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mParent->GetNode(), GetNode() ); + ConnectNodeMessage(GetEventThreadServices().GetUpdateManager(), mParent->GetNode(), GetNode()); // Request relayout on all actors that are added to the scenegraph RelayoutRequest(); @@ -1584,19 +1581,19 @@ void Actor::NotifyStageConnection() { // Actors can be removed (in a callback), before the on-stage stage is reported. // The actor may also have been reparented, in which case mOnSceneSignalled will be true. - if( OnScene() && !mOnSceneSignalled ) + if(OnScene() && !mOnSceneSignalled) { // Notification for external (CustomActor) derived classes - OnSceneConnectionExternal( mDepth ); + OnSceneConnectionExternal(mDepth); - if( !mOnSceneSignal.Empty() ) + if(!mOnSceneSignal.Empty()) { - Dali::Actor handle( this ); - mOnSceneSignal.Emit( handle ); + Dali::Actor handle(this); + mOnSceneSignal.Emit(handle); } // Guard against Remove during callbacks - if( OnScene() ) + if(OnScene()) { mOnSceneSignalled = true; // signal required next time Actor is removed } @@ -1609,37 +1606,37 @@ void Actor::DisconnectFromStage() // It protects us when the Actor hierachy is modified during OnSceneDisconnectionExternal callbacks. ActorContainer disconnectionList; - if( mScene ) + if(mScene) { mScene->RequestRebuildDepthTree(); } // This stage is atomic i.e. not interrupted by user callbacks - RecursiveDisconnectFromStage( disconnectionList ); + RecursiveDisconnectFromStage(disconnectionList); // Notify applications about the newly disconnected actors. - for( const auto& actor : disconnectionList ) + for(const auto& actor : disconnectionList) { actor->NotifyStageDisconnection(); } } -void Actor::RecursiveDisconnectFromStage( ActorContainer& disconnectionList ) +void Actor::RecursiveDisconnectFromStage(ActorContainer& disconnectionList) { // need to change state first so that internals relying on IsOnScene() inside OnSceneDisconnectionInternal() get the correct value mIsOnScene = false; // Recursively disconnect children - if( mChildren ) + if(mChildren) { - for( const auto& child : *mChildren ) + for(const auto& child : *mChildren) { - child->RecursiveDisconnectFromStage( disconnectionList ); + child->RecursiveDisconnectFromStage(disconnectionList); } } // This stage is atomic; avoid emitting callbacks until all Actors are disconnected - disconnectionList.push_back( ActorPtr( this ) ); + disconnectionList.push_back(ActorPtr(this)); // Notification for internal derived classes OnSceneDisconnectionInternal(); @@ -1662,19 +1659,19 @@ void Actor::NotifyStageDisconnection() // Actors can be added (in a callback), before the off-stage state is reported. // Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here. // only do this step if there is a stage, i.e. Core is not being shut down - if ( EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled ) + if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled) { // Notification for external (CustomeActor) derived classes OnSceneDisconnectionExternal(); - if( !mOffSceneSignal.Empty() ) + if(!mOffSceneSignal.Empty()) { - Dali::Actor handle( this ); - mOffSceneSignal.Emit( handle ); + Dali::Actor handle(this); + mOffSceneSignal.Emit(handle); } // Guard against Add during callbacks - if( !OnScene() ) + if(!OnScene()) { mOnSceneSignalled = false; // signal required next time Actor is added } @@ -1683,11 +1680,11 @@ void Actor::NotifyStageDisconnection() bool Actor::IsNodeConnected() const { - bool connected( false ); + bool connected(false); - if( OnScene() ) + if(OnScene()) { - if( IsRoot() || GetNode().GetParent() ) + if(IsRoot() || GetNode().GetParent()) { connected = true; } @@ -1708,126 +1705,126 @@ void Actor::RebuildDepthTree() // Vector of scene-graph nodes and their depths to send to UpdateManager // in a single message - OwnerPointer sceneGraphNodeDepths( new SceneGraph::NodeDepths() ); + OwnerPointer sceneGraphNodeDepths(new SceneGraph::NodeDepths()); int32_t depthIndex = 1; - DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex ); + DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex); - SetDepthIndicesMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths ); + SetDepthIndicesMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths); DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: "); } -void Actor::DepthTraverseActorTree( OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex ) +void Actor::DepthTraverseActorTree(OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex) { mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER; - sceneGraphNodeDepths->Add( const_cast( &GetNode() ), mSortedDepth ); + sceneGraphNodeDepths->Add(const_cast(&GetNode()), mSortedDepth); // Create/add to children of this node - if( mChildren ) + if(mChildren) { - for( const auto& child : *mChildren ) + for(const auto& child : *mChildren) { Actor* childActor = child.Get(); ++depthIndex; - childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex ); + childActor->DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex); } } } -void Actor::SetDefaultProperty( Property::Index index, const Property::Value& property ) +void Actor::SetDefaultProperty(Property::Index index, const Property::Value& property) { PropertyHandler::SetDefaultProperty(*this, index, property); } // TODO: This method needs to be removed -void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ) +void Actor::SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) { PropertyHandler::SetSceneGraphProperty(index, entry, value, GetEventThreadServices(), GetNode()); } -Property::Value Actor::GetDefaultProperty( Property::Index index ) const +Property::Value Actor::GetDefaultProperty(Property::Index index) const { Property::Value value; - if( ! GetCachedPropertyValue( index, value ) ) + if(!GetCachedPropertyValue(index, value)) { // If property value is not stored in the event-side, then it must be a scene-graph only property - GetCurrentPropertyValue( index, value ); + GetCurrentPropertyValue(index, value); } return value; } -Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) const +Property::Value Actor::GetDefaultPropertyCurrentValue(Property::Index index) const { Property::Value value; - if( ! GetCurrentPropertyValue( index, value ) ) + if(!GetCurrentPropertyValue(index, value)) { // If unable to retrieve scene-graph property value, then it must be an event-side only property - GetCachedPropertyValue( index, value ); + GetCachedPropertyValue(index, value); } return value; } -void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ) +void Actor::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) { PropertyHandler::OnNotifyDefaultPropertyAnimation(*this, animation, index, value, animationType); } -const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const +const PropertyBase* Actor::GetSceneObjectAnimatableProperty(Property::Index index) const { const PropertyBase* property = PropertyHandler::GetSceneObjectAnimatableProperty(index, GetNode()); - if( !property ) + if(!property) { // not our property, ask base - property = Object::GetSceneObjectAnimatableProperty( index ); + property = Object::GetSceneObjectAnimatableProperty(index); } return property; } -const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index index ) const +const PropertyInputImpl* Actor::GetSceneObjectInputProperty(Property::Index index) const { const PropertyInputImpl* property = PropertyHandler::GetSceneObjectInputProperty(index, GetNode()); - if( !property ) + if(!property) { // reuse animatable property getter as animatable properties are inputs as well // animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered - property = GetSceneObjectAnimatableProperty( index ); + property = GetSceneObjectAnimatableProperty(index); } return property; } -int32_t Actor::GetPropertyComponentIndex( Property::Index index ) const +int32_t Actor::GetPropertyComponentIndex(Property::Index index) const { int32_t componentIndex = PropertyHandler::GetPropertyComponentIndex(index); - if( Property::INVALID_COMPONENT_INDEX == componentIndex ) + if(Property::INVALID_COMPONENT_INDEX == componentIndex) { // ask base - componentIndex = Object::GetPropertyComponentIndex( index ); + componentIndex = Object::GetPropertyComponentIndex(index); } return componentIndex; } -void Actor::SetParent( Actor* parent ) +void Actor::SetParent(Actor* parent) { - if( parent ) + if(parent) { - DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" ); + DALI_ASSERT_ALWAYS(!mParent && "Actor cannot have 2 parents"); mParent = parent; mScene = parent->mScene; - if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction - parent->OnScene() ) + if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction + parent->OnScene()) { // Instruct each actor to create a corresponding node in the scene graph - ConnectToScene( parent->GetHierarchyDepth() ); + ConnectToScene(parent->GetHierarchyDepth()); } // Resolve the name and index for the child properties if any @@ -1835,15 +1832,15 @@ void Actor::SetParent( Actor* parent ) } else // parent being set to NULL { - DALI_ASSERT_ALWAYS( mParent != nullptr && "Actor should have a parent" ); + DALI_ASSERT_ALWAYS(mParent != nullptr && "Actor should have a parent"); mParent = nullptr; - if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction - OnScene() ) + if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction + OnScene()) { // Disconnect the Node & its children from the scene-graph. - DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() ); + DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode()); // Instruct each actor to discard pointers to the scene-graph DisconnectFromStage(); @@ -1853,21 +1850,21 @@ void Actor::SetParent( Actor* parent ) } } -bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ ) +bool Actor::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */) { - bool done = false; - Actor* actor = dynamic_cast< Actor* >( object ); + bool done = false; + Actor* actor = dynamic_cast(object); - if( actor ) + if(actor) { - if( 0 == actionName.compare( ACTION_SHOW ) ) + if(0 == actionName.compare(ACTION_SHOW)) { - actor->SetVisible( true ); + actor->SetVisible(true); done = true; } - else if( 0 == actionName.compare( ACTION_HIDE ) ) + else if(0 == actionName.compare(ACTION_HIDE)) { - actor->SetVisible( false ); + actor->SetVisible(false); done = true; } } @@ -1875,21 +1872,21 @@ bool Actor::DoAction( BaseObject* object, const std::string& actionName, const P return done; } -Rect<> Actor::CalculateScreenExtents( ) const +Rect<> Actor::CalculateScreenExtents() const { - auto screenPosition = GetCurrentScreenPosition(); - Vector3 size = GetCurrentSize() * GetCurrentWorldScale(); - Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); - Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y ); - return { position.x, position.y, size.x, size.y }; + auto screenPosition = GetCurrentScreenPosition(); + Vector3 size = GetCurrentSize() * GetCurrentWorldScale(); + Vector3 anchorPointOffSet = size * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT); + Vector2 position = Vector2(screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y); + return {position.x, position.y, size.x, size.y}; } -bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const +bool Actor::GetCachedPropertyValue(Property::Index index, Property::Value& value) const { return PropertyHandler::GetCachedPropertyValue(*this, index, value); } -bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const +bool Actor::GetCurrentPropertyValue(Property::Index index, Property::Value& value) const { return PropertyHandler::GetCurrentPropertyValue(*this, index, value); } @@ -1897,7 +1894,7 @@ bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& val Actor::Relayouter& Actor::EnsureRelayouter() { // Assign relayouter - if( !mRelayoutData ) + if(!mRelayoutData) { mRelayoutData = new Relayouter(); } @@ -1905,15 +1902,15 @@ Actor::Relayouter& Actor::EnsureRelayouter() return *mRelayoutData; } -bool Actor::RelayoutDependentOnParent( Dimension::Type dimension ) +bool Actor::RelayoutDependentOnParent(Dimension::Type dimension) { // Check if actor is dependent on parent - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( ( dimension & ( 1 << i ) ) ) + if((dimension & (1 << i))) { - const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ); - if( resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT ) + const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast(1 << i)); + if(resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT) { return true; } @@ -1923,18 +1920,18 @@ bool Actor::RelayoutDependentOnParent( Dimension::Type dimension ) return false; } -bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension ) +bool Actor::RelayoutDependentOnChildren(Dimension::Type dimension) { // Check if actor is dependent on children - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( ( dimension & ( 1 << i ) ) ) + if((dimension & (1 << i))) { - const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ); - switch( resizePolicy ) + const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast(1 << i)); + switch(resizePolicy) { case ResizePolicy::FIT_TO_CHILDREN: - case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children + case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children { return true; } @@ -1950,65 +1947,65 @@ bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension ) return false; } -bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension ) +bool Actor::RelayoutDependentOnChildrenBase(Dimension::Type dimension) { - return Actor::RelayoutDependentOnChildren( dimension ); + return Actor::RelayoutDependentOnChildren(dimension); } -bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension ) +bool Actor::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension) { // Check each possible dimension and see if it is dependent on the input one - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( dimension & ( 1 << i ) ) + if(dimension & (1 << i)) { - return mRelayoutData->resizePolicies[ i ] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension; + return mRelayoutData->resizePolicies[i] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[i] == dependentDimension; } } return false; } -void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension ) +void Actor::SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension) { - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( dimension & ( 1 << i ) ) + if(dimension & (1 << i)) { - mRelayoutData->negotiatedDimensions[ i ] = negotiatedDimension; + mRelayoutData->negotiatedDimensions[i] = negotiatedDimension; } } } -float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const +float Actor::GetNegotiatedDimension(Dimension::Type dimension) const { // If more than one dimension is requested, just return the first one found - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( ( dimension & ( 1 << i ) ) ) + if((dimension & (1 << i))) { - return mRelayoutData->negotiatedDimensions[ i ]; + return mRelayoutData->negotiatedDimensions[i]; } } - return 0.0f; // Default + return 0.0f; // Default } -void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension ) +void Actor::SetPadding(const Vector2& padding, Dimension::Type dimension) { - EnsureRelayouter().SetPadding( padding, dimension ); + EnsureRelayouter().SetPadding(padding, dimension); } -Vector2 Actor::GetPadding( Dimension::Type dimension ) const +Vector2 Actor::GetPadding(Dimension::Type dimension) const { - if ( mRelayoutData ) + if(mRelayoutData) { // If more than one dimension is requested, just return the first one found - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - if( ( dimension & ( 1 << i ) ) ) + if((dimension & (1 << i))) { - return mRelayoutData->dimensionPadding[ i ]; + return mRelayoutData->dimensionPadding[i]; } } } @@ -2016,22 +2013,22 @@ Vector2 Actor::GetPadding( Dimension::Type dimension ) const return Relayouter::DEFAULT_DIMENSION_PADDING; } -void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension ) +void Actor::SetLayoutNegotiated(bool negotiated, Dimension::Type dimension) { EnsureRelayouter().SetLayoutNegotiated(negotiated, dimension); } -bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const +bool Actor::IsLayoutNegotiated(Dimension::Type dimension) const { return mRelayoutData && mRelayoutData->IsLayoutNegotiated(dimension); } -float Actor::GetHeightForWidthBase( float width ) +float Actor::GetHeightForWidthBase(float width) { float height = 0.0f; const Vector3 naturalSize = GetNaturalSize(); - if( naturalSize.width > 0.0f ) + if(naturalSize.width > 0.0f) { height = naturalSize.height * width / naturalSize.width; } @@ -2043,12 +2040,12 @@ float Actor::GetHeightForWidthBase( float width ) return height; } -float Actor::GetWidthForHeightBase( float height ) +float Actor::GetWidthForHeightBase(float height) { float width = 0.0f; const Vector3 naturalSize = GetNaturalSize(); - if( naturalSize.height > 0.0f ) + if(naturalSize.height > 0.0f) { width = naturalSize.width * height / naturalSize.height; } @@ -2060,150 +2057,150 @@ float Actor::GetWidthForHeightBase( float height ) return width; } -float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) +float Actor::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension) { // Fill to parent, taking size mode factor into account - switch( child.GetResizePolicy( dimension ) ) + switch(child.GetResizePolicy(dimension)) { case ResizePolicy::FILL_TO_PARENT: { - return GetLatestSize( dimension ); + return GetLatestSize(dimension); } case ResizePolicy::SIZE_RELATIVE_TO_PARENT: { - return GetLatestSize( dimension ) * GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension ); + return GetLatestSize(dimension) * GetDimensionValue(child.GetProperty(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension); } case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: { - return GetLatestSize( dimension ) + GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension ); + return GetLatestSize(dimension) + GetDimensionValue(child.GetProperty(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension); } default: { - return GetLatestSize( dimension ); + return GetLatestSize(dimension); } } } -float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) +float Actor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) { // Can be overridden in derived class - return CalculateChildSizeBase( child, dimension ); + return CalculateChildSizeBase(child, dimension); } -float Actor::GetHeightForWidth( float width ) +float Actor::GetHeightForWidth(float width) { // Can be overridden in derived class - return GetHeightForWidthBase( width ); + return GetHeightForWidthBase(width); } -float Actor::GetWidthForHeight( float height ) +float Actor::GetWidthForHeight(float height) { // Can be overridden in derived class - return GetWidthForHeightBase( height ); + return GetWidthForHeightBase(height); } -float Actor::GetLatestSize( Dimension::Type dimension ) const +float Actor::GetLatestSize(Dimension::Type dimension) const { - return IsLayoutNegotiated( dimension ) ? GetNegotiatedDimension( dimension ) : GetSize( dimension ); + return IsLayoutNegotiated(dimension) ? GetNegotiatedDimension(dimension) : GetSize(dimension); } -float Actor::GetRelayoutSize( Dimension::Type dimension ) const +float Actor::GetRelayoutSize(Dimension::Type dimension) const { - Vector2 padding = GetPadding( dimension ); + Vector2 padding = GetPadding(dimension); - return GetLatestSize( dimension ) + padding.x + padding.y; + return GetLatestSize(dimension) + padding.x + padding.y; } -float Actor::NegotiateFromParent( Dimension::Type dimension ) +float Actor::NegotiateFromParent(Dimension::Type dimension) { Actor* parent = GetParent(); - if( parent ) + if(parent) { - Vector2 padding( GetPadding( dimension ) ); - Vector2 parentPadding( parent->GetPadding( dimension ) ); - return parent->CalculateChildSize( Dali::Actor( this ), dimension ) - parentPadding.x - parentPadding.y - padding.x - padding.y; + Vector2 padding(GetPadding(dimension)); + Vector2 parentPadding(parent->GetPadding(dimension)); + return parent->CalculateChildSize(Dali::Actor(this), dimension) - parentPadding.x - parentPadding.y - padding.x - padding.y; } return 0.0f; } -float Actor::NegotiateFromChildren( Dimension::Type dimension ) +float Actor::NegotiateFromChildren(Dimension::Type dimension) { float maxDimensionPoint = 0.0f; - for( uint32_t i = 0, count = GetChildCount(); i < count; ++i ) + for(uint32_t i = 0, count = GetChildCount(); i < count; ++i) { - ActorPtr child = GetChildAt( i ); + ActorPtr child = GetChildAt(i); - if( !child->RelayoutDependentOnParent( dimension ) ) + if(!child->RelayoutDependentOnParent(dimension)) { // Calculate the min and max points that the children range across - float childPosition = GetDimensionValue( child->GetTargetPosition(), dimension ); - float dimensionSize = child->GetRelayoutSize( dimension ); - maxDimensionPoint = std::max( maxDimensionPoint, childPosition + dimensionSize ); + float childPosition = GetDimensionValue(child->GetTargetPosition(), dimension); + float dimensionSize = child->GetRelayoutSize(dimension); + maxDimensionPoint = std::max(maxDimensionPoint, childPosition + dimensionSize); } } return maxDimensionPoint; } -float Actor::GetSize( Dimension::Type dimension ) const +float Actor::GetSize(Dimension::Type dimension) const { - return GetDimensionValue( mTargetSize, dimension ); + return GetDimensionValue(mTargetSize, dimension); } -float Actor::GetNaturalSize( Dimension::Type dimension ) const +float Actor::GetNaturalSize(Dimension::Type dimension) const { - return GetDimensionValue( GetNaturalSize(), dimension ); + return GetDimensionValue(GetNaturalSize(), dimension); } -float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSize ) +float Actor::CalculateSize(Dimension::Type dimension, const Vector2& maximumSize) { - switch( GetResizePolicy( dimension ) ) + switch(GetResizePolicy(dimension)) { case ResizePolicy::USE_NATURAL_SIZE: { - return GetNaturalSize( dimension ); + return GetNaturalSize(dimension); } case ResizePolicy::FIXED: { - return GetDimensionValue( GetPreferredSize(), dimension ); + return GetDimensionValue(GetPreferredSize(), dimension); } case ResizePolicy::USE_ASSIGNED_SIZE: { - return GetDimensionValue( maximumSize, dimension ); + return GetDimensionValue(maximumSize, dimension); } case ResizePolicy::FILL_TO_PARENT: case ResizePolicy::SIZE_RELATIVE_TO_PARENT: case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: { - return NegotiateFromParent( dimension ); + return NegotiateFromParent(dimension); } case ResizePolicy::FIT_TO_CHILDREN: { - return NegotiateFromChildren( dimension ); + return NegotiateFromChildren(dimension); } case ResizePolicy::DIMENSION_DEPENDENCY: { - const Dimension::Type dimensionDependency = GetDimensionDependency( dimension ); + const Dimension::Type dimensionDependency = GetDimensionDependency(dimension); // Custom rules - if( dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT ) + if(dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT) { - return GetWidthForHeight( GetNegotiatedDimension( Dimension::HEIGHT ) ); + return GetWidthForHeight(GetNegotiatedDimension(Dimension::HEIGHT)); } - if( dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH ) + if(dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH) { - return GetHeightForWidth( GetNegotiatedDimension( Dimension::WIDTH ) ); + return GetHeightForWidth(GetNegotiatedDimension(Dimension::WIDTH)); } break; @@ -2215,75 +2212,75 @@ float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSiz } } - return 0.0f; // Default + return 0.0f; // Default } -void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack ) +void Actor::NegotiateDimension(Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack) { // Check if it needs to be negotiated - if( IsLayoutDirty( dimension ) && !IsLayoutNegotiated( dimension ) ) + if(IsLayoutDirty(dimension) && !IsLayoutNegotiated(dimension)) { // Check that we havn't gotten into an infinite loop - ActorDimensionPair searchActor = ActorDimensionPair( this, dimension ); - bool recursionFound = false; - for( auto& element : recursionStack ) + ActorDimensionPair searchActor = ActorDimensionPair(this, dimension); + bool recursionFound = false; + for(auto& element : recursionStack) { - if( element == searchActor ) + if(element == searchActor) { recursionFound = true; break; } } - if( !recursionFound ) + if(!recursionFound) { // Record the path that we have taken - recursionStack.push_back( ActorDimensionPair( this, dimension ) ); + recursionStack.push_back(ActorDimensionPair(this, dimension)); // Dimension dependency check - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i ); + Dimension::Type dimensionToCheck = static_cast(1 << i); - if( RelayoutDependentOnDimension( dimension, dimensionToCheck ) ) + if(RelayoutDependentOnDimension(dimension, dimensionToCheck)) { - NegotiateDimension( dimensionToCheck, allocatedSize, recursionStack ); + NegotiateDimension(dimensionToCheck, allocatedSize, recursionStack); } } // Parent dependency check Actor* parent = GetParent(); - if( parent && RelayoutDependentOnParent( dimension ) ) + if(parent && RelayoutDependentOnParent(dimension)) { - parent->NegotiateDimension( dimension, allocatedSize, recursionStack ); + parent->NegotiateDimension(dimension, allocatedSize, recursionStack); } // Children dependency check - if( RelayoutDependentOnChildren( dimension ) ) + if(RelayoutDependentOnChildren(dimension)) { - for( uint32_t i = 0, count = GetChildCount(); i < count; ++i ) + for(uint32_t i = 0, count = GetChildCount(); i < count; ++i) { - ActorPtr child = GetChildAt( i ); + ActorPtr child = GetChildAt(i); // Only relayout child first if it is not dependent on this actor - if( !child->RelayoutDependentOnParent( dimension ) ) + if(!child->RelayoutDependentOnParent(dimension)) { - child->NegotiateDimension( dimension, allocatedSize, recursionStack ); + child->NegotiateDimension(dimension, allocatedSize, recursionStack); } } } // For deriving classes - OnCalculateRelayoutSize( dimension ); + OnCalculateRelayoutSize(dimension); // All dependencies checked, calculate the size and set negotiated flag - const float newSize = Relayouter::ClampDimension( *this, CalculateSize( dimension, allocatedSize ), dimension ); + const float newSize = Relayouter::ClampDimension(*this, CalculateSize(dimension, allocatedSize), dimension); - SetNegotiatedDimension( newSize, dimension ); - SetLayoutNegotiated( true, dimension ); + SetNegotiatedDimension(newSize, dimension); + SetLayoutNegotiated(true, dimension); // For deriving classes - OnLayoutNegotiated( newSize, dimension ); + OnLayoutNegotiated(newSize, dimension); // This actor has been successfully processed, pop it off the recursion stack recursionStack.pop_back(); @@ -2291,57 +2288,57 @@ void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& alloca else { // TODO: Break infinite loop - SetLayoutNegotiated( true, dimension ); + SetLayoutNegotiated(true, dimension); } } } -void Actor::NegotiateDimensions( const Vector2& allocatedSize ) +void Actor::NegotiateDimensions(const Vector2& allocatedSize) { // Negotiate all dimensions that require it ActorDimensionStack recursionStack; - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - const Dimension::Type dimension = static_cast< Dimension::Type >( 1 << i ); + const Dimension::Type dimension = static_cast(1 << i); // Negotiate - NegotiateDimension( dimension, allocatedSize, recursionStack ); + NegotiateDimension(dimension, allocatedSize, recursionStack); } } -Vector2 Actor::ApplySizeSetPolicy( const Vector2& size ) +Vector2 Actor::ApplySizeSetPolicy(const Vector2& size) { return mRelayoutData->ApplySizeSetPolicy(*this, size); } -void Actor::SetNegotiatedSize( RelayoutContainer& container ) +void Actor::SetNegotiatedSize(RelayoutContainer& container) { // Do the set actor size - Vector2 negotiatedSize( GetLatestSize( Dimension::WIDTH ), GetLatestSize( Dimension::HEIGHT ) ); + Vector2 negotiatedSize(GetLatestSize(Dimension::WIDTH), GetLatestSize(Dimension::HEIGHT)); // Adjust for size set policy - negotiatedSize = ApplySizeSetPolicy( negotiatedSize ); + negotiatedSize = ApplySizeSetPolicy(negotiatedSize); // Lock the flag to stop recursive relayouts on set size mRelayoutData->insideRelayout = true; - SetSize( negotiatedSize ); + SetSize(negotiatedSize); mRelayoutData->insideRelayout = false; // Clear flags for all dimensions - SetLayoutDirty( false ); + SetLayoutDirty(false); // Give deriving classes a chance to respond - OnRelayout( negotiatedSize, container ); + OnRelayout(negotiatedSize, container); - if( !mOnRelayoutSignal.Empty() ) + if(!mOnRelayoutSignal.Empty()) { - Dali::Actor handle( this ); - mOnRelayoutSignal.Emit( handle ); + Dali::Actor handle(this); + mOnRelayoutSignal.Emit(handle); } } -void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& container ) +void Actor::NegotiateSize(const Vector2& allocatedSize, RelayoutContainer& container) { // Force a size negotiation for actors that has assigned size during relayout // This is required as otherwise the flags that force a relayout will not @@ -2350,75 +2347,75 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont // relayout container afterwards, the dirty flags would still be clear... // causing a relayout to be skipped. Here we force any actors added to the // container to be relayed out. - DALI_LOG_TIMER_START( NegSizeTimer1 ); + DALI_LOG_TIMER_START(NegSizeTimer1); - if( GetUseAssignedSize(Dimension::WIDTH ) ) + if(GetUseAssignedSize(Dimension::WIDTH)) { - SetLayoutNegotiated( false, Dimension::WIDTH ); + SetLayoutNegotiated(false, Dimension::WIDTH); } - if( GetUseAssignedSize( Dimension::HEIGHT ) ) + if(GetUseAssignedSize(Dimension::HEIGHT)) { - SetLayoutNegotiated( false, Dimension::HEIGHT ); + SetLayoutNegotiated(false, Dimension::HEIGHT); } // Do the negotiation - NegotiateDimensions( allocatedSize ); + NegotiateDimensions(allocatedSize); // Set the actor size - SetNegotiatedSize( container ); + SetNegotiatedSize(container); // Negotiate down to children - for( uint32_t i = 0, count = GetChildCount(); i < count; ++i ) + for(uint32_t i = 0, count = GetChildCount(); i < count; ++i) { - ActorPtr child = GetChildAt( i ); + ActorPtr child = GetChildAt(i); // Forces children that have already been laid out to be relayed out // if they have assigned size during relayout. - if( child->GetUseAssignedSize(Dimension::WIDTH) ) + if(child->GetUseAssignedSize(Dimension::WIDTH)) { child->SetLayoutNegotiated(false, Dimension::WIDTH); child->SetLayoutDirty(true, Dimension::WIDTH); } - if( child->GetUseAssignedSize(Dimension::HEIGHT) ) + if(child->GetUseAssignedSize(Dimension::HEIGHT)) { child->SetLayoutNegotiated(false, Dimension::HEIGHT); child->SetLayoutDirty(true, Dimension::HEIGHT); } // Only relayout if required - if( child->RelayoutRequired() ) + if(child->RelayoutRequired()) { - container.Add( Dali::Actor( child.Get() ), mTargetSize.GetVectorXY() ); + container.Add(Dali::Actor(child.Get()), mTargetSize.GetVectorXY()); } } - DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: "); + DALI_LOG_TIMER_END(NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: "); } -void Actor::SetUseAssignedSize( bool use, Dimension::Type dimension ) +void Actor::SetUseAssignedSize(bool use, Dimension::Type dimension) { - if( mRelayoutData ) + if(mRelayoutData) { mRelayoutData->SetUseAssignedSize(use, dimension); } } -bool Actor::GetUseAssignedSize( Dimension::Type dimension ) const +bool Actor::GetUseAssignedSize(Dimension::Type dimension) const { return mRelayoutData && mRelayoutData->GetUseAssignedSize(dimension); } -void Actor::RelayoutRequest( Dimension::Type dimension ) +void Actor::RelayoutRequest(Dimension::Type dimension) { Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get(); - if( relayoutController ) + if(relayoutController) { - Dali::Actor self( this ); - relayoutController->RequestRelayout( self, dimension ); + Dali::Actor self(this); + relayoutController->RequestRelayout(self, dimension); } } -void Actor::SetPreferredSize( const Vector2& size ) +void Actor::SetPreferredSize(const Vector2& size) { EnsureRelayouter(); @@ -2426,14 +2423,14 @@ void Actor::SetPreferredSize( const Vector2& size ) // A 0 width or height may also be required so if the resize policy has not been changed, i.e. is still set to DEFAULT, // then change to FIXED as well - if( size.width > 0.0f || GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DEFAULT ) + if(size.width > 0.0f || GetResizePolicy(Dimension::WIDTH) == ResizePolicy::DEFAULT) { - SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); + SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH); } - if( size.height > 0.0f || GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DEFAULT ) + if(size.height > 0.0f || GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::DEFAULT) { - SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); + SetResizePolicy(ResizePolicy::FIXED, Dimension::HEIGHT); } mRelayoutData->preferredSize = size; @@ -2445,85 +2442,85 @@ void Actor::SetPreferredSize( const Vector2& size ) Vector2 Actor::GetPreferredSize() const { - if ( mRelayoutData ) + if(mRelayoutData) { - return Vector2( mRelayoutData->preferredSize ); + return Vector2(mRelayoutData->preferredSize); } return Relayouter::DEFAULT_PREFERRED_SIZE; } -void Actor::SetMinimumSize( float size, Dimension::Type dimension ) +void Actor::SetMinimumSize(float size, Dimension::Type dimension) { EnsureRelayouter().SetMinimumSize(size, dimension); RelayoutRequest(); } -float Actor::GetMinimumSize( Dimension::Type dimension ) const +float Actor::GetMinimumSize(Dimension::Type dimension) const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->GetMinimumSize(dimension); } - return 0.0f; // Default + return 0.0f; // Default } -void Actor::SetMaximumSize( float size, Dimension::Type dimension ) +void Actor::SetMaximumSize(float size, Dimension::Type dimension) { EnsureRelayouter().SetMaximumSize(size, dimension); RelayoutRequest(); } -float Actor::GetMaximumSize( Dimension::Type dimension ) const +float Actor::GetMaximumSize(Dimension::Type dimension) const { - if ( mRelayoutData ) + if(mRelayoutData) { return mRelayoutData->GetMaximumSize(dimension); } - return FLT_MAX; // Default + return FLT_MAX; // Default } -void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage ) +void Actor::SetVisibleInternal(bool visible, SendMessage::Type sendMessage) { - if( mVisible != visible ) + if(mVisible != visible) { - if( sendMessage == SendMessage::TRUE ) + if(sendMessage == SendMessage::TRUE) { // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty::Bake, visible ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty::Bake, visible); } mVisible = visible; // Emit the signal on this actor and all its children - EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF ); + EmitVisibilityChangedSignalRecursively(this, visible, DevelActor::VisibilityChange::SELF); } } -void Actor::SetSiblingOrder( uint32_t order ) +void Actor::SetSiblingOrder(uint32_t order) { - if ( mParent ) + if(mParent) { - ActorContainer& siblings = *(mParent->mChildren); - uint32_t currentOrder = GetSiblingOrder(); + ActorContainer& siblings = *(mParent->mChildren); + uint32_t currentOrder = GetSiblingOrder(); - if( order != currentOrder ) + if(order != currentOrder) { - if( order == 0 ) + if(order == 0) { LowerToBottom(); } - else if( order < siblings.size() -1 ) + else if(order < siblings.size() - 1) { - if( order > currentOrder ) + if(order > currentOrder) { - RaiseAbove( *siblings[order] ); + RaiseAbove(*siblings[order]); } else { - LowerBelow( *siblings[order] ); + LowerBelow(*siblings[order]); } } else @@ -2538,14 +2535,14 @@ uint32_t Actor::GetSiblingOrder() const { uint32_t order = 0; - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - for( std::size_t i = 0; i < siblings.size(); ++i ) + for(std::size_t i = 0; i < siblings.size(); ++i) { - if( siblings[i] == this ) + if(siblings[i] == this) { - order = static_cast( i ); + order = static_cast(i); break; } } @@ -2556,9 +2553,9 @@ uint32_t Actor::GetSiblingOrder() const void Actor::RequestRebuildDepthTree() { - if( mIsOnScene ) + if(mIsOnScene) { - if( mScene ) + if(mScene) { mScene->RequestRebuildDepthTree(); } @@ -2567,221 +2564,221 @@ void Actor::RequestRebuildDepthTree() void Actor::Raise() { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.back() != this ) // If not already at end + if(siblings.back() != this) // If not already at end { - for( std::size_t i=0; imChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } void Actor::Lower() { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.front() != this ) // If not already at beginning + if(siblings.front() != this) // If not already at beginning { - for( std::size_t i=1; imChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } void Actor::RaiseToTop() { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.back() != this ) // If not already at end + if(siblings.back() != this) // If not already at end { - auto iter = std::find( siblings.begin(), siblings.end(), this ); - if( iter != siblings.end() ) + auto iter = std::find(siblings.begin(), siblings.end(), this); + if(iter != siblings.end()) { siblings.erase(iter); siblings.push_back(ActorPtr(this)); } } - Dali::Actor handle( this ); - mParent->mChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } void Actor::LowerToBottom() { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.front() != this ) // If not already at bottom, + if(siblings.front() != this) // If not already at bottom, { ActorPtr thisPtr(this); // ensure this actor remains referenced. - auto iter = std::find( siblings.begin(), siblings.end(), this ); - if( iter != siblings.end() ) + auto iter = std::find(siblings.begin(), siblings.end(), this); + if(iter != siblings.end()) { siblings.erase(iter); siblings.insert(siblings.begin(), thisPtr); } } - Dali::Actor handle( this ); - mParent->mChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } -void Actor::RaiseAbove( Internal::Actor& target ) +void Actor::RaiseAbove(Internal::Actor& target) { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.back() != this && target.mParent == mParent ) // If not already at top + if(siblings.back() != this && target.mParent == mParent) // If not already at top { ActorPtr thisPtr(this); // ensure this actor remains referenced. - auto targetIter = std::find( siblings.begin(), siblings.end(), &target ); - auto thisIter = std::find( siblings.begin(), siblings.end(), this ); - if( thisIter < targetIter ) + auto targetIter = std::find(siblings.begin(), siblings.end(), &target); + auto thisIter = std::find(siblings.begin(), siblings.end(), this); + if(thisIter < targetIter) { siblings.erase(thisIter); // Erasing early invalidates the targetIter. (Conversely, inserting first may also // invalidate thisIter) - targetIter = std::find( siblings.begin(), siblings.end(), &target ); + targetIter = std::find(siblings.begin(), siblings.end(), &target); ++targetIter; siblings.insert(targetIter, thisPtr); } - Dali::Actor handle( this ); - mParent->mChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } -void Actor::LowerBelow( Internal::Actor& target ) +void Actor::LowerBelow(Internal::Actor& target) { - if ( mParent ) + if(mParent) { ActorContainer& siblings = *(mParent->mChildren); - if( siblings.front() != this && target.mParent == mParent ) // If not already at bottom + if(siblings.front() != this && target.mParent == mParent) // If not already at bottom { ActorPtr thisPtr(this); // ensure this actor remains referenced. - auto targetIter = std::find( siblings.begin(), siblings.end(), &target ); - auto thisIter = std::find( siblings.begin(), siblings.end(), this ); + auto targetIter = std::find(siblings.begin(), siblings.end(), &target); + auto thisIter = std::find(siblings.begin(), siblings.end(), this); - if( thisIter > targetIter ) + if(thisIter > targetIter) { siblings.erase(thisIter); // this only invalidates iterators at or after this point. siblings.insert(targetIter, thisPtr); } - Dali::Actor handle( this ); - mParent->mChildOrderChangedSignal.Emit( handle ); + Dali::Actor handle(this); + mParent->mChildOrderChangedSignal.Emit(handle); RequestRebuildDepthTree(); } } else { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } } -void Actor::SetInheritLayoutDirection( bool inherit ) +void Actor::SetInheritLayoutDirection(bool inherit) { - if( mInheritLayoutDirection != inherit ) + if(mInheritLayoutDirection != inherit) { mInheritLayoutDirection = inherit; - if( inherit && mParent ) + if(inherit && mParent) { - InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection ); + InheritLayoutDirectionRecursively(this, mParent->mLayoutDirection); } } } -void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set ) +void Actor::InheritLayoutDirectionRecursively(ActorPtr actor, Dali::LayoutDirection::Type direction, bool set) { - if( actor && ( actor->mInheritLayoutDirection || set ) ) + if(actor && (actor->mInheritLayoutDirection || set)) { - if( actor->mLayoutDirection != direction ) + if(actor->mLayoutDirection != direction) { actor->mLayoutDirection = direction; - actor->EmitLayoutDirectionChangedSignal( direction ); + actor->EmitLayoutDirectionChangedSignal(direction); actor->RelayoutRequest(); } - if( actor->GetChildCount() > 0 ) + if(actor->GetChildCount() > 0) { - for( const auto& child : actor->GetChildrenInternal() ) + for(const auto& child : actor->GetChildrenInternal()) { - InheritLayoutDirectionRecursively( child, direction ); + InheritLayoutDirectionRecursively(child, direction); } } } } -void Actor::SetUpdateSizeHint( const Vector2& updateSizeHint ) +void Actor::SetUpdateSizeHint(const Vector2& updateSizeHint) { // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f ) ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f)); } } // namespace Internal diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h old mode 100755 new mode 100644 index a3ad757..bf89164 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ACTOR_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -22,26 +22,25 @@ #include // INTERNAL INCLUDES -#include #include -#include -#include -#include -#include -#include -#include #include #include #include #include #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include namespace Dali { - class KeyEvent; class TouchData; class TouchEvent; @@ -49,7 +48,6 @@ class WheelEvent; namespace Internal { - class Actor; class ActorGestureData; class Animation; @@ -80,7 +78,6 @@ using DepthNodeMemoryPool = Dali::Internal::MemoryPoolObjectAllocator; public: - /** * Create a new actor. * @return A smart-pointer to the newly allocated Actor. @@ -142,7 +138,7 @@ public: * Set the name of the actor. * @param[in] name The new name. */ - void SetName( const std::string& name ); + void SetName(const std::string& name); /** * @copydoc Dali::Actor::GetId @@ -201,14 +197,14 @@ public: * @param [in] child The child. * @post The child will be referenced by its parent. */ - void Add( Actor& child ); + void Add(Actor& child); /** * Removes a child Actor from this Actor. * @param [in] child The child. * @post The child will be unreferenced. */ - void Remove( Actor& child ); + void Remove(Actor& child); /** * @copydoc Dali::Actor::Unparent @@ -224,7 +220,7 @@ public: /** * @copydoc Dali::Actor::GetChildAt */ - ActorPtr GetChildAt( uint32_t index ) const; + ActorPtr GetChildAt(uint32_t index) const; /** * Retrieve a reference to Actor's children. @@ -240,12 +236,12 @@ public: /** * @copydoc Dali::Actor::FindChildByName */ - ActorPtr FindChildByName( const std::string& actorName ); + ActorPtr FindChildByName(const std::string& actorName); /** * @copydoc Dali::Actor::FindChildById */ - ActorPtr FindChildById( const uint32_t id ); + ActorPtr FindChildById(const uint32_t id); /** * Retrieve the parent of an Actor. @@ -261,7 +257,7 @@ public: * * @return pair of two values, position of top-left corner on screen and size respectively. */ - Rect<> CalculateScreenExtents( ) const; + Rect<> CalculateScreenExtents() const; /** * Sets the size of an actor. @@ -269,7 +265,7 @@ public: * @param [in] width The new width. * @param [in] height The new height. */ - void SetSize( float width, float height ); + void SetSize(float width, float height); /** * Sets the size of an actor. @@ -278,53 +274,53 @@ public: * @param [in] height The size of the actor along the y-axis. * @param [in] depth The size of the actor along the z-axis. */ - void SetSize( float width, float height, float depth ); + void SetSize(float width, float height, float depth); /** * Sets the size of an actor. * This does not interfere with the actors scale factor. * @param [in] size The new size. */ - void SetSize( const Vector2& size ); + void SetSize(const Vector2& size); /** * Sets the update size for an actor. * * @param[in] size The size to set. */ - void SetSizeInternal( const Vector2& size ); + void SetSizeInternal(const Vector2& size); /** * Sets the size of an actor. * This does not interfere with the actors scale factor. * @param [in] size The new size. */ - void SetSize( const Vector3& size ); + void SetSize(const Vector3& size); /** * Sets the update size for an actor. * * @param[in] size The size to set. */ - void SetSizeInternal( const Vector3& size ); + void SetSizeInternal(const Vector3& size); /** * Set the width component of the Actor's size. * @param [in] width The new width component. */ - void SetWidth( float width ); + void SetWidth(float width); /** * Set the height component of the Actor's size. * @param [in] height The new height component. */ - void SetHeight( float height ); + void SetHeight(float height); /** * Set the depth component of the Actor's size. * @param [in] depth The new depth component. */ - void SetDepth( float depth ); + void SetDepth(float depth); /** * Retrieve the Actor's size from event side. @@ -355,7 +351,7 @@ public: * An actor position is the distance between this origin, and the actors anchor-point. * @param [in] origin The new parent-origin. */ - void SetParentOrigin( const Vector3& origin ); + void SetParentOrigin(const Vector3& origin); /** * Retrieve the parent-origin of an actor. @@ -371,7 +367,7 @@ public: * An actor's rotation is centered around its anchor-point. * @param [in] anchorPoint The new anchor-point. */ - void SetAnchorPoint( const Vector3& anchorPoint ); + void SetAnchorPoint(const Vector3& anchorPoint); /** * Retrieve the anchor-point of an actor. @@ -386,7 +382,7 @@ public: * @param [in] x The new x position * @param [in] y The new y position */ - void SetPosition( float x, float y ); + void SetPosition(float x, float y); /** * Sets the position of the Actor. @@ -395,38 +391,38 @@ public: * @param [in] y The new y position * @param [in] z The new z position */ - void SetPosition( float x, float y, float z ); + void SetPosition(float x, float y, float z); /** * Sets the position of the Actor. * The coordinates are relative to the Actor's parent. * @param [in] position The new position. */ - void SetPosition( const Vector3& position ); + void SetPosition(const Vector3& position); /** * Set the position of an actor along the X-axis. * @param [in] x The new x position */ - void SetX( float x ); + void SetX(float x); /** * Set the position of an actor along the Y-axis. * @param [in] y The new y position. */ - void SetY( float y ); + void SetY(float y); /** * Set the position of an actor along the Z-axis. * @param [in] z The new z position */ - void SetZ( float z ); + void SetZ(float z); /** * Translate an actor relative to its existing position. * @param[in] distance The actor will move by this distance. */ - void TranslateBy( const Vector3& distance ); + void TranslateBy(const Vector3& distance); /** * Retrieve the position of the Actor. @@ -453,7 +449,7 @@ public: /** * @copydoc Dali::Actor::SetInheritPosition() */ - void SetInheritPosition( bool inherit ); + void SetInheritPosition(bool inherit); /** * @copydoc Dali::Actor::IsPositionInherited() @@ -468,26 +464,26 @@ public: * @param [in] angleRadians The new orientation angle in radians. * @param [in] axis The new axis of orientation. */ - void SetOrientation( const Radian& angleRadians, const Vector3& axis ); + void SetOrientation(const Radian& angleRadians, const Vector3& axis); /** * Sets the orientation of the Actor. * @param [in] orientation The new orientation. */ - void SetOrientation( const Quaternion& orientation ); + void SetOrientation(const Quaternion& orientation); /** * Rotate an actor around its existing rotation axis. * @param[in] angleRadians The angle to the rotation to combine with the existing rotation. * @param[in] axis The axis of the rotation to combine with the existing rotation. */ - void RotateBy( const Radian& angleRadians, const Vector3& axis ); + void RotateBy(const Radian& angleRadians, const Vector3& axis); /** * Apply a relative rotation to an actor. * @param[in] relativeRotation The rotation to combine with the actors existing rotation. */ - void RotateBy( const Quaternion& relativeRotation ); + void RotateBy(const Quaternion& relativeRotation); /** * Retreive the Actor's orientation. @@ -500,7 +496,7 @@ public: * Switching this off means that using SetOrientation() sets the actor's world orientation. * @param[in] inherit - true if the actor should inherit orientation, false otherwise. */ - void SetInheritOrientation( bool inherit ); + void SetInheritOrientation(bool inherit); /** * Returns whether the actor inherit's it's parent's orientation. @@ -516,7 +512,7 @@ public: * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT. * @param[in] factor The vector to multiply the parents size by to get the childs size. */ - void SetSizeModeFactor( const Vector3& factor ); + void SetSizeModeFactor(const Vector3& factor); /** * Gets the factor of the parents size used for the child actor. @@ -534,7 +530,7 @@ public: * Sets a scale factor applied to an actor. * @param [in] scale The scale factor applied on all axes. */ - void SetScale( float scale ); + void SetScale(float scale); /** * Sets a scale factor applied to an actor. @@ -542,37 +538,37 @@ public: * @param [in] scaleY The scale factor applied along the y-axis. * @param [in] scaleZ The scale factor applied along the z-axis. */ - void SetScale( float scaleX, float scaleY, float scaleZ ); + void SetScale(float scaleX, float scaleY, float scaleZ); /** * Sets a scale factor applied to an actor. * @param [in] scale A vector representing the scale factor for each axis. */ - void SetScale( const Vector3& scale ); + void SetScale(const Vector3& scale); /** * Set the x component of the scale factor. * @param [in] x The new x value. */ - void SetScaleX( float x ); + void SetScaleX(float x); /** * Set the y component of the scale factor. * @param [in] y The new y value. */ - void SetScaleY( float y ); + void SetScaleY(float y); /** * Set the z component of the scale factor. * @param [in] z The new z value. */ - void SetScaleZ( float z ); + void SetScaleZ(float z); /** * Apply a relative scale to an actor. * @param[in] relativeScale The scale to combine with the actors existing scale. */ - void ScaleBy( const Vector3& relativeScale ); + void ScaleBy(const Vector3& relativeScale); /** * Retrieve the scale factor applied to an actor. @@ -588,7 +584,7 @@ public: /** * @copydoc Dali::Actor::SetInheritScale() */ - void SetInheritScale( bool inherit ); + void SetInheritScale(bool inherit); /** * @copydoc Dali::Actor::IsScaleInherited() @@ -609,7 +605,7 @@ public: * Sets the visibility flag of an actor. * @param[in] visible The new visibility flag. */ - void SetVisible( bool visible ); + void SetVisible(bool visible); /** * Retrieve the visibility flag of an actor. @@ -621,7 +617,7 @@ public: * Sets the opacity of an actor. * @param [in] opacity The new opacity. */ - void SetOpacity( float opacity ); + void SetOpacity(float opacity); /** * Retrieve the actor's opacity. @@ -658,7 +654,7 @@ public: * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either. * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise. */ - void SetSensitive( bool sensitive ) + void SetSensitive(bool sensitive) { mSensitive = sensitive; } @@ -676,7 +672,7 @@ public: /** * @copydoc Dali::Actor::SetDrawMode */ - void SetDrawMode( DrawMode::Type drawMode ); + void SetDrawMode(DrawMode::Type drawMode); /** * @copydoc Dali::Actor::GetDrawMode @@ -691,7 +687,7 @@ public: */ bool IsOverlay() const { - return ( DrawMode::OVERLAY_2D == mDrawMode ); + return (DrawMode::OVERLAY_2D == mDrawMode); } /** @@ -699,25 +695,25 @@ public: * This final color is applied to the drawable elements of an actor. * @param [in] color The new color. */ - void SetColor( const Vector4& color ); + void SetColor(const Vector4& color); /** * Set the red component of the color. * @param [in] red The new red component. */ - void SetColorRed( float red ); + void SetColorRed(float red); /** * Set the green component of the color. * @param [in] green The new green component. */ - void SetColorGreen( float green ); + void SetColorGreen(float green); /** * Set the blue component of the scale factor. * @param [in] blue The new blue value. */ - void SetColorBlue( float blue ); + void SetColorBlue(float blue); /** * Retrieve the actor's color. @@ -730,7 +726,7 @@ public: * Color mode specifies whether Actor uses its own color or inherits its parent color * @param [in] colorMode to use. */ - void SetColorMode( ColorMode colorMode ); + void SetColorMode(ColorMode colorMode); /** * Returns the actor's color mode. @@ -751,7 +747,7 @@ public: */ inline int32_t GetHierarchyDepth() const { - if( mIsOnScene ) + if(mIsOnScene) { return mDepth; } @@ -770,7 +766,6 @@ public: } public: - // Size negotiation virtual functions /** @@ -789,7 +784,7 @@ public: * @param[in,out] container The control should add actors to this container that it is not able * to allocate a size for. */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) + virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) { } @@ -799,7 +794,9 @@ public: * @param[in] policy The policy being set * @param[in] dimension The dimension the policy is being set for */ - virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {} + virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) + { + } /** * @brief Virtual method to notify deriving classes that relayout dependencies have been @@ -807,7 +804,9 @@ public: * * @param dimension The dimension that is about to be calculated */ - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) {} + virtual void OnCalculateRelayoutSize(Dimension::Type dimension) + { + } /** * @brief Virtual method to notify deriving classes that the size for a dimension @@ -816,7 +815,9 @@ public: * @param[in] size The new size for the given dimension * @param[in] dimension The dimension that was just negotiated */ - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) {} + virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) + { + } /** * @brief Determine if this actor is dependent on it's children for relayout @@ -824,7 +825,7 @@ public: * @param dimension The dimension(s) to check for * @return Return if the actor is dependent on it's children */ - virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Determine if this actor is dependent on it's children for relayout. @@ -834,7 +835,7 @@ public: * @param dimension The dimension(s) to check for * @return Return if the actor is dependent on it's children */ - virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Calculate the size for a child @@ -843,7 +844,7 @@ public: * @param[in] dimension The dimension to calculate the size for. E.g. width or height. * @return Return the calculated size for the given dimension */ - virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ); + virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension); /** * @brief This method is called during size negotiation when a height is required for a given width. @@ -853,7 +854,7 @@ public: * @param width to use. * @return the height based on the width. */ - virtual float GetHeightForWidth( float width ); + virtual float GetHeightForWidth(float width); /** * @brief This method is called during size negotiation when a width is required for a given height. @@ -863,10 +864,9 @@ public: * @param height to use. * @return the width based on the width. */ - virtual float GetWidthForHeight( float height ); + virtual float GetWidthForHeight(float height); public: - // Size negotiation /** @@ -881,7 +881,7 @@ public: * @param[in,out] container The container that holds actors that are fed back into the * RelayoutController algorithm. */ - void NegotiateSize( const Vector2& size, RelayoutContainer& container ); + void NegotiateSize(const Vector2& size, RelayoutContainer& container); /** * @brief Set whether size negotiation should use the assigned size of the actor @@ -890,7 +890,7 @@ public: * @param[in] use Whether the assigned size of the actor should be used * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions */ - void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Returns whether size negotiation should use the assigned size of the actor @@ -899,22 +899,22 @@ public: * @param[in] dimension The dimension to get * @return Return whether the assigned size of the actor should be used. If more than one dimension is requested, just return the first one found */ - bool GetUseAssignedSize( Dimension::Type dimension ) const; + bool GetUseAssignedSize(Dimension::Type dimension) const; /** * @copydoc Dali::Actor::SetResizePolicy() */ - void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @copydoc Dali::Actor::GetResizePolicy() */ - ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const; + ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const; /** * @copydoc Dali::Actor::SetSizeScalePolicy() */ - void SetSizeScalePolicy( SizeScalePolicy::Type policy ); + void SetSizeScalePolicy(SizeScalePolicy::Type policy); /** * @copydoc Dali::Actor::GetSizeScalePolicy() @@ -924,19 +924,19 @@ public: /** * @copydoc Dali::Actor::SetDimensionDependency() */ - void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency ); + void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency); /** * @copydoc Dali::Actor::GetDimensionDependency() */ - Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const; + Dimension::Type GetDimensionDependency(Dimension::Type dimension) const; /** * @brief Set the size negotiation relayout enabled on this actor * * @param[in] relayoutEnabled Boolean to enable or disable relayout */ - void SetRelayoutEnabled( bool relayoutEnabled ); + void SetRelayoutEnabled(bool relayoutEnabled); /** * @brief Return if relayout is enabled @@ -951,7 +951,7 @@ public: * @param dirty Whether to mark actor as dirty or not * @param dimension The dimension(s) to mark as dirty */ - void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Return if any of an actor's dimensions are marked as dirty @@ -959,21 +959,21 @@ public: * @param dimension The dimension(s) to check * @return Return if any of the requested dimensions are dirty */ - bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const; + bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const; /** * @brief Returns if relayout is enabled and the actor is not dirty * * @return Return if it is possible to relayout the actor */ - bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const; + bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const; /** * @brief Returns if relayout is enabled and the actor is dirty * * @return Return if it is required to relayout the actor */ - bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const; + bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const; /** * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene) @@ -988,7 +988,7 @@ public: * @note RelayoutRequest() can be called multiple times; the size negotiation is still * only performed once, i.e. there is no need to keep track of this in the calling side. */ - void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Determine if this actor is dependent on it's parent for relayout @@ -996,7 +996,7 @@ public: * @param dimension The dimension(s) to check for * @return Return if the actor is dependent on it's parent */ - bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Determine if this actor has another dimension depedent on the specified one @@ -1005,14 +1005,14 @@ public: * @param dependentDimension The dimension to check for dependency with * @return Return if the actor is dependent on this dimension */ - bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension ); + bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension); /** * Negotiate sizes for a control in all dimensions * * @param[in] allocatedSize The size constraint that the control must respect */ - void NegotiateDimensions( const Vector2& allocatedSize ); + void NegotiateDimensions(const Vector2& allocatedSize); /** * Negotiate size for a specific dimension @@ -1027,7 +1027,7 @@ public: * @param[in] dimension The dimension to negotiate on * @param[in] allocatedSize The size constraint that the actor must respect */ - void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack ); + void NegotiateDimension(Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack); /** * @brief Calculate the size of a dimension @@ -1036,7 +1036,7 @@ public: * @param[in] maximumSize The upper bounds on the size * @return Return the calculated size for the dimension */ - float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize ); + float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize); /** * Negotiate a dimension based on the size of the parent @@ -1044,7 +1044,7 @@ public: * @param[in] dimension The dimension to negotiate on * @return Return the negotiated size */ - float NegotiateFromParent( Dimension::Type dimension ); + float NegotiateFromParent(Dimension::Type dimension); /** * Negotiate a dimension based on the size of the parent. Fitting inside. @@ -1052,7 +1052,7 @@ public: * @param[in] dimension The dimension to negotiate on * @return Return the negotiated size */ - float NegotiateFromParentFit( Dimension::Type dimension ); + float NegotiateFromParentFit(Dimension::Type dimension); /** * Negotiate a dimension based on the size of the parent. Flooding the whole space. @@ -1060,7 +1060,7 @@ public: * @param[in] dimension The dimension to negotiate on * @return Return the negotiated size */ - float NegotiateFromParentFlood( Dimension::Type dimension ); + float NegotiateFromParentFlood(Dimension::Type dimension); /** * @brief Negotiate a dimension based on the size of the children @@ -1068,7 +1068,7 @@ public: * @param[in] dimension The dimension to negotiate on * @return Return the negotiated size */ - float NegotiateFromChildren( Dimension::Type dimension ); + float NegotiateFromChildren(Dimension::Type dimension); /** * Set the negotiated dimension value for the given dimension(s) @@ -1076,7 +1076,7 @@ public: * @param negotiatedDimension The value to set * @param dimension The dimension(s) to set the value for */ - void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * Return the value of negotiated dimension for the given dimension @@ -1084,7 +1084,7 @@ public: * @param dimension The dimension to retrieve * @return Return the value of the negotiated dimension */ - float GetNegotiatedDimension( Dimension::Type dimension ) const; + float GetNegotiatedDimension(Dimension::Type dimension) const; /** * @brief Set the padding for a dimension @@ -1092,7 +1092,7 @@ public: * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top) * @param[in] dimension The dimension to set */ - void SetPadding( const Vector2& padding, Dimension::Type dimension ); + void SetPadding(const Vector2& padding, Dimension::Type dimension); /** * Return the value of padding for the given dimension @@ -1100,7 +1100,7 @@ public: * @param dimension The dimension to retrieve * @return Return the value of padding for the dimension */ - Vector2 GetPadding( Dimension::Type dimension ) const; + Vector2 GetPadding(Dimension::Type dimension) const; /** * Return the actor size for a given dimension @@ -1108,7 +1108,7 @@ public: * @param[in] dimension The dimension to retrieve the size for * @return Return the size for the given dimension */ - float GetSize( Dimension::Type dimension ) const; + float GetSize(Dimension::Type dimension) const; /** * Return the natural size of the actor for a given dimension @@ -1116,7 +1116,7 @@ public: * @param[in] dimension The dimension to retrieve the size for * @return Return the natural size for the given dimension */ - float GetNaturalSize( Dimension::Type dimension ) const; + float GetNaturalSize(Dimension::Type dimension) const; /** * @brief Return the amount of size allocated for relayout @@ -1126,7 +1126,7 @@ public: * @param[in] dimension The dimension to retrieve * @return Return the size */ - float GetRelayoutSize( Dimension::Type dimension ) const; + float GetRelayoutSize(Dimension::Type dimension) const; /** * @brief If the size has been negotiated return that else return normal size @@ -1134,14 +1134,14 @@ public: * @param[in] dimension The dimension to retrieve * @return Return the size */ - float GetLatestSize( Dimension::Type dimension ) const; + float GetLatestSize(Dimension::Type dimension) const; /** * Apply the negotiated size to the actor * * @param[in] container The container to fill with actors that require further relayout */ - void SetNegotiatedSize( RelayoutContainer& container ); + void SetNegotiatedSize(RelayoutContainer& container); /** * @brief Flag the actor as having it's layout dimension negotiated. @@ -1149,7 +1149,7 @@ public: * @param[in] negotiated The status of the flag to set. * @param[in] dimension The dimension to set the flag for */ - void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @brief Test whether the layout dimension for this actor has been negotiated or not. @@ -1157,21 +1157,21 @@ public: * @param[in] dimension The dimension to determine the value of the flag for * @return Return if the layout dimension is negotiated or not. */ - bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const; + bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const; /** * @brief provides the Actor implementation of GetHeightForWidth * @param width to use. * @return the height based on the width. */ - float GetHeightForWidthBase( float width ); + float GetHeightForWidthBase(float width); /** * @brief provides the Actor implementation of GetWidthForHeight * @param height to use. * @return the width based on the height. */ - float GetWidthForHeightBase( float height ); + float GetWidthForHeightBase(float height); /** * @brief Calculate the size for a child @@ -1180,14 +1180,14 @@ public: * @param[in] dimension The dimension to calculate the size for. E.g. width or height. * @return Return the calculated size for the given dimension */ - float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ); + float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension); /** * @brief Set the preferred size for size negotiation * * @param[in] size The preferred size to set */ - void SetPreferredSize( const Vector2& size ); + void SetPreferredSize(const Vector2& size); /** * @brief Return the preferred size used for size negotiation @@ -1199,27 +1199,27 @@ public: /** * @copydoc Dali::Actor::SetMinimumSize */ - void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @copydoc Dali::Actor::GetMinimumSize */ - float GetMinimumSize( Dimension::Type dimension ) const; + float GetMinimumSize(Dimension::Type dimension) const; /** * @copydoc Dali::Actor::SetMaximumSize */ - void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS); /** * @copydoc Dali::Actor::GetMaximumSize */ - float GetMaximumSize( Dimension::Type dimension ) const; + float GetMaximumSize(Dimension::Type dimension) const; /** * @copydoc Dali::Actor::AddRenderer() */ - uint32_t AddRenderer( Renderer& renderer ); + uint32_t AddRenderer(Renderer& renderer); /** * @copydoc Dali::Actor::GetRendererCount() @@ -1229,20 +1229,19 @@ public: /** * @copydoc Dali::Actor::GetRendererAt() */ - RendererPtr GetRendererAt( uint32_t index ); + RendererPtr GetRendererAt(uint32_t index); /** * @copydoc Dali::Actor::RemoveRenderer() */ - void RemoveRenderer( Renderer& renderer ); + void RemoveRenderer(Renderer& renderer); /** * @copydoc Dali::Actor::RemoveRenderer() */ - void RemoveRenderer( uint32_t index ); + void RemoveRenderer(uint32_t index); public: - /** * Converts screen coordinates into the actor's coordinate system. * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5) @@ -1252,7 +1251,7 @@ public: * @param[in] screenY The screen Y-coordinate. * @return True if the conversion succeeded. */ - bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const; + bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const; /** * Converts screen coordinates into the actor's coordinate system. @@ -1264,7 +1263,7 @@ public: * @param[in] screenY The screen Y-coordinate. * @return True if the conversion succeeded. */ - bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const; + bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const; /** * Converts from the actor's coordinate system to screen coordinates. @@ -1278,13 +1277,13 @@ public: * @param[in] screenY The screen Y-coordinate. * @return True if the conversion succeeded. */ - bool ScreenToLocal( const Matrix& viewMatrix, - const Matrix& projectionMatrix, - const Viewport& viewport, - float& localX, - float& localY, - float screenX, - float screenY ) const; + bool ScreenToLocal(const Matrix& viewMatrix, + const Matrix& projectionMatrix, + const Viewport& viewport, + float& localX, + float& localY, + float screenX, + float screenY) const; /** * Sets whether the actor should receive a notification when touch or hover motion events leave @@ -1295,7 +1294,7 @@ public: * * @param[in] required Should be set to true if a Leave event is required */ - void SetLeaveRequired( bool required ) + void SetLeaveRequired(bool required) { mLeaveRequired = required; } @@ -1313,7 +1312,7 @@ public: /** * @copydoc Dali::Actor::SetKeyboardFocusable() */ - void SetKeyboardFocusable( bool focusable ) + void SetKeyboardFocusable(bool focusable) { mKeyboardFocusable = focusable; } @@ -1326,7 +1325,6 @@ public: return mKeyboardFocusable; } - /** * Query whether the application or derived actor type requires intercept touch events. * @return True if intercept touch events are required. @@ -1370,7 +1368,7 @@ public: */ bool IsHittable() const { - return IsSensitive() && IsVisible() && ( GetCurrentWorldColor().a > FULLY_TRANSPARENT ) && IsNodeConnected(); + return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected(); } /** @@ -1383,24 +1381,23 @@ public: } /** - * Sets the touch area of an actor. - * @param [in] area The new area. + * Sets the touch area offset of an actor. + * @param [in] offset The new offset of area (left, right, bottom, top). */ - void SetTouchArea(Vector2 area) + void SetTouchAreaOffset(Rect offset) { - mTouchArea = area; + mTouchAreaOffset = offset; } /** - * Retrieve the Actor's touch area. - * @return The Actor's touch area. + * Retrieve the Actor's touch area offset. + * @return The Actor's touch area offset. */ - const Vector2& GetTouchArea() const + const Rect& GetTouchAreaOffset() const { - return mTouchArea; + return mTouchAreaOffset; } - // Gestures /** @@ -1418,7 +1415,7 @@ public: * @param[in] type The gesture type. * @return True if the gesture is required, false otherwise. */ - bool IsGestureRequired( GestureType::Value type ) const; + bool IsGestureRequired(GestureType::Value type) const; // Signals @@ -1427,53 +1424,53 @@ public: * @param[in] touch The touch data. * @return True if the event was intercepted. */ - bool EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch ); + bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch); /** * Used by the EventProcessor to emit touch event signals. * @param[in] touch The touch data. * @return True if the event was consumed. */ - bool EmitTouchEventSignal( const Dali::TouchEvent& touch ); + bool EmitTouchEventSignal(const Dali::TouchEvent& touch); /** * Used by the EventProcessor to emit hover event signals. * @param[in] event The hover event. * @return True if the event was consumed. */ - bool EmitHoverEventSignal( const Dali::HoverEvent& event ); + bool EmitHoverEventSignal(const Dali::HoverEvent& event); /** * Used by the EventProcessor to emit wheel event signals. * @param[in] event The wheel event. * @return True if the event was consumed. */ - bool EmitWheelEventSignal( const Dali::WheelEvent& event ); + bool EmitWheelEventSignal(const Dali::WheelEvent& event); /** * @brief Emits the visibility change signal for this actor and all its children. * @param[in] visible Whether the actor has become visible or not. * @param[in] type Whether the actor's visible property has changed or a parent's. */ - void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type ); + void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type); /** * @brief Emits the layout direction change signal for this actor and all its children. * @param[in] type Whether the actor's layout direction property has changed or a parent's. */ - void EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ); + void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type); /** * @brief Emits the ChildAdded signal for this actor * @param[in] child The child actor that has been added */ - void EmitChildAddedSignal( Actor& child ); + void EmitChildAddedSignal(Actor& child); /** * @brief Emits the ChildRemoved signal for this actor * @param[in] child The child actor that has been removed */ - void EmitChildRemovedSignal( Actor& child ); + void EmitChildRemovedSignal(Actor& child); /** * @copydoc DevelActor::InterceptTouchedSignal() @@ -1580,10 +1577,10 @@ public: * @return True if the signal was connected. * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. */ - static bool DoConnectSignal( BaseObject* object, - ConnectionTrackerInterface* tracker, - const std::string& signalName, - FunctorDelegate* functor ); + static bool DoConnectSignal(BaseObject* object, + ConnectionTrackerInterface* tracker, + const std::string& signalName, + FunctorDelegate* functor); /** * Performs actions as requested using the action name. @@ -1592,9 +1589,9 @@ public: * @param[in] attributes The attributes with which to perfrom this action. * @return true if the action was done. */ - static bool DoAction( BaseObject* object, - const std::string& actionName, - const Property::Map& attributes ); + static bool DoAction(BaseObject* object, + const std::string& actionName, + const Property::Map& attributes); public: // For Animation @@ -1603,15 +1600,16 @@ public: * For use in derived classes. * This should only be called by Animation, when the actor is resized using Animation::Resize(). */ - virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ) + virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) { } protected: - enum DerivedType { - BASIC, LAYER, ROOT_LAYER + BASIC, + LAYER, + ROOT_LAYER }; /** @@ -1620,12 +1618,12 @@ protected: * @param[in] derivedType The derived type of actor (if any). * @param[in] reference to the node */ - Actor( DerivedType derivedType, const SceneGraph::Node& node ); + Actor(DerivedType derivedType, const SceneGraph::Node& node); /** * Second-phase constructor. Must be called immediately after creating a new Actor; */ - void Initialize( void ); + void Initialize(void); /** * A reference counted object may only be deleted by calling Unreference() @@ -1636,7 +1634,7 @@ protected: * Called on a child during Add() when the parent actor is connected to the Scene. * @param[in] parentDepth The depth of the parent in the hierarchy. */ - void ConnectToScene( uint32_t parentDepth ); + void ConnectToScene(uint32_t parentDepth); /** * Helper for ConnectToScene, to recursively connect a tree of actors. @@ -1644,7 +1642,7 @@ protected: * @param[in] depth The depth in the hierarchy of the actor * @param[out] connectionList On return, the list of connected actors which require notification. */ - void RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth ); + void RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth); /** * Connect the Node associated with this Actor to the scene-graph. @@ -1666,7 +1664,7 @@ protected: * This is atomic i.e. not interrupted by user callbacks. * @param[out] disconnectionList On return, the list of disconnected actors which require notification. */ - void RecursiveDisconnectFromStage( ActorContainer& disconnectionList ); + void RecursiveDisconnectFromStage(ActorContainer& disconnectionList); /** * Disconnect the Node associated with this Actor from the scene-graph. @@ -1693,57 +1691,55 @@ public: void RebuildDepthTree(); protected: - /** * Traverse the actor tree, inserting actors into the depth tree in sibling order. * @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index * @param[in,out] depthIndex The current depth index (traversal index) */ - void DepthTraverseActorTree( OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex ); + void DepthTraverseActorTree(OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex); public: - // Default property extensions from Object /** * @copydoc Dali::Internal::Object::SetDefaultProperty() */ - void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ) override; + void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override; /** * @copydoc Dali::Internal::Object::SetSceneGraphProperty() */ - void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ) override; + void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override; /** * @copydoc Dali::Internal::Object::GetDefaultProperty() */ - Property::Value GetDefaultProperty( Property::Index index ) const override; + Property::Value GetDefaultProperty(Property::Index index) const override; /** * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue() */ - Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const override; + Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override; /** * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation() */ - void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ) override; + void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override; /** * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty() */ - const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const override; + const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override; /** * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty() */ - const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const override; + const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override; /** * @copydoc Dali::Internal::Object::GetPropertyComponentIndex() */ - int32_t GetPropertyComponentIndex( Property::Index index ) const override; + int32_t GetPropertyComponentIndex(Property::Index index) const override; /** * @copydoc Dali::Internal::Object::IsAnimationPossible() @@ -1759,7 +1755,7 @@ public: */ const SceneGraph::Node& GetNode() const { - return *static_cast( mUpdateObject ); + return *static_cast(mUpdateObject); } /** @@ -1785,20 +1781,19 @@ public: /** * @copydoc Dali::DevelActor::RaiseAbove() */ - void RaiseAbove( Internal::Actor& target ); + void RaiseAbove(Internal::Actor& target); /** * @copydoc Dali::DevelActor::LowerBelow() */ - void LowerBelow( Internal::Actor& target ); + void LowerBelow(Internal::Actor& target); public: - /** * Sets the scene which this actor is added to. * @param[in] scene The scene */ - void SetScene( Scene& scene ) + void SetScene(Scene& scene) { mScene = &scene; } @@ -1813,7 +1808,6 @@ public: } private: - struct SendMessage { enum Type @@ -1837,15 +1831,15 @@ private: struct Relayouter; // Remove default constructor and copy constructor - Actor() = delete; - Actor( const Actor& ) = delete; - Actor& operator=( const Actor& rhs ) = delete; + Actor() = delete; + Actor(const Actor&) = delete; + Actor& operator=(const Actor& rhs) = delete; /** * Set the actors parent. * @param[in] parent The new parent. */ - void SetParent( Actor* parent ); + void SetParent(Actor* parent); /** * For use in derived classes, called after Initialize() @@ -1876,7 +1870,7 @@ private: * For use in external (CustomActor) derived classes. * This is called after the atomic ConnectToScene() traversal has been completed. */ - virtual void OnSceneConnectionExternal( int depth ) + virtual void OnSceneConnectionExternal(int depth) { } @@ -1892,7 +1886,7 @@ private: * For use in derived classes; this is called after Add() has added a child. * @param[in] child The child that was added. */ - virtual void OnChildAdd( Actor& child ) + virtual void OnChildAdd(Actor& child) { } @@ -1900,7 +1894,7 @@ private: * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ). * @param[in] child The child that was removed. */ - virtual void OnChildRemove( Actor& child ) + virtual void OnChildRemove(Actor& child) { } @@ -1908,7 +1902,7 @@ private: * For use in derived classes. * This is called after SizeSet() has been called. */ - virtual void OnSizeSet( const Vector3& targetSize ) + virtual void OnSizeSet(const Vector3& targetSize) { } @@ -1918,7 +1912,7 @@ private: * @param[out] value Is set with the cached value of the property if found. * @return True if value set, false otherwise. */ - bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const; + bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const; /** * @brief Retrieves the current value of a default property from the scene-graph. @@ -1926,7 +1920,7 @@ private: * @param[out] value Is set with the current scene-graph value of the property * @return True if value set, false otherwise. */ - bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const; + bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const; /** * @brief Ensure the relayouter is allocated @@ -1939,7 +1933,7 @@ private: * @param[in] size The size to apply the policy to * @return Return the adjusted size */ - Vector2 ApplySizeSetPolicy( const Vector2& size ); + Vector2 ApplySizeSetPolicy(const Vector2& size); /** * Retrieve the parent object of an Actor. @@ -1955,7 +1949,7 @@ private: * @param[in] order The sibling order this Actor should be. It will place * the actor at this index in it's parent's child array. */ - void SetSiblingOrder( uint32_t order); + void SetSiblingOrder(uint32_t order); /** * Get Sibling order @@ -1980,13 +1974,13 @@ private: * @param[in] visible The new visibility flag. * @param[in] sendMessage Whether to send a message to the update thread or not. */ - void SetVisibleInternal( bool visible, SendMessage::Type sendMessage ); + void SetVisibleInternal(bool visible, SendMessage::Type sendMessage); /** * Set whether a child actor inherits it's parent's layout direction. Default is to inherit. * @param[in] inherit - true if the actor should inherit layout direction, false otherwise. */ - void SetInheritLayoutDirection( bool inherit ); + void SetInheritLayoutDirection(bool inherit); /** * Returns whether the actor inherits it's parent's layout direction. @@ -2002,79 +1996,77 @@ private: * @param[in] actor The actor for seting layout direction. * @param[in] direction New layout direction. */ - void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false ); + void InheritLayoutDirectionRecursively(ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false); /** * @brief Sets the update size hint of an actor. * @param [in] updateSizeHint The update size hint. */ - void SetUpdateSizeHint( const Vector2& updateSizeHint ); + void SetUpdateSizeHint(const Vector2& updateSizeHint); protected: + Scene* mScene; ///< The scene the actor is added to - Scene* mScene; ///< The scene the actor is added to + Actor* mParent; ///< Each actor (except the root) can have one parent + ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized + RendererContainer* mRenderers; ///< Renderer container - Actor* mParent; ///< Each actor (except the root) can have one parent - ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized - RendererContainer* mRenderers; ///< Renderer container - - Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable - Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable + Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable + Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables - ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures + ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures // Signals - Dali::Actor::TouchEventSignalType mInterceptTouchedSignal; - Dali::Actor::TouchEventSignalType mTouchedSignal; - Dali::Actor::HoverSignalType mHoveredSignal; - Dali::Actor::WheelEventSignalType mWheelEventSignal; - Dali::Actor::OnSceneSignalType mOnSceneSignal; - Dali::Actor::OffSceneSignalType mOffSceneSignal; - Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal; - DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal; - Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal; - DevelActor::ChildChangedSignalType mChildAddedSignal; - DevelActor::ChildChangedSignalType mChildRemovedSignal; - DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal; - - Quaternion mTargetOrientation; ///< Event-side storage for orientation - Vector4 mTargetColor; ///< Event-side storage for color - Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size) - Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position) - Vector3 mTargetScale; ///< Event-side storage for scale - Vector3 mAnimatedSize; ///< Event-side storage for size animation - Vector2 mTouchArea; ///< touch area - - std::string mName; ///< Name of the actor - uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order. - int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported - uint16_t mUseAnimatedSize; ///< Whether the size is animated. - - const bool mIsRoot : 1; ///< Flag to identify the root actor - const bool mIsLayer : 1; ///< Flag to identify that this is a layer - bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene - bool mSensitive : 1; ///< Whether the actor emits touch event signals - bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds - bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation - bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection - bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet - bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited. - bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited. - bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited. - bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not. - bool mVisible : 1; ///< Cached: Whether the actor is visible or not. - bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent. - bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area. - LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left. - DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn - ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited - ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use. + Dali::Actor::TouchEventSignalType mInterceptTouchedSignal; + Dali::Actor::TouchEventSignalType mTouchedSignal; + Dali::Actor::HoverSignalType mHoveredSignal; + Dali::Actor::WheelEventSignalType mWheelEventSignal; + Dali::Actor::OnSceneSignalType mOnSceneSignal; + Dali::Actor::OffSceneSignalType mOffSceneSignal; + Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal; + DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal; + Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal; + DevelActor::ChildChangedSignalType mChildAddedSignal; + DevelActor::ChildChangedSignalType mChildRemovedSignal; + DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal; + + Quaternion mTargetOrientation; ///< Event-side storage for orientation + Vector4 mTargetColor; ///< Event-side storage for color + Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size) + Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position) + Vector3 mTargetScale; ///< Event-side storage for scale + Vector3 mAnimatedSize; ///< Event-side storage for size animation + Rect mTouchAreaOffset; ///< touch area offset (left, right, bottom, top) + + std::string mName; ///< Name of the actor + uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order. + int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported + uint16_t mUseAnimatedSize; ///< Whether the size is animated. + + const bool mIsRoot : 1; ///< Flag to identify the root actor + const bool mIsLayer : 1; ///< Flag to identify that this is a layer + bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene + bool mSensitive : 1; ///< Whether the actor emits touch event signals + bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds + bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation + bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection + bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet + bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited. + bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited. + bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited. + bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not. + bool mVisible : 1; ///< Cached: Whether the actor is visible or not. + bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent. + bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area. + LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left. + DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn + ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited + ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use. private: - - static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const) + static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const) struct PropertyHandler; }; @@ -2083,22 +2075,22 @@ private: // Helpers for public-api forwarding methods -inline Internal::Actor& GetImplementation( Dali::Actor& actor ) +inline Internal::Actor& GetImplementation(Dali::Actor& actor) { - DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" ); + DALI_ASSERT_ALWAYS(actor && "Actor handle is empty"); BaseObject& handle = actor.GetBaseObject(); - return static_cast< Internal::Actor& >( handle ); + return static_cast(handle); } -inline const Internal::Actor& GetImplementation( const Dali::Actor& actor ) +inline const Internal::Actor& GetImplementation(const Dali::Actor& actor) { - DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" ); + DALI_ASSERT_ALWAYS(actor && "Actor handle is empty"); const BaseObject& handle = actor.GetBaseObject(); - return static_cast< const Internal::Actor& >( handle ); + return static_cast(handle); } } // namespace Dali diff --git a/dali/internal/event/actors/actor-property-handler.cpp b/dali/internal/event/actors/actor-property-handler.cpp old mode 100755 new mode 100644 index 3df53fc..ca44caf --- a/dali/internal/event/actors/actor-property-handler.cpp +++ b/dali/internal/event/actors/actor-property-handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,125 +19,122 @@ #include // INTERNAL INCLUDES -#include -#include #include #include #include -#include #include +#include +#include +#include -using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::AnimatableProperty; +using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::PropertyBase; namespace Dali { - namespace Internal { - namespace // unnamed namespace { - struct AnchorValue { - const char* name; + const char* name; const Vector3& value; }; -DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( AnchorValue, ANCHOR_CONSTANT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_LEFT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_CENTER ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_RIGHT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_LEFT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_RIGHT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_LEFT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_CENTER ) -DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_RIGHT ) -DALI_ENUM_TO_STRING_TABLE_END( ANCHOR_CONSTANT ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( COLOR_MODE ) -DALI_ENUM_TO_STRING( USE_OWN_COLOR ) -DALI_ENUM_TO_STRING( USE_PARENT_COLOR ) -DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_COLOR ) -DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_ALPHA ) -DALI_ENUM_TO_STRING_TABLE_END( COLOR_MODE ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( DRAW_MODE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, NORMAL ) -DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, OVERLAY_2D ) -DALI_ENUM_TO_STRING_TABLE_END( DRAW_MODE ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( RESIZE_POLICY ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIXED ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_NATURAL_SIZE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FILL_TO_PARENT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_RELATIVE_TO_PARENT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_FIXED_OFFSET_FROM_PARENT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIT_TO_CHILDREN ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, DIMENSION_DEPENDENCY ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_ASSIGNED_SIZE ) -DALI_ENUM_TO_STRING_TABLE_END( RESIZE_POLICY ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( SIZE_SCALE_POLICY ) -DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, USE_SIZE_SET ) -DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FIT_WITH_ASPECT_RATIO ) -DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FILL_WITH_ASPECT_RATIO ) -DALI_ENUM_TO_STRING_TABLE_END( SIZE_SCALE_POLICY ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED ) -DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN ) -DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE ) - -DALI_ENUM_TO_STRING_TABLE_BEGIN( LAYOUT_DIRECTION ) -DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, LEFT_TO_RIGHT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, RIGHT_TO_LEFT ) -DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION ) - -bool GetAnchorPointConstant( const std::string& value, Vector3& anchor ) +DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE(AnchorValue, ANCHOR_CONSTANT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_LEFT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_CENTER) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_RIGHT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER_LEFT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER_RIGHT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_LEFT) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_CENTER) + DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_RIGHT) +DALI_ENUM_TO_STRING_TABLE_END(ANCHOR_CONSTANT) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(COLOR_MODE) + DALI_ENUM_TO_STRING(USE_OWN_COLOR) + DALI_ENUM_TO_STRING(USE_PARENT_COLOR) + DALI_ENUM_TO_STRING(USE_OWN_MULTIPLY_PARENT_COLOR) + DALI_ENUM_TO_STRING(USE_OWN_MULTIPLY_PARENT_ALPHA) +DALI_ENUM_TO_STRING_TABLE_END(COLOR_MODE) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(DRAW_MODE) + DALI_ENUM_TO_STRING_WITH_SCOPE(DrawMode, NORMAL) + DALI_ENUM_TO_STRING_WITH_SCOPE(DrawMode, OVERLAY_2D) +DALI_ENUM_TO_STRING_TABLE_END(DRAW_MODE) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(RESIZE_POLICY) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FIXED) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, USE_NATURAL_SIZE) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FILL_TO_PARENT) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, SIZE_RELATIVE_TO_PARENT) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, SIZE_FIXED_OFFSET_FROM_PARENT) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FIT_TO_CHILDREN) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, DIMENSION_DEPENDENCY) + DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, USE_ASSIGNED_SIZE) +DALI_ENUM_TO_STRING_TABLE_END(RESIZE_POLICY) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(SIZE_SCALE_POLICY) + DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, USE_SIZE_SET) + DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, FIT_WITH_ASPECT_RATIO) + DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, FILL_WITH_ASPECT_RATIO) +DALI_ENUM_TO_STRING_TABLE_END(SIZE_SCALE_POLICY) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(CLIPPING_MODE) + DALI_ENUM_TO_STRING_WITH_SCOPE(ClippingMode, DISABLED) + DALI_ENUM_TO_STRING_WITH_SCOPE(ClippingMode, CLIP_CHILDREN) +DALI_ENUM_TO_STRING_TABLE_END(CLIPPING_MODE) + +DALI_ENUM_TO_STRING_TABLE_BEGIN(LAYOUT_DIRECTION) + DALI_ENUM_TO_STRING_WITH_SCOPE(LayoutDirection, LEFT_TO_RIGHT) + DALI_ENUM_TO_STRING_WITH_SCOPE(LayoutDirection, RIGHT_TO_LEFT) +DALI_ENUM_TO_STRING_TABLE_END(LAYOUT_DIRECTION) + +bool GetAnchorPointConstant(const std::string& value, Vector3& anchor) { - for( uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i ) + for(uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i) { uint32_t sizeIgnored = 0; - if( CompareTokens( value.c_str(), ANCHOR_CONSTANT_TABLE[ i ].name, sizeIgnored ) ) + if(CompareTokens(value.c_str(), ANCHOR_CONSTANT_TABLE[i].name, sizeIgnored)) { - anchor = ANCHOR_CONSTANT_TABLE[ i ].value; + anchor = ANCHOR_CONSTANT_TABLE[i].value; return true; } } return false; } -inline bool GetParentOriginConstant( const std::string& value, Vector3& parentOrigin ) +inline bool GetParentOriginConstant(const std::string& value, Vector3& parentOrigin) { // Values are the same so just use the same table as anchor-point - return GetAnchorPointConstant( value, parentOrigin ); + return GetAnchorPointConstant(value, parentOrigin); } } // unnamed namespace -void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Property::Index index, const Property::Value& property ) +void Actor::PropertyHandler::SetDefaultProperty(Internal::Actor& actor, Property::Index index, const Property::Value& property) { - switch( index ) + switch(index) { case Dali::Actor::Property::PARENT_ORIGIN: { Property::Type type = property.GetType(); - if( type == Property::VECTOR3 ) + if(type == Property::VECTOR3) { - actor.SetParentOrigin( property.Get< Vector3 >() ); + actor.SetParentOrigin(property.Get()); } - else if ( type == Property::STRING ) + else if(type == Property::STRING) { std::string parentOriginString; - property.Get( parentOriginString ); + property.Get(parentOriginString); Vector3 parentOrigin; - if( GetParentOriginConstant( parentOriginString, parentOrigin ) ) + if(GetParentOriginConstant(parentOriginString, parentOrigin)) { - actor.SetParentOrigin( parentOrigin ); + actor.SetParentOrigin(parentOrigin); } } break; @@ -146,39 +143,39 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::PARENT_ORIGIN_X: { const Vector3& current = actor.GetCurrentParentOrigin(); - actor.SetParentOrigin( Vector3( property.Get< float >(), current.y, current.z ) ); + actor.SetParentOrigin(Vector3(property.Get(), current.y, current.z)); break; } case Dali::Actor::Property::PARENT_ORIGIN_Y: { const Vector3& current = actor.GetCurrentParentOrigin(); - actor.SetParentOrigin( Vector3( current.x, property.Get< float >(), current.z ) ); + actor.SetParentOrigin(Vector3(current.x, property.Get(), current.z)); break; } case Dali::Actor::Property::PARENT_ORIGIN_Z: { const Vector3& current = actor.GetCurrentParentOrigin(); - actor.SetParentOrigin( Vector3( current.x, current.y, property.Get< float >() ) ); + actor.SetParentOrigin(Vector3(current.x, current.y, property.Get())); break; } case Dali::Actor::Property::ANCHOR_POINT: { Property::Type type = property.GetType(); - if( type == Property::VECTOR3 ) + if(type == Property::VECTOR3) { - actor.SetAnchorPoint( property.Get< Vector3 >() ); + actor.SetAnchorPoint(property.Get()); } - else if ( type == Property::STRING ) + else if(type == Property::STRING) { std::string anchorPointString; - property.Get( anchorPointString ); + property.Get(anchorPointString); Vector3 anchor; - if( GetAnchorPointConstant( anchorPointString, anchor ) ) + if(GetAnchorPointConstant(anchorPointString, anchor)) { - actor.SetAnchorPoint( anchor ); + actor.SetAnchorPoint(anchor); } } break; @@ -187,164 +184,164 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::ANCHOR_POINT_X: { const Vector3& current = actor.GetCurrentAnchorPoint(); - actor.SetAnchorPoint( Vector3( property.Get< float >(), current.y, current.z ) ); + actor.SetAnchorPoint(Vector3(property.Get(), current.y, current.z)); break; } case Dali::Actor::Property::ANCHOR_POINT_Y: { const Vector3& current = actor.GetCurrentAnchorPoint(); - actor.SetAnchorPoint( Vector3( current.x, property.Get< float >(), current.z ) ); + actor.SetAnchorPoint(Vector3(current.x, property.Get(), current.z)); break; } case Dali::Actor::Property::ANCHOR_POINT_Z: { const Vector3& current = actor.GetCurrentAnchorPoint(); - actor.SetAnchorPoint( Vector3( current.x, current.y, property.Get< float >() ) ); + actor.SetAnchorPoint(Vector3(current.x, current.y, property.Get())); break; } case Dali::Actor::Property::SIZE: { Property::Type type = property.GetType(); - if( type == Property::VECTOR2 ) + if(type == Property::VECTOR2) { - actor.SetSize( property.Get< Vector2 >() ); + actor.SetSize(property.Get()); } - else if ( type == Property::VECTOR3 ) + else if(type == Property::VECTOR3) { - actor.SetSize( property.Get< Vector3 >() ); + actor.SetSize(property.Get()); } break; } case Dali::Actor::Property::SIZE_WIDTH: { - actor.SetWidth( property.Get< float >() ); + actor.SetWidth(property.Get()); break; } case Dali::Actor::Property::SIZE_HEIGHT: { - actor.SetHeight( property.Get< float >() ); + actor.SetHeight(property.Get()); break; } case Dali::Actor::Property::SIZE_DEPTH: { - actor.SetDepth( property.Get< float >() ); + actor.SetDepth(property.Get()); break; } case Dali::Actor::Property::POSITION: { Property::Type type = property.GetType(); - if( type == Property::VECTOR2 ) + if(type == Property::VECTOR2) { - Vector2 position = property.Get< Vector2 >(); - actor.SetPosition( Vector3( position.x, position.y, 0.0f ) ); + Vector2 position = property.Get(); + actor.SetPosition(Vector3(position.x, position.y, 0.0f)); } - else if ( type == Property::VECTOR3 ) + else if(type == Property::VECTOR3) { - actor.SetPosition( property.Get< Vector3 >() ); + actor.SetPosition(property.Get()); } break; } case Dali::Actor::Property::POSITION_X: { - actor.SetX( property.Get< float >() ); + actor.SetX(property.Get()); break; } case Dali::Actor::Property::POSITION_Y: { - actor.SetY( property.Get< float >() ); + actor.SetY(property.Get()); break; } case Dali::Actor::Property::POSITION_Z: { - actor.SetZ( property.Get< float >() ); + actor.SetZ(property.Get()); break; } case Dali::Actor::Property::ORIENTATION: { - actor.SetOrientation( property.Get< Quaternion >() ); + actor.SetOrientation(property.Get()); break; } case Dali::Actor::Property::SCALE: { Property::Type type = property.GetType(); - if( type == Property::FLOAT ) + if(type == Property::FLOAT) { - float scale = property.Get< float >(); - actor.SetScale( scale, scale, scale ); + float scale = property.Get(); + actor.SetScale(scale, scale, scale); } - else if ( type == Property::VECTOR3 ) + else if(type == Property::VECTOR3) { - actor.SetScale( property.Get< Vector3 >() ); + actor.SetScale(property.Get()); } break; } case Dali::Actor::Property::SCALE_X: { - actor.SetScaleX( property.Get< float >() ); + actor.SetScaleX(property.Get()); break; } case Dali::Actor::Property::SCALE_Y: { - actor.SetScaleY( property.Get< float >() ); + actor.SetScaleY(property.Get()); break; } case Dali::Actor::Property::SCALE_Z: { - actor.SetScaleZ( property.Get< float >() ); + actor.SetScaleZ(property.Get()); break; } case Dali::Actor::Property::VISIBLE: { - actor.SetVisible( property.Get< bool >() ); + actor.SetVisible(property.Get()); break; } case Dali::Actor::Property::COLOR: { Property::Type type = property.GetType(); - if( type == Property::VECTOR3 ) + if(type == Property::VECTOR3) { - Vector3 color = property.Get< Vector3 >(); - actor.SetColor( Vector4( color.r, color.g, color.b, 1.0f ) ); + Vector3 color = property.Get(); + actor.SetColor(Vector4(color.r, color.g, color.b, 1.0f)); } - else if( type == Property::VECTOR4 ) + else if(type == Property::VECTOR4) { - actor.SetColor( property.Get< Vector4 >() ); + actor.SetColor(property.Get()); } break; } case Dali::Actor::Property::COLOR_RED: { - actor.SetColorRed( property.Get< float >() ); + actor.SetColorRed(property.Get()); break; } case Dali::Actor::Property::COLOR_GREEN: { - actor.SetColorGreen( property.Get< float >() ); + actor.SetColorGreen(property.Get()); break; } case Dali::Actor::Property::COLOR_BLUE: { - actor.SetColorBlue( property.Get< float >() ); + actor.SetColorBlue(property.Get()); break; } @@ -352,55 +349,55 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::OPACITY: { float value; - if( property.Get( value ) ) + if(property.Get(value)) { - actor.SetOpacity( value ); + actor.SetOpacity(value); } break; } case Dali::Actor::Property::NAME: { - actor.SetName( property.Get< std::string >() ); + actor.SetName(property.Get()); break; } case Dali::Actor::Property::SENSITIVE: { - actor.SetSensitive( property.Get< bool >() ); + actor.SetSensitive(property.Get()); break; } case Dali::Actor::Property::LEAVE_REQUIRED: { - actor.SetLeaveRequired( property.Get< bool >() ); + actor.SetLeaveRequired(property.Get()); break; } case Dali::Actor::Property::INHERIT_POSITION: { - actor.SetInheritPosition( property.Get< bool >() ); + actor.SetInheritPosition(property.Get()); break; } case Dali::Actor::Property::INHERIT_ORIENTATION: { - actor.SetInheritOrientation( property.Get< bool >() ); + actor.SetInheritOrientation(property.Get()); break; } case Dali::Actor::Property::INHERIT_SCALE: { - actor.SetInheritScale( property.Get< bool >() ); + actor.SetInheritScale(property.Get()); break; } case Dali::Actor::Property::COLOR_MODE: { ColorMode mode = actor.mColorMode; - if ( Scripting::GetEnumerationProperty< ColorMode >( property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) ) + if(Scripting::GetEnumerationProperty(property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode)) { - actor.SetColorMode( mode ); + actor.SetColorMode(mode); } break; } @@ -408,35 +405,35 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::DRAW_MODE: { DrawMode::Type mode = actor.mDrawMode; - if( Scripting::GetEnumerationProperty< DrawMode::Type >( property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) ) + if(Scripting::GetEnumerationProperty(property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode)) { - actor.SetDrawMode( mode ); + actor.SetDrawMode(mode); } break; } case Dali::Actor::Property::SIZE_MODE_FACTOR: { - actor.SetSizeModeFactor( property.Get< Vector3 >() ); + actor.SetSizeModeFactor(property.Get()); break; } case Dali::Actor::Property::WIDTH_RESIZE_POLICY: { - ResizePolicy::Type type = actor.GetResizePolicy( Dimension::WIDTH ); - if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) ) + ResizePolicy::Type type = actor.GetResizePolicy(Dimension::WIDTH); + if(Scripting::GetEnumerationProperty(property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type)) { - actor.SetResizePolicy( type, Dimension::WIDTH ); + actor.SetResizePolicy(type, Dimension::WIDTH); } break; } case Dali::Actor::Property::HEIGHT_RESIZE_POLICY: { - ResizePolicy::Type type = actor.GetResizePolicy( Dimension::HEIGHT ); - if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) ) + ResizePolicy::Type type = actor.GetResizePolicy(Dimension::HEIGHT); + if(Scripting::GetEnumerationProperty(property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type)) { - actor.SetResizePolicy( type, Dimension::HEIGHT ); + actor.SetResizePolicy(type, Dimension::HEIGHT); } break; } @@ -444,52 +441,52 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::SIZE_SCALE_POLICY: { SizeScalePolicy::Type type = actor.GetSizeScalePolicy(); - if( Scripting::GetEnumerationProperty< SizeScalePolicy::Type >( property, SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type ) ) + if(Scripting::GetEnumerationProperty(property, SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type)) { - actor.SetSizeScalePolicy( type ); + actor.SetSizeScalePolicy(type); } break; } case Dali::Actor::Property::WIDTH_FOR_HEIGHT: { - if( property.Get< bool >() ) + if(property.Get()) { - actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH ); + actor.SetResizePolicy(ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH); } break; } case Dali::Actor::Property::HEIGHT_FOR_WIDTH: { - if( property.Get< bool >() ) + if(property.Get()) { - actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); + actor.SetResizePolicy(ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT); } break; } case Dali::Actor::Property::PADDING: { - Vector4 padding = property.Get< Vector4 >(); - actor.SetPadding( Vector2( padding.x, padding.y ), Dimension::WIDTH ); - actor.SetPadding( Vector2( padding.z, padding.w ), Dimension::HEIGHT ); + Vector4 padding = property.Get(); + actor.SetPadding(Vector2(padding.x, padding.y), Dimension::WIDTH); + actor.SetPadding(Vector2(padding.z, padding.w), Dimension::HEIGHT); break; } case Dali::Actor::Property::MINIMUM_SIZE: { - Vector2 size = property.Get< Vector2 >(); - actor.SetMinimumSize( size.x, Dimension::WIDTH ); - actor.SetMinimumSize( size.y, Dimension::HEIGHT ); + Vector2 size = property.Get(); + actor.SetMinimumSize(size.x, Dimension::WIDTH); + actor.SetMinimumSize(size.y, Dimension::HEIGHT); break; } case Dali::Actor::Property::MAXIMUM_SIZE: { - Vector2 size = property.Get< Vector2 >(); - actor.SetMaximumSize( size.x, Dimension::WIDTH ); - actor.SetMaximumSize( size.y, Dimension::HEIGHT ); + Vector2 size = property.Get(); + actor.SetMaximumSize(size.x, Dimension::WIDTH); + actor.SetMaximumSize(size.y, Dimension::HEIGHT); break; } @@ -497,9 +494,9 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert { int value; - if( property.Get( value ) ) + if(property.Get(value)) { - actor.SetSiblingOrder( value ); + actor.SetSiblingOrder(value); } break; } @@ -507,10 +504,10 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::CLIPPING_MODE: { ClippingMode::Type convertedValue = actor.mClippingMode; - if( Scripting::GetEnumerationProperty< ClippingMode::Type >( property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue ) ) + if(Scripting::GetEnumerationProperty(property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue)) { actor.mClippingMode = convertedValue; - SetClippingModeMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mClippingMode ); + SetClippingModeMessage(actor.GetEventThreadServices(), actor.GetNode(), actor.mClippingMode); } break; } @@ -518,10 +515,10 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::POSITION_USES_ANCHOR_POINT: { bool value = false; - if( property.Get( value ) && value != actor.mPositionUsesAnchorPoint ) + if(property.Get(value) && value != actor.mPositionUsesAnchorPoint) { actor.mPositionUsesAnchorPoint = value; - SetPositionUsesAnchorPointMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mPositionUsesAnchorPoint ); + SetPositionUsesAnchorPointMessage(actor.GetEventThreadServices(), actor.GetNode(), actor.mPositionUsesAnchorPoint); } break; } @@ -529,11 +526,11 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::LAYOUT_DIRECTION: { Dali::LayoutDirection::Type direction = actor.mLayoutDirection; - actor.mInheritLayoutDirection = false; + actor.mInheritLayoutDirection = false; - if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) + if(Scripting::GetEnumerationProperty(property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction)) { - actor.InheritLayoutDirectionRecursively( &actor, direction, true ); + actor.InheritLayoutDirectionRecursively(&actor, direction, true); } break; } @@ -541,9 +538,9 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION: { bool value = false; - if( property.Get( value ) ) + if(property.Get(value)) { - actor.SetInheritLayoutDirection( value ); + actor.SetInheritLayoutDirection(value); } break; } @@ -551,40 +548,39 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert case Dali::Actor::Property::KEYBOARD_FOCUSABLE: { bool value = false; - if( property.Get( value ) ) + if(property.Get(value)) { - actor.SetKeyboardFocusable( value ); + actor.SetKeyboardFocusable(value); } break; } case Dali::DevelActor::Property::UPDATE_SIZE_HINT: { - actor.SetUpdateSizeHint( property.Get< Vector2 >() ); + actor.SetUpdateSizeHint(property.Get()); break; } case Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START: { bool boolValue = false; - if ( property.Get( boolValue ) ) + if(property.Get(boolValue)) { actor.mCaptureAllTouchAfterStart = boolValue; } break; } - case Dali::DevelActor::Property::TOUCH_AREA: + case Dali::DevelActor::Property::TOUCH_AREA_OFFSET: { - Vector2 vec2Value; - if( property.Get( vec2Value ) ) + Rect rectValue; + if(property.Get(rectValue)) { - actor.SetTouchArea( vec2Value ); + actor.SetTouchAreaOffset(rectValue); } break; } - default: { // this can happen in the case of a non-animatable default property so just do nothing @@ -594,64 +590,64 @@ void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Propert } void Actor::PropertyHandler::SetSceneGraphProperty( - Property::Index index, - const PropertyMetadata& entry, - const Property::Value& value, - EventThreadServices& eventThreadServices, - const SceneGraph::Node& node) + Property::Index index, + const PropertyMetadata& entry, + const Property::Value& value, + EventThreadServices& eventThreadServices, + const SceneGraph::Node& node) { - switch( entry.GetType() ) + switch(entry.GetType()) { case Property::BOOLEAN: { - const AnimatableProperty< bool >* property = dynamic_cast< const AnimatableProperty< bool >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } case Property::INTEGER: { - const AnimatableProperty< int >* property = dynamic_cast< const AnimatableProperty< int >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } case Property::FLOAT: { - const AnimatableProperty< float >* property = dynamic_cast< const AnimatableProperty< float >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } case Property::VECTOR2: { - const AnimatableProperty< Vector2 >* property = dynamic_cast< const AnimatableProperty< Vector2 >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property if(entry.componentIndex == 0) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get()); } else if(entry.componentIndex == 1) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get()); } else { - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); } break; @@ -659,25 +655,25 @@ void Actor::PropertyHandler::SetSceneGraphProperty( case Property::VECTOR3: { - const AnimatableProperty< Vector3 >* property = dynamic_cast< const AnimatableProperty< Vector3 >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property if(entry.componentIndex == 0) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get()); } else if(entry.componentIndex == 1) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get()); } else if(entry.componentIndex == 2) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeZ, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeZ, value.Get()); } else { - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); } break; @@ -685,29 +681,29 @@ void Actor::PropertyHandler::SetSceneGraphProperty( case Property::VECTOR4: { - const AnimatableProperty< Vector4 >* property = dynamic_cast< const AnimatableProperty< Vector4 >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property if(entry.componentIndex == 0) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeX, value.Get()); } else if(entry.componentIndex == 1) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeY, value.Get()); } else if(entry.componentIndex == 2) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeZ, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeZ, value.Get()); } else if(entry.componentIndex == 3) { - SceneGraph::NodePropertyComponentMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::BakeW, value.Get() ); + SceneGraph::NodePropertyComponentMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::BakeW, value.Get()); } else { - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); } break; @@ -715,33 +711,33 @@ void Actor::PropertyHandler::SetSceneGraphProperty( case Property::ROTATION: { - const AnimatableProperty< Quaternion >* property = dynamic_cast< const AnimatableProperty< Quaternion >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property,&AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } case Property::MATRIX: { - const AnimatableProperty< Matrix >* property = dynamic_cast< const AnimatableProperty< Matrix >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property,&AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } case Property::MATRIX3: { - const AnimatableProperty< Matrix3 >* property = dynamic_cast< const AnimatableProperty< Matrix3 >* >( entry.GetSceneGraphProperty() ); - DALI_ASSERT_DEBUG( NULL != property ); + const AnimatableProperty* property = dynamic_cast*>(entry.GetSceneGraphProperty()); + DALI_ASSERT_DEBUG(NULL != property); // property is being used in a separate thread; queue a message to set the property - SceneGraph::NodePropertyMessage::Send( eventThreadServices, &node, property,&AnimatableProperty::Bake, value.Get() ); + SceneGraph::NodePropertyMessage::Send(eventThreadServices, &node, property, &AnimatableProperty::Bake, value.Get()); break; } @@ -755,153 +751,153 @@ void Actor::PropertyHandler::SetSceneGraphProperty( void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& actor, Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) { - switch( animationType ) + switch(animationType) { case Animation::TO: case Animation::BETWEEN: { - switch( index ) + switch(index) { case Dali::Actor::Property::SIZE: { - if( value.Get( actor.mTargetSize ) ) + if(value.Get(actor.mTargetSize)) { - actor.mAnimatedSize = actor.mTargetSize; + actor.mAnimatedSize = actor.mTargetSize; actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_WIDTH: { - if( value.Get( actor.mTargetSize.width ) ) + if(value.Get(actor.mTargetSize.width)) { actor.mAnimatedSize.width = actor.mTargetSize.width; actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_HEIGHT: { - if( value.Get( actor.mTargetSize.height ) ) + if(value.Get(actor.mTargetSize.height)) { actor.mAnimatedSize.height = actor.mTargetSize.height; actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_DEPTH: { - if( value.Get( actor.mTargetSize.depth ) ) + if(value.Get(actor.mTargetSize.depth)) { actor.mAnimatedSize.depth = actor.mTargetSize.depth; actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::POSITION: { - value.Get( actor.mTargetPosition ); + value.Get(actor.mTargetPosition); break; } case Dali::Actor::Property::POSITION_X: { - value.Get( actor.mTargetPosition.x ); + value.Get(actor.mTargetPosition.x); break; } case Dali::Actor::Property::POSITION_Y: { - value.Get( actor.mTargetPosition.y ); + value.Get(actor.mTargetPosition.y); break; } case Dali::Actor::Property::POSITION_Z: { - value.Get( actor.mTargetPosition.z ); + value.Get(actor.mTargetPosition.z); break; } case Dali::Actor::Property::ORIENTATION: { - value.Get( actor.mTargetOrientation ); + value.Get(actor.mTargetOrientation); break; } case Dali::Actor::Property::SCALE: { - value.Get( actor.mTargetScale ); + value.Get(actor.mTargetScale); break; } case Dali::Actor::Property::SCALE_X: { - value.Get( actor.mTargetScale.x ); + value.Get(actor.mTargetScale.x); break; } case Dali::Actor::Property::SCALE_Y: { - value.Get( actor.mTargetScale.y ); + value.Get(actor.mTargetScale.y); break; } case Dali::Actor::Property::SCALE_Z: { - value.Get( actor.mTargetScale.z ); + value.Get(actor.mTargetScale.z); break; } case Dali::Actor::Property::VISIBLE: { - actor.SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE ); + actor.SetVisibleInternal(value.Get(), SendMessage::FALSE); break; } case Dali::Actor::Property::COLOR: { - value.Get( actor.mTargetColor ); + value.Get(actor.mTargetColor); break; } case Dali::Actor::Property::COLOR_RED: { - value.Get( actor.mTargetColor.r ); + value.Get(actor.mTargetColor.r); break; } case Dali::Actor::Property::COLOR_GREEN: { - value.Get( actor.mTargetColor.g ); + value.Get(actor.mTargetColor.g); break; } case Dali::Actor::Property::COLOR_BLUE: { - value.Get( actor.mTargetColor.b ); + value.Get(actor.mTargetColor.b); break; } case Dali::Actor::Property::COLOR_ALPHA: case Dali::Actor::Property::OPACITY: { - value.Get( actor.mTargetColor.a ); + value.Get(actor.mTargetColor.a); break; } @@ -916,88 +912,88 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a case Animation::BY: { - switch( index ) + switch(index) { case Dali::Actor::Property::SIZE: { - if( AdjustValue< Vector3 >( actor.mTargetSize, value ) ) + if(AdjustValue(actor.mTargetSize, value)) { - actor.mAnimatedSize = actor.mTargetSize; + actor.mAnimatedSize = actor.mTargetSize; actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_WIDTH: { - if( AdjustValue< float >( actor.mTargetSize.width, value ) ) + if(AdjustValue(actor.mTargetSize.width, value)) { actor.mAnimatedSize.width = actor.mTargetSize.width; actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_HEIGHT: { - if( AdjustValue< float >( actor.mTargetSize.height, value ) ) + if(AdjustValue(actor.mTargetSize.height, value)) { actor.mAnimatedSize.height = actor.mTargetSize.height; actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::SIZE_DEPTH: { - if( AdjustValue< float >( actor.mTargetSize.depth, value ) ) + if(AdjustValue(actor.mTargetSize.depth, value)) { actor.mAnimatedSize.depth = actor.mTargetSize.depth; actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH; // Notify deriving classes - actor.OnSizeAnimation( animation, actor.mTargetSize ); + actor.OnSizeAnimation(animation, actor.mTargetSize); } break; } case Dali::Actor::Property::POSITION: { - AdjustValue< Vector3 >( actor.mTargetPosition, value ); + AdjustValue(actor.mTargetPosition, value); break; } case Dali::Actor::Property::POSITION_X: { - AdjustValue< float >( actor.mTargetPosition.x, value ); + AdjustValue(actor.mTargetPosition.x, value); break; } case Dali::Actor::Property::POSITION_Y: { - AdjustValue< float >( actor.mTargetPosition.y, value ); + AdjustValue(actor.mTargetPosition.y, value); break; } case Dali::Actor::Property::POSITION_Z: { - AdjustValue< float >( actor.mTargetPosition.z, value ); + AdjustValue(actor.mTargetPosition.z, value); break; } case Dali::Actor::Property::ORIENTATION: { Quaternion relativeValue; - if( value.Get( relativeValue ) ) + if(value.Get(relativeValue)) { actor.mTargetOrientation *= relativeValue; } @@ -1006,67 +1002,67 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a case Dali::Actor::Property::SCALE: { - AdjustValue< Vector3 >( actor.mTargetScale, value ); + AdjustValue(actor.mTargetScale, value); break; } case Dali::Actor::Property::SCALE_X: { - AdjustValue< float >( actor.mTargetScale.x, value ); + AdjustValue(actor.mTargetScale.x, value); break; } case Dali::Actor::Property::SCALE_Y: { - AdjustValue< float >( actor.mTargetScale.y, value ); + AdjustValue(actor.mTargetScale.y, value); break; } case Dali::Actor::Property::SCALE_Z: { - AdjustValue< float >( actor.mTargetScale.z, value ); + AdjustValue(actor.mTargetScale.z, value); break; } case Dali::Actor::Property::VISIBLE: { bool relativeValue = false; - if( value.Get( relativeValue ) ) + if(value.Get(relativeValue)) { bool visible = actor.mVisible || relativeValue; - actor.SetVisibleInternal( visible, SendMessage::FALSE ); + actor.SetVisibleInternal(visible, SendMessage::FALSE); } break; } case Dali::Actor::Property::COLOR: { - AdjustValue< Vector4 >( actor.mTargetColor, value ); + AdjustValue(actor.mTargetColor, value); break; } case Dali::Actor::Property::COLOR_RED: { - AdjustValue< float >( actor.mTargetColor.r, value ); + AdjustValue(actor.mTargetColor.r, value); break; } case Dali::Actor::Property::COLOR_GREEN: { - AdjustValue< float >( actor.mTargetColor.g, value ); + AdjustValue(actor.mTargetColor.g, value); break; } case Dali::Actor::Property::COLOR_BLUE: { - AdjustValue< float >( actor.mTargetColor.b, value ); + AdjustValue(actor.mTargetColor.b, value); break; } case Dali::Actor::Property::COLOR_ALPHA: case Dali::Actor::Property::OPACITY: { - AdjustValue< float >( actor.mTargetColor.a, value ); + AdjustValue(actor.mTargetColor.a, value); break; } @@ -1083,9 +1079,9 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a const PropertyBase* Actor::PropertyHandler::GetSceneObjectAnimatableProperty(Property::Index index, const SceneGraph::Node& node) { - const PropertyBase* property( nullptr ); + const PropertyBase* property(nullptr); - switch( index ) + switch(index) { case Dali::Actor::Property::SIZE: // FALLTHROUGH case Dali::Actor::Property::SIZE_WIDTH: // FALLTHROUGH @@ -1142,9 +1138,9 @@ const PropertyBase* Actor::PropertyHandler::GetSceneObjectAnimatableProperty(Pro const PropertyInputImpl* Actor::PropertyHandler::GetSceneObjectInputProperty(Property::Index index, const SceneGraph::Node& node) { - const PropertyInputImpl* property( nullptr ); + const PropertyInputImpl* property(nullptr); - switch( index ) + switch(index) { case Dali::Actor::Property::PARENT_ORIGIN: // FALLTHROUGH case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH @@ -1208,7 +1204,7 @@ int32_t Actor::PropertyHandler::GetPropertyComponentIndex(Property::Index index) { int32_t componentIndex = Property::INVALID_COMPONENT_INDEX; - switch( index ) + switch(index) { case Dali::Actor::Property::PARENT_ORIGIN_X: case Dali::Actor::Property::ANCHOR_POINT_X: @@ -1267,7 +1263,7 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor { bool valueSet = true; - switch( index ) + switch(index) { case Dali::Actor::Property::PARENT_ORIGIN: { @@ -1488,13 +1484,13 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor case Dali::Actor::Property::WIDTH_RESIZE_POLICY: { - value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::WIDTH ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT ); + value = Scripting::GetLinearEnumerationName(actor.GetResizePolicy(Dimension::WIDTH), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT); break; } case Dali::Actor::Property::HEIGHT_RESIZE_POLICY: { - value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::HEIGHT ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT ); + value = Scripting::GetLinearEnumerationName(actor.GetResizePolicy(Dimension::HEIGHT), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT); break; } @@ -1506,33 +1502,33 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor case Dali::Actor::Property::WIDTH_FOR_HEIGHT: { - value = ( actor.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT ); + value = (actor.GetResizePolicy(Dimension::WIDTH) == ResizePolicy::DIMENSION_DEPENDENCY) && (actor.GetDimensionDependency(Dimension::WIDTH) == Dimension::HEIGHT); break; } case Dali::Actor::Property::HEIGHT_FOR_WIDTH: { - value = ( actor.GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH ); + value = (actor.GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::DIMENSION_DEPENDENCY) && (actor.GetDimensionDependency(Dimension::HEIGHT) == Dimension::WIDTH); break; } case Dali::Actor::Property::PADDING: { - Vector2 widthPadding = actor.GetPadding( Dimension::WIDTH ); - Vector2 heightPadding = actor.GetPadding( Dimension::HEIGHT ); - value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y ); + Vector2 widthPadding = actor.GetPadding(Dimension::WIDTH); + Vector2 heightPadding = actor.GetPadding(Dimension::HEIGHT); + value = Vector4(widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y); break; } case Dali::Actor::Property::MINIMUM_SIZE: { - value = Vector2( actor.GetMinimumSize( Dimension::WIDTH ), actor.GetMinimumSize( Dimension::HEIGHT ) ); + value = Vector2(actor.GetMinimumSize(Dimension::WIDTH), actor.GetMinimumSize(Dimension::HEIGHT)); break; } case Dali::Actor::Property::MAXIMUM_SIZE: { - value = Vector2( actor.GetMaximumSize( Dimension::WIDTH ), actor.GetMaximumSize( Dimension::HEIGHT ) ); + value = Vector2(actor.GetMaximumSize(Dimension::WIDTH), actor.GetMaximumSize(Dimension::HEIGHT)); break; } @@ -1544,7 +1540,7 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor case Dali::DevelActor::Property::SIBLING_ORDER: { - value = static_cast( actor.GetSiblingOrder() ); + value = static_cast(actor.GetSiblingOrder()); break; } @@ -1574,7 +1570,7 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor case Dali::Actor::Property::ID: { - value = static_cast( actor.GetId() ); + value = static_cast(actor.GetId()); break; } @@ -1614,9 +1610,9 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor break; } - case Dali::DevelActor::Property::TOUCH_AREA: + case Dali::DevelActor::Property::TOUCH_AREA_OFFSET: { - value = actor.GetTouchArea(); + value = actor.GetTouchAreaOffset(); break; } @@ -1635,7 +1631,7 @@ bool Actor::PropertyHandler::GetCurrentPropertyValue(const Internal::Actor& acto { bool valueSet = true; - switch( index ) + switch(index) { case Dali::Actor::Property::SIZE: { @@ -1802,14 +1798,14 @@ bool Actor::PropertyHandler::GetCurrentPropertyValue(const Internal::Actor& acto case Dali::Actor::Property::CULLED: { - value = actor.GetNode().IsCulled( actor.GetEventThreadServices().GetEventBufferIndex() ); + value = actor.GetNode().IsCulled(actor.GetEventThreadServices().GetEventBufferIndex()); break; } case Dali::DevelActor::Property::UPDATE_SIZE_HINT: { // node is being used in a separate thread, the value from the previous update is the same, set by user - value = Vector2( actor.GetNode().GetUpdateSizeHint() ); + value = Vector2(actor.GetNode().GetUpdateSizeHint()); break; } diff --git a/dali/internal/event/events/ray-test.cpp b/dali/internal/event/events/ray-test.cpp old mode 100755 new mode 100644 index 69a947a..9f3aa92 --- a/dali/internal/event/events/ray-test.cpp +++ b/dali/internal/event/events/ray-test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,27 +19,25 @@ #include // INTERNAL INCLUDES -#include -#include -#include #include #include #include +#include +#include +#include using Dali::Internal::SceneGraph::Node; namespace Dali { - namespace Internal { - RayTest::RayTest() -: mEventThreadServices( EventThreadServices::Get() ) +: mEventThreadServices(EventThreadServices::Get()) { } -bool RayTest::SphereTest( const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir ) const +bool RayTest::SphereTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir) const { /* http://wiki.cgsociety.org/index.php/Ray_Sphere_Intersection @@ -102,34 +100,34 @@ bool RayTest::SphereTest( const Internal::Actor& actor, const Vector4& rayOrigin */ // Early out if not on the scene - if( ! actor.OnScene() ) + if(!actor.OnScene()) { return false; } - const Node& node = actor.GetNode(); - const BufferIndex bufferIndex = EventThreadServices::Get().GetEventBufferIndex(); - const Vector3& translation = node.GetWorldPosition( bufferIndex ); - const Vector3& size = node.GetSize( bufferIndex ); - const Vector3& scale = node.GetWorldScale( bufferIndex ); + const Node& node = actor.GetNode(); + const BufferIndex bufferIndex = EventThreadServices::Get().GetEventBufferIndex(); + const Vector3& translation = node.GetWorldPosition(bufferIndex); + const Vector3& size = node.GetSize(bufferIndex); + const Vector3& scale = node.GetWorldScale(bufferIndex); + const Rect& touchAreaOffset = actor.GetTouchAreaOffset(); // (left, right, bottom, top) // Transforms the ray to the local reference system. As the test is against a sphere, only the translation and scale are needed. - const Vector3 rayOriginLocal( rayOrigin.x - translation.x, rayOrigin.y - translation.y, rayOrigin.z - translation.z ); + const Vector3 rayOriginLocal(rayOrigin.x - translation.x - (touchAreaOffset.left + touchAreaOffset.right) * 0.5, rayOrigin.y - translation.y - (touchAreaOffset.top + touchAreaOffset.bottom) * 0.5, rayOrigin.z - translation.z); // Computing the radius is not needed, a square radius is enough so can just use size but we do need to scale the sphere - const float width = size.width * scale.width; - const float height = size.height * scale.height; + const float width = size.width * scale.width + touchAreaOffset.right - touchAreaOffset.left; + const float height = size.height * scale.height + touchAreaOffset.bottom - touchAreaOffset.top; - float squareSphereRadius = 0.5f * ( width * width + height * height ); + float squareSphereRadius = 0.5f * (width * width + height * height); - float a = rayDir.Dot( rayDir ); // a - float b2 = rayDir.Dot( rayOriginLocal ); // b/2 - float c = rayOriginLocal.Dot( rayOriginLocal ) - squareSphereRadius; // c + float a = rayDir.Dot(rayDir); // a + float b2 = rayDir.Dot(rayOriginLocal); // b/2 + float c = rayOriginLocal.Dot(rayOriginLocal) - squareSphereRadius; // c - return ( b2 * b2 - a * c ) >= 0.0f; + return (b2 * b2 - a * c) >= 0.0f; } - bool RayTest::ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir, Vector2& hitPointLocal, float& distance) const { bool hit = false; @@ -140,7 +138,7 @@ bool RayTest::ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, // Transforms the ray to the local reference system. // Calculate the inverse of Model matrix - Matrix invModelMatrix( false/*don't init*/); + Matrix invModelMatrix(false /*don't init*/); invModelMatrix = node.GetWorldMatrix(0); invModelMatrix.Invert(); @@ -151,17 +149,18 @@ bool RayTest::ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, float a = -rayOriginLocal.z; float b = rayDirLocal.z; - if( fabsf( b ) > Math::MACHINE_EPSILON_1 ) + if(fabsf(b) > Math::MACHINE_EPSILON_1) { // Ray travels distance * rayDirLocal to intersect with plane. distance = a / b; - const Vector2& size = actor.GetTouchArea() == Vector2::ZERO ? Vector2(node.GetSize(EventThreadServices::Get().GetEventBufferIndex())) : actor.GetTouchArea(); - hitPointLocal.x = rayOriginLocal.x + rayDirLocal.x * distance + size.x * 0.5f; - hitPointLocal.y = rayOriginLocal.y + rayDirLocal.y * distance + size.y * 0.5f; + const Vector2& size = Vector2(node.GetSize(EventThreadServices::Get().GetEventBufferIndex())); + const Rect& touchAreaOffset = actor.GetTouchAreaOffset(); // (left, right, bottom, top) + hitPointLocal.x = rayOriginLocal.x + rayDirLocal.x * distance + size.x * 0.5f; + hitPointLocal.y = rayOriginLocal.y + rayDirLocal.y * distance + size.y * 0.5f; // Test with the actor's geometry. - hit = (hitPointLocal.x >= 0.f) && (hitPointLocal.x <= size.x) && (hitPointLocal.y >= 0.f) && (hitPointLocal.y <= size.y); + hit = (hitPointLocal.x >= touchAreaOffset.left) && (hitPointLocal.x <= (size.x + touchAreaOffset.right) && (hitPointLocal.y >= touchAreaOffset.top) && (hitPointLocal.y <= (size.y + touchAreaOffset.bottom))); } }