X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fmagnifier%2Fmagnifier-impl.cpp;h=0be5d46391210afbb7441f1162b33bc108e0c472;hp=e758f1fdcd2c1cfb3f3c8e640ff66efc7bac2d78;hb=f546dd5d83a968e573f8f053a01ce43df32c71a0;hpb=0031ca8312dba666109e4f7fbb62a3a5e288b7c2 diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index e758f1f..0be5d46 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,14 +21,18 @@ // EXTERNAL INCLUDES #include #include -#include +#include #include -#include #include -#include +#include +#include // INTERNAL INCLUDES -#include +#include +#include +#include +#include +#include namespace Dali { @@ -139,7 +143,7 @@ Dali::Toolkit::Magnifier Magnifier::New() } Magnifier::Magnifier() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ), +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mDefaultCameraDistance(1000.f), mActorSize(Vector3::ZERO), mMagnificationFactor(1.0f) @@ -168,7 +172,7 @@ void Magnifier::Initialize() // and what is not. mSourceActor = Actor::New(); Stage().GetCurrent().Add(mSourceActor); - mSourceActor.SetParentOrigin(ParentOrigin::CENTER); + mSourceActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER ); Constraint constraint = Constraint::New( mSourceActor, Actor::Property::POSITION, EqualToConstraint() ); constraint.AddSource( Source( self, Toolkit::Magnifier::Property::SOURCE_POSITION ) ); constraint.Apply(); @@ -216,6 +220,11 @@ void Magnifier::Initialize() constraint.AddSource( Source( self, Actor::Property::SIZE ) ); constraint.AddSource( Source( self, Actor::Property::WORLD_SCALE ) ); constraint.Apply(); + + DevelControl::SetAccessibilityConstructor( self, []( Dali::Actor actor ) { + return std::unique_ptr< Dali::Accessibility::Accessible >( + new Control::Impl::AccessibleImpl( actor, Dali::Accessibility::Role::FILLER ) ); + } ); } Magnifier::~Magnifier() @@ -255,16 +264,20 @@ void Magnifier::SetFrameVisibility(bool visible) Actor self(Self()); mFrame = Actor::New( ); - mFrame.SetPositionInheritanceMode(DONT_INHERIT_POSITION); - mFrame.SetInheritScale(true); + mFrame.SetProperty( Actor::Property::INHERIT_POSITION, false ); + mFrame.SetProperty( Actor::Property::INHERIT_SCALE, true ); mFrame.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); Vector3 sizeOffset(IMAGE_BORDER_INDENT*2.f - 2.f, IMAGE_BORDER_INDENT*2.f - 2.f, 0.0f); - mFrame.SetSizeModeFactor( sizeOffset ); + mFrame.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeOffset ); + + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); - //TODO Set the renderer onto the control self when Actor::RemoveRenderer is supported - Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get(); - Toolkit::ControlRenderer borderRenderer = rendererFactory.GetControlRenderer(IMAGE_BORDER_INDENT, Color::WHITE); - borderRenderer.SetOnStage( mFrame ); + Property::Map map; + map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::BORDER; + map[ Toolkit::BorderVisual::Property::COLOR ] = Color::WHITE; + map[ Toolkit::BorderVisual::Property::SIZE ] = IMAGE_BORDER_INDENT; + Toolkit::Visual::Base borderVisual = visualFactory.CreateVisual( map ); + Toolkit::GetImplementation(borderVisual).SetOnScene( mFrame ); Constraint constraint = Constraint::New( mFrame, Actor::Property::POSITION, EqualToConstraint() ); constraint.AddSource( ParentSource( Actor::Property::WORLD_POSITION ) ); @@ -287,6 +300,8 @@ void Magnifier::OnSizeSet(const Vector3& targetSize) // a constraint yet as Camera/CameraActor properties are not animatable/constrainable. mActorSize = targetSize; Update(); + + Control::OnSizeSet( targetSize ); } float Magnifier::GetMagnificationFactor() const @@ -307,7 +322,7 @@ void Magnifier::Update() // should be updated when: // Magnifier's world size/scale changes. Actor self(Self()); - Vector3 worldSize = mActorSize * self.GetCurrentWorldScale(); + Vector3 worldSize = mActorSize * self.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ); // Adjust field of view to scale content