projects
/
platform
/
core
/
uifw
/
dali-demo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DALi Version 1.4.17
[platform/core/uifw/dali-demo.git]
/
examples
/
magnifier
/
magnifier-example.cpp
diff --git
a/examples/magnifier/magnifier-example.cpp
b/examples/magnifier/magnifier-example.cpp
index
d20cd6b
..
d319540
100644
(file)
--- a/
examples/magnifier/magnifier-example.cpp
+++ b/
examples/magnifier/magnifier-example.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 201
4
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
7
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-26,8
+26,8
@@
using namespace Dali;
namespace
{
namespace
{
-const char* BACKGROUND_IMAGE( D
ALI
_IMAGE_DIR "background-magnifier.jpg" );
-const char* TOOLBAR_IMAGE( D
ALI
_IMAGE_DIR "top-bar.png" );
+const char* BACKGROUND_IMAGE( D
EMO
_IMAGE_DIR "background-magnifier.jpg" );
+const char* TOOLBAR_IMAGE( D
EMO
_IMAGE_DIR "top-bar.png" );
const char* APPLICATION_TITLE( "Magnifier Example" );
const Vector3 MAGNIFIER_SIZE(0.25f, 0.25f, 0.0f); ///< Magnifier sides should be 25% of the width of the stage
const float ANIMATION_DURATION(60.0f); ///< Run animation for a minute before repeating.
const char* APPLICATION_TITLE( "Magnifier Example" );
const Vector3 MAGNIFIER_SIZE(0.25f, 0.25f, 0.0f); ///< Magnifier sides should be 25% of the width of the stage
const float ANIMATION_DURATION(60.0f); ///< Run animation for a minute before repeating.
@@
-173,6
+173,7
@@
public:
: mApplication( application ),
mView(),
mAnimationTime(0.0f),
: mApplication( application ),
mView(),
mAnimationTime(0.0f),
+ mAnimationTimeProperty( Property::INVALID_INDEX ),
mMagnifierShown(false)
{
// Connect to the Application's Init signal
mMagnifierShown(false)
{
// Connect to the Application's Init signal
@@
-193,8
+194,6
@@
public:
*/
void Create( Application& application )
{
*/
void Create( Application& application )
{
- DemoHelper::RequestThemeChange();
-
Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
mStageSize = Stage::GetCurrent().GetSize();
Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
mStageSize = Stage::GetCurrent().GetSize();
@@
-215,7
+214,7
@@
public:
APPLICATION_TITLE );
mContent.SetLeaveRequired(true);
APPLICATION_TITLE );
mContent.SetLeaveRequired(true);
- mContent.Touch
ed
Signal().Connect( this, &ExampleController::OnTouched );
+ mContent.TouchSignal().Connect( this, &ExampleController::OnTouched );
// Create magnifier (controlled by human touch)
Layer overlay = Layer::New();
// Create magnifier (controlled by human touch)
Layer overlay = Layer::New();
@@
-225,9
+224,9
@@
public:
Stage::GetCurrent().Add(overlay);
mMagnifier = Toolkit::Magnifier::New();
Stage::GetCurrent().Add(overlay);
mMagnifier = Toolkit::Magnifier::New();
- mMagnifier.SetSourceActor( mView
.GetChildAt( 0 )
);
+ mMagnifier.SetSourceActor( mView );
mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
- mMagnifier.Set
MagnificationFactor(
MAGNIFICATION_FACTOR );
+ mMagnifier.Set
Property( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR,
MAGNIFICATION_FACTOR );
mMagnifier.SetScale(Vector3::ZERO);
overlay.Add( mMagnifier );
mMagnifier.SetScale(Vector3::ZERO);
overlay.Add( mMagnifier );
@@
-242,12
+241,12
@@
public:
// Create bouncing magnifier automatically bounces around screen.
mBouncingMagnifier = Toolkit::Magnifier::New();
// Create bouncing magnifier automatically bounces around screen.
mBouncingMagnifier = Toolkit::Magnifier::New();
- mBouncingMagnifier.SetSourceActor( mView
.GetChildAt( 0 )
);
+ mBouncingMagnifier.SetSourceActor( mView );
mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
- mBouncingMagnifier.Set
MagnificationFactor(
MAGNIFICATION_FACTOR );
+ mBouncingMagnifier.Set
Property( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR,
MAGNIFICATION_FACTOR );
overlay.Add( mBouncingMagnifier );
overlay.Add( mBouncingMagnifier );
- mAnimationTimeProperty = mBouncingMagnifier.RegisterProperty("animation
-time",
0.0f);
+ mAnimationTimeProperty = mBouncingMagnifier.RegisterProperty("animation
Time",
0.0f);
ContinueAnimation();
// Apply constraint to animate the position of the magnifier.
ContinueAnimation();
// Apply constraint to animate the position of the magnifier.
@@
-257,7
+256,7
@@
public:
constraint.Apply();
// Apply constraint to animate the source of the magnifier.
constraint.Apply();
// Apply constraint to animate the source of the magnifier.
- constraint = Constraint::New<Vector3>( mBouncingMagnifier,
mBouncingMagnifier.GetPropertyIndex( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME )
, MagnifierPathConstraint(mStageSize) );
+ constraint = Constraint::New<Vector3>( mBouncingMagnifier,
Toolkit::Magnifier::Property::SOURCE_POSITION
, MagnifierPathConstraint(mStageSize) );
constraint.AddSource( LocalSource(Actor::Property::SIZE) );
constraint.AddSource( LocalSource(mAnimationTimeProperty) );
constraint.Apply();
constraint.AddSource( LocalSource(Actor::Property::SIZE) );
constraint.AddSource( LocalSource(mAnimationTimeProperty) );
constraint.Apply();
@@
-302,33
+301,32
@@
public:
* @param[in] actor The actor that received the touch
* @param[in] event The touch-event information
*/
* @param[in] actor The actor that received the touch
* @param[in] event The touch-event information
*/
- bool OnTouched( Actor actor, const Touch
Event
& event )
+ bool OnTouched( Actor actor, const Touch
Data
& event )
{
if(event.GetPointCount() > 0)
{
{
if(event.GetPointCount() > 0)
{
- const TouchPoint& point = event.GetPoint(0);
- switch(point.state)
+ switch( event.GetState( 0 ) )
{
{
- case
TouchPoint::Down
:
- case
TouchPoint::Motion
:
+ case
PointState::DOWN
:
+ case
PointState::MOTION
:
{
ShowMagnifier();
break;
}
{
ShowMagnifier();
break;
}
- case
TouchPoint::Up
:
- case
TouchPoint::Leave
:
- case
TouchPoint::Interrupted
:
+ case
PointState::UP
:
+ case
PointState::LEAVE
:
+ case
PointState::INTERRUPTED
:
{
HideMagnifier();
break;
}
{
HideMagnifier();
break;
}
-
default
:
+
case PointState::STATIONARY
:
{
break;
}
} // end switch
{
break;
}
} // end switch
- Vector3 touchPoint(
point.screen
);
+ Vector3 touchPoint(
event.GetScreenPosition( 0 )
);
SetMagnifierPosition(touchPoint - mStageSize * 0.5f);
}
SetMagnifierPosition(touchPoint - mStageSize * 0.5f);
}
@@
-370,7
+368,7
@@
public:
*/
void SetMagnifierPosition(const Vector3 position)
{
*/
void SetMagnifierPosition(const Vector3 position)
{
- mMagnifier.Set
SourcePosition(
position );
+ mMagnifier.Set
Property( Toolkit::Magnifier::Property::SOURCE_POSITION,
position );
// position magnifier glass such that bottom edge is touching/near top of finger.
Vector3 glassPosition(position);
// position magnifier glass such that bottom edge is touching/near top of finger.
Vector3 glassPosition(position);
@@
-404,20
+402,10
@@
private:
};
};
-
void RunTest( Application& application
)
+
int DALI_EXPORT_API main( int argc, char **argv
)
{
{
+ Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
ExampleController test( application );
ExampleController test( application );
-
application.MainLoop();
application.MainLoop();
-}
-
-// Entry point for Linux & Tizen applications
-//
-int main( int argc, char **argv )
-{
- Application application = Application::New( &argc, &argv );
-
- RunTest( application );
-
return 0;
}
return 0;
}