namespace
{
-const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" );
-const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" );
-const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.9.png");
-const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.9.png");
+const std::string LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" );
+const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DEMO_IMAGE_DIR "top-bar.png" );
+const std::string TILE_BACKGROUND(DEMO_IMAGE_DIR "item-background.9.png");
+const std::string TILE_BACKGROUND_ALPHA(DEMO_IMAGE_DIR "item-background-alpha.9.png");
const char * const DEFAULT_TOOLBAR_TEXT( "TOUCH TO LAUNCH EXAMPLE" );
const Vector3& parentSize = inputs[1]->GetVector3();
const Vector3& childSize = inputs[2]->GetVector3();
- // Wrap bubbles verically.
- if( position.y + childSize.y * 0.5f < -parentSize.y * 0.5f )
- {
- position.y = parentSize.y * 0.5f + childSize.y * 0.5f;
- }
+ // Wrap bubbles vertically.
+ float range = parentSize.y + childSize.y;
+ // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).
+ position.y -= range * ( floor( position.y / range ) + 0.5f );
// Bubbles X position moves parallax to horizontal
// panning by a scale factor unique to each bubble.
mScrollView.SetAxisAutoLock( true );
mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
- mScrollView.TouchedSignal().Connect( this, &DaliTableView::OnScrollTouched );
+ mScrollView.TouchSignal().Connect( this, &DaliTableView::OnScrollTouched );
mScrollViewLayer = Layer::New();
unsigned int degrees = 0;
Rotate( degrees );
- //orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged );
-
winHandle.ShowIndicator( Dali::Window::INVISIBLE );
// Background animation
mScrollView.SetRulerY( mScrollRulerY );
}
-void DaliTableView::OrientationChanged( Orientation orientation )
-{
- // TODO: Implement if orientation change required
-}
-
void DaliTableView::Rotate( unsigned int degrees )
{
// Resize the root actor
content.Add( image );
// Add stencil
- ImageActor stencil = NewStencilImage();
+ Toolkit::ImageView stencil = NewStencilImage();
stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
image.Add( stencil );
}
content.SetKeyboardFocusable(true);
// connect to the touch events
- content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
+ content.TouchSignal().Connect( this, &DaliTableView::OnTilePressed );
content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
return content;
}
-ImageActor DaliTableView::NewStencilImage()
+Toolkit::ImageView DaliTableView::NewStencilImage()
{
- Image alpha = ResourceImage::New( TILE_BACKGROUND_ALPHA );
-
- ImageActor stencilActor = ImageActor::New( alpha );
+ Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA );
+ stencil.SetParentOrigin( ParentOrigin::CENTER );
+ stencil.SetAnchorPoint( AnchorPoint::CENTER );
+ stencil.SetDrawMode( DrawMode::STENCIL );
- stencilActor.SetParentOrigin( ParentOrigin::CENTER );
- stencilActor.SetAnchorPoint( AnchorPoint::CENTER );
- stencilActor.SetDrawMode( DrawMode::STENCIL );
+ Property::Map shaderEffect = CreateAlphaDiscardEffect();
+ stencil.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect );
- Dali::ShaderEffect shaderEffect = CreateAlphaDiscardEffect();
- stencilActor.SetShaderEffect( shaderEffect );
+ return stencil;
+}
- return stencilActor;
+bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event )
+{
+ return DoTilePress( actor, event.GetState( 0 ) );
}
-bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event )
+bool DaliTableView::DoTilePress( Actor actor, PointState::Type pointState )
{
bool consumed = false;
- const TouchPoint& point = event.GetPoint( 0 );
- if( TouchPoint::Down == point.state )
+ if( PointState::DOWN == pointState )
{
mPressedActor = actor;
consumed = true;
// A button press is only valid if the Down & Up events
// both occurred within the button.
- if( ( TouchPoint::Up == point.state ) &&
+ if( ( PointState::UP == pointState ) &&
( mPressedActor == actor ) )
{
// ignore Example button presses when scrolling or button animating.
std::string name = mPressedActor.GetName();
std::stringstream stream;
- stream << DALI_EXAMPLE_BIN << name.c_str();
+ stream << DEMO_EXAMPLE_BIN << name.c_str();
pid_t pid = fork();
if( pid == 0)
{
accessibilityManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
}
-bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
+bool DaliTableView::OnScrollTouched( Actor actor, const TouchData& event )
{
- const TouchPoint& point = event.GetPoint( 0 );
- if( TouchPoint::Down == point.state )
+ if( PointState::DOWN == event.GetState( 0 ) )
{
mPressedActor = actor;
}
animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) );
animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) );
+ animConstraint.SetRemoveAction( Constraint::Discard );
animConstraint.Apply();
// Kickoff animation
- Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );
- animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunction::LINEAR );
+ Animation animation = Animation::New( Random::Range( 30.0f, 160.0f ) );
+ animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -2000.0f, 0.0f ), AlphaFunction::LINEAR );
animation.SetLooping( true );
animation.Play();
mBackgroundAnimations.push_back( animation );
Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect();
dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect );
dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] );
+
layer.Add( dfActor );
}
ImageView DaliTableView::CreateLogo( std::string imagePath )
{
- Image image = ResourceImage::New( imagePath );
- ImageView logo = ImageView::New( image );
+ ImageView logo = ImageView::New( imagePath );
logo.SetAnchorPoint( AnchorPoint::CENTER );
logo.SetParentOrigin( ParentOrigin::CENTER );
mPressedActor = activatedActor;
// Activate the current focused actor;
- TouchEvent touchEventUp;
- touchEventUp.points.push_back( TouchPoint ( 0, TouchPoint::Up, 0.0f, 0.0f ) );
- OnTilePressed(mPressedActor, touchEventUp);
+ DoTilePress( mPressedActor, PointState::UP );
}
}