#include "shared/view.h"
#include <dali-toolkit/dali-toolkit.h>
-
+#include <dali-toolkit/devel-api/controls/magnifier/magnifier.h>
using namespace Dali;
namespace
*/
void Create( Application& application )
{
+ DemoHelper::RequestThemeChange();
+
Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
mStageSize = Stage::GetCurrent().GetSize();
// Create magnifier (controlled by human touch)
Layer overlay = Layer::New();
- overlay.SetRelayoutEnabled( false );
overlay.SetSensitive(false);
overlay.SetParentOrigin( ParentOrigin::CENTER );
overlay.SetSize(mStageSize);
Stage::GetCurrent().Add(overlay);
mMagnifier = Toolkit::Magnifier::New();
- mMagnifier.SetRelayoutEnabled( false );
- mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+ mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
mMagnifier.SetScale(Vector3::ZERO);
overlay.Add( mMagnifier );
// Apply constraint to animate the position of the magnifier.
- Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) );
+ Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(Vector3( 0.5f, 0.5f, 0.0f ), Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) );
constraint.AddSource( LocalSource(Actor::Property::SIZE) );
constraint.AddSource( LocalSource(Actor::Property::PARENT_ORIGIN) );
constraint.AddSource( LocalSource(Actor::Property::ANCHOR_POINT) );
// Create bouncing magnifier automatically bounces around screen.
mBouncingMagnifier = Toolkit::Magnifier::New();
- mBouncingMagnifier.SetRelayoutEnabled( false );
- mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+ mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
overlay.Add( mBouncingMagnifier );
if(!mMagnifierShown)
{
Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
- animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseIn);
+ animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunction::EASE_IN);
animation.Play();
mMagnifierShown = true;
}
if(mMagnifierShown)
{
Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
- animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunction::EASE_OUT);
animation.Play();
mMagnifierShown = false;
}
private:
Application& mApplication; ///< Application instance
- Toolkit::View mView; ///< The view
+ Toolkit::Control mView; ///< The view
Layer mContent; ///< The content layer
Toolkit::Magnifier mMagnifier; ///< The manually controlled magnifier
Toolkit::Magnifier mBouncingMagnifier; ///< The animating magnifier (swirly animation)