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=e758f1fdcd2c1cfb3f3c8e640ff66efc7bac2d78;hp=bdc59ae0d22f4e90facc282168a30e2df2d9c244;hb=f3da11c2818c6d17706fbb2417f21b602b3190f5;hpb=85c8b711d555be339ec76c00e146a1d3051b5eb8 diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index bdc59ae..e758f1f 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -27,6 +27,9 @@ #include #include +// INTERNAL INCLUDES +#include + namespace Dali { @@ -47,16 +50,14 @@ Dali::BaseHandle Create() DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Magnifier, Toolkit::Control, Create ) -DALI_PROPERTY_REGISTRATION( Toolkit, Magnifier, "frame-visibility", BOOLEAN, FRAME_VISIBILITY ) -DALI_PROPERTY_REGISTRATION( Toolkit, Magnifier, "magnification-factor", FLOAT, MAGNIFICATION_FACTOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, Magnifier, "frameVisibility", BOOLEAN, FRAME_VISIBILITY ) +DALI_PROPERTY_REGISTRATION( Toolkit, Magnifier, "magnificationFactor", FLOAT, MAGNIFICATION_FACTOR ) -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Magnifier, "source-position", VECTOR3, SOURCE_POSITION ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Magnifier, "sourcePosition", VECTOR3, SOURCE_POSITION ) DALI_TYPE_REGISTRATION_END() -const char* DEFAULT_FRAME_IMAGE_PATH = DALI_IMAGE_DIR "magnifier-image-frame.png"; - -const float IMAGE_BORDER_INDENT = 14.0f; ///< Indent of border in pixels. +const float IMAGE_BORDER_INDENT = 5.0f; ///< Indent of border in pixels. struct CameraActorPositionConstraint { @@ -197,7 +198,7 @@ void Magnifier::Initialize() // Use a 1 frame delayed source position to determine the camera actor's position. // This is necessary as the viewport is determined by the Magnifier's Actor's World position (which is computed // at the end of the update cycle i.e. after constraints have been applied.) - //Property::Index propertySourcePositionDelayed = mCameraActor.RegisterProperty("delayed-source-position", Vector3::ZERO); + //Property::Index propertySourcePositionDelayed = mCameraActor.RegisterProperty("delayedSourcePosition", Vector3::ZERO); constraint = Constraint::New( mCameraActor, Actor::Property::POSITION, CameraActorPositionConstraint(stageSize, mDefaultCameraDistance) ); constraint.AddSource( Source( mSourceActor, Actor::Property::WORLD_POSITION ) ); @@ -253,21 +254,22 @@ void Magnifier::SetFrameVisibility(bool visible) { Actor self(Self()); - Image image = ResourceImage::New( DEFAULT_FRAME_IMAGE_PATH ); - mFrame = ImageActor::New( image ); - mFrame.SetDrawMode(DrawMode::OVERLAY); - mFrame.SetStyle( ImageActor::STYLE_NINE_PATCH ); + mFrame = Actor::New( ); mFrame.SetPositionInheritanceMode(DONT_INHERIT_POSITION); mFrame.SetInheritScale(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 ); + //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 ); + Constraint constraint = Constraint::New( mFrame, Actor::Property::POSITION, EqualToConstraint() ); constraint.AddSource( ParentSource( Actor::Property::WORLD_POSITION ) ); constraint.Apply(); - mFrame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT ); self.Add(mFrame); } else if(!visible && mFrame)