From: Paul Wisbey Date: Thu, 19 Mar 2015 11:04:03 +0000 (-0700) Subject: Merge "Alignment - Fix a pixel alignment issue with the center alignment." into new_text X-Git-Tag: dali_1.0.38~11^2~43 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=6b7d48695715c6f2292338fccbeeb02873d1f89d;hp=2e452b50f7b62e70b3c392898139049e261f3298 Merge "Alignment - Fix a pixel alignment issue with the center alignment." into new_text --- diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index aff9f85..5c19f09 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -24,12 +24,10 @@ SET(TC_SOURCES utc-Dali-JsonParser.cpp utc-Dali-KeyInputFocusManager.cpp utc-Dali-NavigationControl.cpp - utc-Dali-NavigationLayout.cpp utc-Dali-OverlayEffect.cpp utc-Dali-Page.cpp utc-Dali-PageTurnEffect.cpp utc-Dali-PageTurnView.cpp - utc-Dali-RollLayout.cpp utc-Dali-ScrollView.cpp utc-Dali-ShadowView.cpp utc-Dali-ShearEffect.cpp diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp index 185940d..28690e8 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-CubeTransitionEffect.cpp @@ -386,28 +386,28 @@ int UtcDaliCubeTransitionWaveEffectStartTransition(void) waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); waveEffect.SetTargetImage( imageActor ); waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -437,8 +437,8 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -446,8 +446,8 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -455,16 +455,16 @@ int UtcDaliCubeTransitionCrossEffectStartTransition(void) crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); crossEffect.SetTargetImage( imageActor ); crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -493,16 +493,16 @@ int UtcDaliCubeTransitionFoldEffectStartTransition(void) foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(true); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -510,16 +510,16 @@ int UtcDaliCubeTransitionFoldEffectStartTransition(void) foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(false); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(),fullBrightness, FLT_EPISILON, TEST_LOCATION ); foldEffect.SetTargetImage( imageActor ); foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2); Wait( application, TRANSITION_DURATION ); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -749,7 +749,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -759,7 +759,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -769,7 +769,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -779,7 +779,7 @@ int UtcDaliCubeTransitionWaveEffectStopTransition(void) waveEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -813,8 +813,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -825,8 +825,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -836,8 +836,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -847,8 +847,8 @@ int UtcDaliCubeTransitionCrossEffectStopTransition(void) crossEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; @@ -881,8 +881,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -892,8 +892,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -903,8 +903,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); @@ -914,8 +914,8 @@ int UtcDaliCubeTransitionFoldEffectStopTransition(void) foldEffect.StopTransition(); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); - DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); + DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION ); DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION ); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NavigationLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NavigationLayout.cpp deleted file mode 100644 index 6166183..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-NavigationLayout.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include // for FLT_MAX -#include -#include - -using namespace Dali; -using namespace Toolkit; - -namespace -{ -const unsigned int TOTAL_ITEM_NUMBER = 200; - - -// Implementation of ItemFactory for providing actors to ItemView -class TestItemFactory : public ItemFactory -{ -public: - - /** - * Constructor - * @param application class, stored as reference - */ - TestItemFactory() - { - } - -public: // From ItemFactory - - /** - * Query the number of items available from the factory. - * The maximum available item has an ID of GetNumberOfItems() - 1. - */ - virtual unsigned int GetNumberOfItems() - { - return TOTAL_ITEM_NUMBER; - } - - /** - * Create an Actor to represent a visible item. - * @param itemId - * @return the created actor. - */ - virtual Actor NewItem(unsigned int itemId) - { - // Create an test actor for this item - ImageActor actor = CreateSolidColorActor(Color::RED); - actor.SetSize(64.0f, 64.0f); - - return actor; - } -}; -} // namespace - - -// Positive test case for a method -int UtcDaliNavigationLayoutNew(void) -{ - ToolkitTestApplication application; - - // Create a navigation layout - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - DALI_TEST_CHECK(navigationLayout); - END_TEST; -} - -int UtcDaliNavigationLayoutColumns(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - - navigationLayout->SetNumberOfColumns(6); - // Check whether we get the correct number of columns - DALI_TEST_CHECK(navigationLayout->GetNumberOfColumns() == 6); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetOrientation(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetOrientation(ControlOrientation::Right); - DALI_TEST_CHECK(navigationLayout->GetOrientation() == ControlOrientation::Right); - END_TEST; -} - -int UtcDaliNavigationLayoutTestConstraintLeft(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*navigationLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - navigationLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and all of them is positioned at X = 0 - // and the series is monotonely decreasing. - int nonZeroXCount = 0; - int elementsFound = 0; - int wrongDirectionCount = 0; - float prevY = FLT_MAX; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.x != 0.0f) - { - nonZeroXCount++; - } - - if (pos.y >= prevY) - { - wrongDirectionCount++; - } - - prevY = pos.y; - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliNavigationLayoutTestConstraintRight(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*navigationLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - navigationLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and all of them is positioned at X = 0 - // and the series is monotonely increasing. - int nonZeroXCount = 0; - int elementsFound = 0; - int wrongDirectionCount = 0; - float prevY = -FLT_MAX; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.x != 0.0f) - { - nonZeroXCount++; - } - - if (pos.y <= prevY) - { - wrongDirectionCount++; - } - - prevY = pos.y; - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliNavigationLayoutTestConstraintUp(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*navigationLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - navigationLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and all of them is positioned at X = 0 - // and the series is monotonely decreasing. - int nonZeroYCount = 0; - int elementsFound = 0; - int wrongDirectionCount = 0; - float prevX = -FLT_MAX; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.y != 0.0f) - { - nonZeroYCount++; - } - - if (pos.x <= prevX) - { - wrongDirectionCount++; - } - - prevX = pos.x; - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliNavigationLayoutTestConstraintDown(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*navigationLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - navigationLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and all of them is positioned at X = 0 - // and the series is monotonely decreasing. - int nonZeroYCount = 0; - int elementsFound = 0; - int wrongDirectionCount = 0; - float prevX = FLT_MAX; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.y != 0.0f) - { - nonZeroYCount++; - } - - if (pos.x > prevX) - { - wrongDirectionCount++; - } - - prevX = pos.x; - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - - -int UtcDaliNavigationLayoutScrollDirection(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - navigationLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*navigationLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - navigationLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - ItemLayoutPtr layout = navigationLayout; - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - navigationLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == (180.0f - 45.0f)); - - navigationLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == -45.0f)); - - layout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == (270.0f - 45.0f)); - - navigationLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == (90.0f - 45.0f)); - - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetColumnSpacing(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 11.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetColumnSpacing(testValue); - DALI_TEST_CHECK(navigationLayout->GetColumnSpacing() == testValue); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetTopMargin(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 11.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetTopMargin(testValue); - DALI_TEST_CHECK(navigationLayout->GetTopMargin() == testValue); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetBottomMargin(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 12.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetBottomMargin(testValue); - DALI_TEST_CHECK(navigationLayout->GetBottomMargin() == testValue); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 15.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetScrollSpeedFactor(testValue); - DALI_TEST_CHECK(navigationLayout->GetScrollSpeedFactor() == testValue); - END_TEST; -} - -int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void) -{ - ToolkitTestApplication application; - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - const float testValue = 10.0f; - - navigationLayout->SetNumberOfColumns(6); - navigationLayout->SetMaximumSwipeSpeed(testValue); - DALI_TEST_CHECK(navigationLayout->GetMaximumSwipeSpeed() == testValue); - END_TEST; -} - -int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void) -{ - ToolkitTestApplication application; - - // Create a navigation layout - NavigationLayoutPtr navigationLayout = NavigationLayout::New(); - - // Set the flick animaiton duration - navigationLayout->SetItemFlickAnimationDuration(0.35f); - - // Check whether we get the correct flick animaiton duration - DALI_TEST_EQUALS( navigationLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliNavigationLayoutGetScrollToPosition(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - NavigationLayoutPtr layout = NavigationLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*layout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - layout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view. - std::vector indices; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - indices.push_back(i); - } - } - - try - { - if (!indices.empty()) - { - const unsigned int firstTargetIndex = indices[indices.size()-1]; - // scroll to last item - view.ScrollToItem(firstTargetIndex, 0.00f); - application.Render(16); // 60hz frames - - std::size_t moveCount = 0; - for(std::size_t i = 0; i < indices.size(); i++) - { - float layoutPosBefore = view.GetCurrentLayoutPosition(i); - view.ScrollToItem(indices[i], 0.0f); - - application.Render(16); // 60hz frame - - float layoutPosAfter = view.GetCurrentLayoutPosition(i); - - if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON) - { - ++moveCount; - } - } - - DALI_TEST_CHECK((moveCount == indices.size())); - } - } - catch(...) - { - tet_result(TET_FAIL); - } - - Stage::GetCurrent().Remove(view); - END_TEST; -} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RollLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RollLayout.cpp deleted file mode 100644 index 59fd84f..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-RollLayout.cpp +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const unsigned int TOTAL_ITEM_NUMBER = 200; - -Vector3 RollLayoutItemSizeFunction(float layoutWidth, float layoutHeight, float rowSpacing) -{ - float height = (layoutHeight - rowSpacing) * 0.5f; - return Vector3(layoutWidth, height, height); -} - -} // namespace - - -// Implementation of ItemFactory for providing actors to ItemView -class TestItemFactory : public ItemFactory -{ -public: - - /** - * Constructor - */ - TestItemFactory() - { - } - -public: // From ItemFactory - - /** - * Query the number of items available from the factory. - * The maximum available item has an ID of GetNumberOfItems() - 1. - */ - virtual unsigned int GetNumberOfItems() - { - return TOTAL_ITEM_NUMBER; - } - - /** - * Create an Actor to represent a visible item. - * @param itemId - * @return the created actor. - */ - virtual Actor NewItem(unsigned int itemId) - { - // Create an test actor for this item - ImageActor actor = CreateSolidColorActor(Color::RED); - actor.SetSize(64.0f, 64.0f); - return actor; - } -}; - -void dali_roll_layout_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void dali_roll_layout_cleanup(void) -{ - test_return_value = TET_PASS; -} - - - -int UtcDaliRollLayoutNew(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - DALI_TEST_CHECK(rollLayout); - END_TEST; -} - -int UtcDaliRollLayoutSetAndGetRowSpacing(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - // Set the row spacing - rollLayout->SetRowSpacing(10.0f); - - // Check whether we get the correct row spacing - DALI_TEST_EQUALS(rollLayout->GetRowSpacing(), 10.0f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliRollLayoutSetAndGetItemSizeFunction(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - // Set the item size function - rollLayout->SetItemSizeFunction(RollLayoutItemSizeFunction); - - // Check whether we get the correct item size function - DALI_TEST_CHECK(rollLayout->GetItemSizeFunction() == RollLayoutItemSizeFunction); - END_TEST; -} - -int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - // Set the scroll speed factor - rollLayout->SetScrollSpeedFactor(0.05f); - - // Check whether we get the correct scroll speed factor - DALI_TEST_EQUALS(rollLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - // Set the maximum swipe speed - rollLayout->SetMaximumSwipeSpeed(50.0f); - - // Check whether we get the correct maximum swipe speed - DALI_TEST_EQUALS(rollLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void) -{ - ToolkitTestApplication application; - - // Create a roll layout - RollLayoutPtr rollLayout = RollLayout::New(); - - // Set the flick animaiton duration - rollLayout->SetItemFlickAnimationDuration(0.35f); - - // Check whether we get the correct flick animaiton duration - DALI_TEST_EQUALS( rollLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliRollLayoutConstraintLeft(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - RollLayoutPtr rollLayout = RollLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*rollLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - rollLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliRollLayoutConstraintRight(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - RollLayoutPtr rollLayout = RollLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*rollLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - rollLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliRollLayoutConstraintUp(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - RollLayoutPtr rollLayout = RollLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*rollLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - rollLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliRollLayoutConstraintDown(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - RollLayoutPtr rollLayout = RollLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*rollLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - rollLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } - - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); - END_TEST; -} - -int UtcDaliRollLayoutScrollDirection(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - RollLayoutPtr rollLayout = RollLayout::New(); - - view.SetName("view actor"); - view.AddLayout(*rollLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - rollLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - ItemLayoutPtr layout = rollLayout; - - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } - - rollLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 0.0f); - - rollLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == 180.0f)); - - layout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 90.f); - - rollLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); - - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 270.0f); - - Stage::GetCurrent().Remove(view); - END_TEST; -} diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index ee0034e..7a90b2a 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -68,7 +68,7 @@ AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$enable_javascript = xyes]) # Tizen Profile options AC_ARG_ENABLE([profile], - [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,LITE,WEARABLE,TV], + [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV], [Select the variant of tizen])], [dali_profile=$enableval], [dali_profile=COMMON]) diff --git a/build/tizen/docs-internal/dali_internal.doxy b/build/tizen/docs-internal/dali_internal.doxy index 65c3807..b6cf664 100644 --- a/build/tizen/docs-internal/dali_internal.doxy +++ b/build/tizen/docs-internal/dali_internal.doxy @@ -560,7 +560,7 @@ INPUT = ../../../docs/content \ ../../../../dali-adaptor/plugins \ ../../../../dali-adaptor/platform-abstractions/interfaces \ ../../../../dali-adaptor/platform-abstractions/portable \ - ../../../../dali-adaptor/platform-abstractions/slp \ + ../../../../dali-adaptor/platform-abstractions/tizen \ ../../../dali-toolkit \ ../../../texture-atlas-exporter \ ../../../../dali/automated-tests \ diff --git a/build/tizen/docs/dali.doxy.in b/build/tizen/docs/dali.doxy.in index 92ff833..e072023 100644 --- a/build/tizen/docs/dali.doxy.in +++ b/build/tizen/docs/dali.doxy.in @@ -231,6 +231,10 @@ TAB_SIZE = 2 # newlines. ALIASES = +# Clip alias inserts the specified file between two text markers. +# EG: @clip{"button.h",public,private} +# Shows all lines between public and private *inclusive*. +ALIASES += clip{3}="\dontinclude \1 \n \skip \2 \n \until \3" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" @@ -859,7 +863,7 @@ EXCLUDE_SYMBOLS = DaliInternal \ # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = +EXAMPLE_PATH = @DOXYGEN_DOCS_DIR@/../ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -953,7 +957,7 @@ INLINE_SOURCES = NO # Fortran comments will always remain visible. # The default value is: YES. -STRIP_CODE_COMMENTS = YES +STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index 8949d3f..cbb33ea 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -57,8 +57,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp index cc84448..0221785 100644 --- a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp +++ b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp @@ -335,7 +335,6 @@ void BloomView::AllocateResources() mRenderDownsampledCamera.SetNearClippingPlane(1.0f); mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight); mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mRenderDownsampledCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Rotate to look at origin mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); @@ -345,7 +344,6 @@ void BloomView::AllocateResources() mRenderFullSizeCamera.SetNearClippingPlane(1.0f); mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height); mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mRenderFullSizeCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Rotate to look at origin float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f); mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale); diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp index 754cf8f..656781f 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp @@ -236,7 +236,7 @@ void CheckBoxButton::OnLabelSet() { label.SetParentOrigin( ParentOrigin::CENTER_RIGHT ); label.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - label.MoveBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + label.TranslateBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); if( IsDisabled() && GetDisabledBackgroundImage() ) { diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp index d279697..d1ccebd 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -161,7 +161,7 @@ void RadioButton::OnLabelSet() { label.SetParentOrigin( ParentOrigin::CENTER_RIGHT ); label.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - label.MoveBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + label.TranslateBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); if( IsSelected() ) { diff --git a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp index e17e9b5..d4daf3c 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp @@ -345,7 +345,7 @@ void Cluster::TransformChild( unsigned int index, const Vector3& position, const Animation animation = Animation::New(period.delaySeconds + period.durationSeconds); animation.AnimateTo( Property(child, Actor::Property::POSITION), position, AlphaFunctions::EaseOut, period); animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunctions::EaseOut, period); - animation.AnimateTo( Property(child, Actor::Property::ROTATION), rotation, AlphaFunctions::EaseOut, period); + animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunctions::EaseOut, period); animation.Play(); } } diff --git a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp index 5b9a1ea..1084302 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp @@ -328,7 +328,7 @@ void ClusterStyle::Apply( Actor actor, { actor.SetPosition( position ); actor.SetSize( size ); - actor.SetRotation( rotation ); + actor.SetOrientation( rotation ); actor.SetScale( scale ); } } diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index 8304e0e..d229ceb 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -465,7 +465,6 @@ void EffectsView::SetupCameras() mCameraForChildren.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraForChildren.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor mCameraForChildren.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosScale); - mCameraForChildren.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraForChildren.SetZ( mTargetSize.height * cameraPosScale ); } diff --git a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp index c1ce8b8..5a5e501 100644 --- a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp @@ -408,8 +408,6 @@ void GaussianBlurView::AllocateResources() mRenderDownsampledCamera.SetNearClippingPlane(1.0f); mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight); mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - // Point the camera back into the scene - mRenderDownsampledCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); @@ -422,8 +420,6 @@ void GaussianBlurView::AllocateResources() mRenderFullSizeCamera.SetNearClippingPlane(1.0f); mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height); mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - // Point the camera back into the scene - mRenderFullSizeCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f); mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale); diff --git a/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp index c5d9ef8..2dc796c 100644 --- a/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp @@ -524,7 +524,7 @@ void MaskedImageView::Initialize( unsigned int targetWidth, self.Add( mSourceImageActor ); mSourceImageActor.SetParentOrigin( ParentOrigin::CENTER ); mSourceImageActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); - mSourceImageActor.SetInheritRotation( false ); + mSourceImageActor.SetInheritOrientation( false ); mSourceImageActor.SetInheritScale( false ); mSourceImageActor.SetColorMode( USE_OWN_COLOR ); mSourceImageActor.SetSize( Vector3::ONE ); diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index 6f9ad18..7521051 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -263,7 +263,6 @@ void Magnifier::InitializeRenderTask() mCameraActor = CameraActor::New(); mCameraActor.SetType(Camera::FREE_LOOK); - mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Look at stage stage.Add(mCameraActor); mTask.SetCameraActor( mCameraActor ); diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp index d5f8b01..ef5c223 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp @@ -154,7 +154,7 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition, animation.AnimateTo( Property( mTurnEffect[mIndex], mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName() ), originalCenter, AlphaFunctions::EaseOut, PAGE_TURN_OVER_ANIMATION_DURATION*0.75f ); - animation.AnimateBy( Property( actor, Actor::Property::ROTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunctions::EaseOut ); + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunctions::EaseOut ); animation.Play(); ImageActor::DownCast(actor).SetCullFace( CullBack ); animation.FinishedSignal().Connect( this, &PageTurnPortraitView::OnTurnedOver ); diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 562b8d2..2f4ba6c 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -892,7 +892,7 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition ) GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint(); float distance = offset.Length(); - Constraint rotationConstraint = Constraint::New( Actor::Property::ROTATION, + Constraint rotationConstraint = Constraint::New( Actor::Property::ORIENTATION, Source( self, mPropertyPanDisplacement[mIndex] ), RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor])); mPanActor.ApplyConstraint( rotationConstraint ); diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp index e17f174..1dfced0 100755 --- a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp @@ -407,7 +407,7 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), ScrollBarInternalRotationConstraint( vertical ) ); mSlider.ApplyConstraint( constraint ); diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index e41568b..405e819 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -126,8 +126,7 @@ struct OvershootOverlayRotationConstraint const float parentOvershoot = parentOvershootProperty.GetFloat(); const Toolkit::ControlOrientation::Type& parentOrientation = static_cast(parentScrollDirection.z); - Quaternion rotation; - + float multiplier = 0; if(Toolkit::IsVertical(parentOrientation)) { if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1) @@ -135,21 +134,21 @@ struct OvershootOverlayRotationConstraint if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0) || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + multiplier = 0.5f; } else { - rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS); + multiplier = 1.5f; } } else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0) || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(0.0f, Vector3::ZAXIS); + multiplier = 0.0f; } else { - rotation = Quaternion(Math::PI, Vector3::ZAXIS); + multiplier = 1.0f; } } else @@ -159,24 +158,26 @@ struct OvershootOverlayRotationConstraint if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0) ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(Math::PI, Vector3::ZAXIS); + multiplier = 1.0f; } else { - rotation = Quaternion(0.0f, Vector3::ZAXIS); + multiplier = 0.0f; } } else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0) || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS); + multiplier = 1.5f; } else { - rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + multiplier = 0.5f; } } + Quaternion rotation( Radian( multiplier * Math::PI ), Vector3::ZAXIS ); + return rotation; } }; @@ -1580,7 +1581,7 @@ void ItemView::SetOvershootEnabled( bool enable ) mOvershootOverlay.ApplyConstraint(constraint); mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, ParentSource( mPropertyScrollDirection ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayRotationConstraint() ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp index 9cedb8c..b02d3fc 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp @@ -257,12 +257,12 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible ) const Vector3 parentSize = self.GetCurrentSize(); if(IsVertical()) { - mOvershootOverlay.SetRotation(Quaternion(0.0f, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation(Quaternion(0.0f, Vector3::ZAXIS)); mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth); } else { - mOvershootOverlay.SetRotation(Quaternion(1.5f * Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation(Quaternion(1.5f * Math::PI, Vector3::ZAXIS)); mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth); relativeOffset = Vector3(0.0f, 1.0f, 0.0f); } @@ -276,13 +276,13 @@ void ScrollOvershootEffectRipple::UpdateVisibility( bool visible ) const Vector3 parentSize = self.GetCurrentSize(); if(IsVertical()) { - mOvershootOverlay.SetRotation(Quaternion(Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation(Quaternion(Math::PI, Vector3::ZAXIS)); mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth); relativeOffset = Vector3(1.0f, 1.0f, 0.0f); } else { - mOvershootOverlay.SetRotation(Quaternion(0.5f * Math::PI, Vector3::ZAXIS)); + mOvershootOverlay.SetOrientation(Quaternion(0.5f * Math::PI, Vector3::ZAXIS)); mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth); relativeOffset = Vector3(1.0f, 0.0f, 0.0f); } diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp index 3758e07..ea529ff 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp @@ -241,7 +241,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, constraint.SetRemoveAction( Constraint::Discard ); child.ApplyConstraint( constraint ); - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource( Actor::Property::POSITION ), LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp index bed1846..938ba1c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp @@ -303,7 +303,7 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, { // Apply constraints to this actor // Constraint constraint; - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, Source(parentPage, Actor::Property::POSITION), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp index 483e0bd..27e43e1 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp @@ -259,7 +259,7 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, { // Apply constraints to this actor // Constraint constraint; - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp index 99a7ddf..b414458 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp @@ -349,7 +349,7 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, { // Apply constraints to this actor // Constraint constraint; - constraint = Constraint::New( Actor::Property::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index 9bc67c7..23f1f0f 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -249,7 +249,7 @@ void ShadowView::OnInitialize() // Target is constrained to point at the shadow plane origin mCameraActor.SetNearClippingPlane( 1.0f ); mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position - mCameraActor.SetRotation(Radian(Degree(180)), Vector3::YAXIS); + mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS); mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION); mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE, @@ -277,7 +277,7 @@ void ShadowView::OnInitialize() // Turn off inheritance to ensure filter renders properly mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION); - mBlurRootActor.SetInheritRotation(false); + mBlurRootActor.SetInheritOrientation(false); mBlurRootActor.SetInheritScale(false); mBlurRootActor.SetColorMode(USE_OWN_COLOR); @@ -315,10 +315,10 @@ void ShadowView::ConstrainCamera() // is under control of application, can't use transform inheritance) Constraint cameraOrientationConstraint = - Constraint::New ( Actor::Property::ROTATION, + Constraint::New ( Actor::Property::ORIENTATION, Source( mShadowPlane, Actor::Property::WORLD_POSITION ), Source( mPointLight, Actor::Property::WORLD_POSITION ), - Source( mShadowPlane, Actor::Property::WORLD_ROTATION ), + Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ), &LookAt ); mCameraActor.ApplyConstraint( cameraOrientationConstraint ); diff --git a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp index a9b3c9e..ee152de 100644 --- a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp +++ b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp @@ -300,7 +300,6 @@ void BlurTwoPassFilter::SetupCamera() mCameraForBlur.SetNearClippingPlane(1.0f); mCameraForBlur.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraForBlur.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mCameraForBlur.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraForBlur.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); } diff --git a/dali-toolkit/internal/filters/emboss-filter.cpp b/dali-toolkit/internal/filters/emboss-filter.cpp index 8f444ac..f437c73 100644 --- a/dali-toolkit/internal/filters/emboss-filter.cpp +++ b/dali-toolkit/internal/filters/emboss-filter.cpp @@ -279,7 +279,6 @@ void EmbossFilter::SetupCamera() mCameraActor.SetNearClippingPlane(1.0f); mCameraActor.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraActor.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); } diff --git a/dali-toolkit/internal/filters/spread-filter.cpp b/dali-toolkit/internal/filters/spread-filter.cpp index 3f3eaa6..d0b54f9 100644 --- a/dali-toolkit/internal/filters/spread-filter.cpp +++ b/dali-toolkit/internal/filters/spread-filter.cpp @@ -203,7 +203,6 @@ void SpreadFilter::SetupCamera() mCameraActor.SetNearClippingPlane(1.0f); mCameraActor.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraActor.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); } diff --git a/dali-toolkit/internal/text/clipping/text-clipper.cpp b/dali-toolkit/internal/text/clipping/text-clipper.cpp index 416fdba..b2478e4 100644 --- a/dali-toolkit/internal/text/clipping/text-clipper.cpp +++ b/dali-toolkit/internal/text/clipping/text-clipper.cpp @@ -98,7 +98,6 @@ void Clipper::Initialize( const Vector2& size ) mOffscreenRootActor = Layer::New(); mOffscreenRootActor.SetColorMode( USE_OWN_COLOR ); mOffscreenRootActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); - mOffscreenRootActor.SetInheritRotation( false ); mOffscreenRootActor.SetInheritScale( false ); mOffscreenRootActor.SetDepthTestDisabled( true ); mOffscreenRootActor.SetSize( offscreenSize ); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp index 4b7ad4a..975889d 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp @@ -105,12 +105,12 @@ void CubeTransitionCrossEffect::OnStopTransition() for( unsigned int x = y%2; x < mNumColumns; x=x+2) { idx = y*mNumColumns + x; - mBoxes[idx].SetRotation( Radian(angle), Vector3::XAXIS ); + mBoxes[idx].SetOrientation( Radian(angle), Vector3::XAXIS ); } for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2) { idx = y*mNumColumns + x; - mBoxes[idx].SetRotation( Radian(-angle), Vector3::YAXIS ); + mBoxes[idx].SetOrientation( Radian(-angle), Vector3::YAXIS ); } } } @@ -120,12 +120,12 @@ void CubeTransitionCrossEffect::SetupAnimation(unsigned int actorIndex, float an { if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition and it is going to previous image { - mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle), axis ); + mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle), axis ); } else if( !mChangeTurningDirection ) // reset rotation, translation and color { - mTiles[mContainerIndex][actorIndex].MoveBy( resetTranslation ); - mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle), axis ); + mTiles[mContainerIndex][actorIndex].TranslateBy( resetTranslation ); + mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle), axis ); } mAnimation.RotateTo( mBoxes[actorIndex], Radian( -angle ), axis, AlphaFunctions::EaseInOutSine ); Vector3 position(mBoxes[actorIndex].GetCurrentPosition()); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp index 803ed2a..abffa6a 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp @@ -102,11 +102,11 @@ void CubeTransitionFoldEffect::OnStopTransition() idx = y*mNumColumns; for( unsigned int x = y%2; x < mNumColumns; x=x+2) { - mBoxes[idx+x].SetRotation( Radian(angle), Vector3::YAXIS ); + mBoxes[idx+x].SetOrientation( Radian(angle), Vector3::YAXIS ); } for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2) { - mBoxes[idx+x].SetRotation( Radian(-angle), Vector3::YAXIS ); + mBoxes[idx+x].SetOrientation( Radian(-angle), Vector3::YAXIS ); } } } @@ -118,12 +118,12 @@ void CubeTransitionFoldEffect::SetupAnimation(unsigned int actorIndex, float ang ImageActor frontTile = mTiles[mContainerIndex^1][actorIndex]; if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition, it is going to previous image { - sideTile.SetRotation( Radian( angle), Vector3::YAXIS ); + sideTile.SetOrientation( Radian( angle), Vector3::YAXIS ); } else if( !mChangeTurningDirection ) // reset rotation, translation and color { - sideTile.MoveBy( resetTranslation ); - sideTile.SetRotation( Radian( angle), Vector3::YAXIS ); + sideTile.TranslateBy( resetTranslation ); + sideTile.SetOrientation( Radian( angle), Vector3::YAXIS ); } mAnimation.RotateTo( currentCube, Radian( -angle ), Vector3::YAXIS, AlphaFunctions::Linear ); Vector3 position(currentCube.GetCurrentPosition()); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp index d483ff1..1f8ca0f 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp @@ -74,15 +74,15 @@ void CubeTransitionWaveEffect::OnStartTransition( Vector2 panPosition, Vector2 p { for( unsigned int idx = 0; idx < totalNum; idx++ ) { - mTiles[mContainerIndex][idx].SetRotation( Degree( angle), Vector3::YAXIS ); + mTiles[mContainerIndex][idx].SetOrientation( Degree( angle), Vector3::YAXIS ); } } else if(!mChangeTurningDirection) // reset rotation, translation { for( unsigned int idx = 0; idx < totalNum; idx++ ) { - mTiles[mContainerIndex][idx].MoveBy( translation ); - mTiles[mContainerIndex][idx].SetRotation( Degree( angle), Vector3::YAXIS ); + mTiles[mContainerIndex][idx].TranslateBy( translation ); + mTiles[mContainerIndex][idx].SetOrientation( Degree( angle), Vector3::YAXIS ); } } @@ -118,7 +118,7 @@ void CubeTransitionWaveEffect::OnStopTransition() unsigned int totalNum = mNumRows * mNumColumns; for( unsigned int idx = 0; idx < totalNum; idx++ ) { - mBoxes[idx].SetRotation( Degree( angle ), Vector3::YAXIS ); + mBoxes[idx].SetOrientation( Degree( angle ), Vector3::YAXIS ); } } diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp index 13f2612..54809c3 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp @@ -215,7 +215,7 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d { WrappedQuaternionConstraint wrapped(rotationConstraint, itemId); - Constraint constraint = Constraint::New( Actor::Property::ROTATION, + Constraint constraint = Constraint::New( Actor::Property::ORIENTATION, Source( scrollPositionObject, scrollPositionProperty ), ParentSource( scrollSpeedProperty ), ParentSource( Actor::Property::SIZE ), diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.cpp deleted file mode 100755 index d415d5e..0000000 --- a/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.cpp +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -using namespace Dali; -using namespace Dali::Toolkit; - -namespace // unnamed namespace -{ -const unsigned int DEFAULT_NUMBER_OF_COLUMNS = 3; -const float DEFAULT_TOP_MARGIN = 0.3f; -const float DEFAULT_BOTTOM_MARGIN = 0.3f; -const float DEFAULT_SIDE_MARGIN = 0.2f; -const float DEFAULT_COLUMN_SPACING = 20.0f; -const float DEFAULT_ROW_SPACING = 20.0f; -const float DEFAULT_SCROLL_SPEED_FACTOR = 0.01f; -const float DEFAULT_MAXIMUM_SWIPE_SPEED = 3.0f; -const float DEFAULT_ITEM_FLICK_ANIMATION_DURATION = 0.05f; -const float DEFAULT_SIZE_EXTEND = 1.4f; -const float DEFAULT_HEIGHT_FACTOR = 0.6f; - -// 4 orientations are supported -struct NavigationPositionConstraintUp -{ - NavigationPositionConstraintUp(const unsigned int columnIndex, - const unsigned int numberOfColumns, - const float columnSpacing, - const float sizeExtend, - const float bottomMargin, - const float topMargin) - : mColumnIndex(columnIndex), - mNumberOfColumns(numberOfColumns), - mColumnSpacing(columnSpacing), - mSizeExtend(sizeExtend), - mBottomMargin(bottomMargin), - mTopMargin(topMargin) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float itemWidth = (layoutSize.width * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns ); - - Vector3 itemPosition; - - float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 2.0f; - - itemPosition = Vector3( (layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - layoutSize.width * mSizeExtend * 0.5f, - (- mBottomMargin + mTopMargin) * layoutSize.width * 0.5f , - z); - return itemPosition; - } - -public: - unsigned int mColumnIndex; - unsigned int mNumberOfColumns; - float mColumnSpacing; - float mSizeExtend; - float mBottomMargin; - float mTopMargin; -}; - -struct NavigationPositionConstraintLeft -{ - NavigationPositionConstraintLeft(const unsigned int columnIndex, - const unsigned int numberOfColumns, - const float columnSpacing, - const float sizeExtend, - const float bottomMargin, - const float topMargin) - : mColumnIndex(columnIndex), - mNumberOfColumns(numberOfColumns), - mColumnSpacing(columnSpacing), - mSizeExtend(sizeExtend), - mBottomMargin(bottomMargin), - mTopMargin(topMargin) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float itemWidth = (DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns ); - Vector3 itemPosition; - float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 1.5f; - itemPosition = Vector3( (- mBottomMargin + mTopMargin) * 0.5f * layoutSize.width , - -((layoutPosition+ 1.0) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend * 0.5f ), - z); - return itemPosition; - } - -public: - unsigned int mColumnIndex; - unsigned int mNumberOfColumns; - float mColumnSpacing; - float mSizeExtend; - float mBottomMargin; - float mTopMargin; -}; - -struct NavigationPositionConstraintDown -{ - NavigationPositionConstraintDown(const unsigned int columnIndex, - const unsigned int numberOfColumns, - const float columnSpacing, - const float sizeExtend, - const float bottomMargin, - const float topMargin) - : mColumnIndex(columnIndex), - mNumberOfColumns(numberOfColumns), - mColumnSpacing(columnSpacing), - mSizeExtend(sizeExtend), - mBottomMargin(bottomMargin), - mTopMargin(topMargin) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float itemWidth = (layoutSize.width * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns ); - Vector3 itemPosition; - - float z = (sinf((layoutPosition + 1.0f ) * Math::PI *0.5f) - 1.0f) * itemWidth * 2.0f; - itemPosition = Vector3( -((layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - layoutSize.width * mSizeExtend * 0.5f), - (- mBottomMargin + mTopMargin)* layoutSize.width * 0.5f, - z); - return itemPosition; - } - - public: - unsigned int mColumnIndex; - unsigned int mNumberOfColumns; - float mColumnSpacing; - float mSizeExtend; - float mBottomMargin; - float mTopMargin; -}; - -struct NavigationPositionConstraintRight -{ - NavigationPositionConstraintRight(const unsigned int columnIndex, - const unsigned int numberOfColumns, - const float columnSpacing, - const float sizeExtend, - const float bottomMargin, - const float topMargin) - : mColumnIndex(columnIndex), - mNumberOfColumns(numberOfColumns), - mColumnSpacing(columnSpacing), - mSizeExtend(sizeExtend), - mBottomMargin(bottomMargin), - mTopMargin(topMargin) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float itemWidth = (DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns ); - Vector3 itemPosition; - float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 1.5f; - itemPosition = Vector3( (- mBottomMargin + mTopMargin) * layoutSize.width * 0.5f, - ((layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend *0.5f ), - z); - return itemPosition; - } - -public: - unsigned int mColumnIndex; - unsigned int mNumberOfColumns; - float mColumnSpacing; - float mSizeExtend; - float mBottomMargin; - float mTopMargin; -}; - -struct NavigationRotationConstraintUp -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float angle = 0.0f; - float _layoutPosition = layoutPosition + 1.0f; - if(_layoutPosition >= 1.0f) - { - angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - else - { - angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - return Quaternion(angle, Vector3::YAXIS); - } - -}; - -struct NavigationRotationConstraintLeft -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float angle = 0.0f; - float _layoutPosition = layoutPosition + 1.0f; - if(_layoutPosition >= 1.0f) - { - angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - else - { - angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - return Quaternion(Math::PI * 0.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); - } -}; - -struct NavigationRotationConstraintDown -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float angle = 0.0f; - float _layoutPosition = layoutPosition + 1.0f; - if(_layoutPosition >= 1.0f)//right side - { - //rotation angle by z axis - angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - else // left side - { - angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - return Quaternion(Math::PI, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); - } -}; - -struct NavigationRotationConstraintRight -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float angle = 0.0f; - float _layoutPosition = layoutPosition + 1.0f; - if(_layoutPosition >= 1.0f) - { - angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - else - { - angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f; - } - return Quaternion(Math::PI * 1.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS); - } -}; - -struct NavigationColorConstraint -{ - NavigationColorConstraint(unsigned int numberOfColumns) - : mNumberOfColumns(numberOfColumns) - { - - } - Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float darkness = 1.0f; - float alpha = 1.0f; - - float pos = ( layoutPosition + 1.0f); - darkness = (-0.25f) * (pos + 1.0f) * (pos + 1.0f) + 1.0f * (pos + 1.0f) + 0.2f; - - darkness = fabs(darkness); - darkness /= 1.2f; - - return Vector4(darkness, darkness, darkness, current.a * alpha); - } - unsigned int mNumberOfColumns; - -}; - -struct NavigationVisibilityConstraint -{ - NavigationVisibilityConstraint(const unsigned int columnIndex, - const unsigned int numberOfColumns, - const float columnSpacing ) - : mColumnIndex(columnIndex), - mNumberOfColumns(numberOfColumns), - mColumnSpacing(columnSpacing) - { - } - - bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float index = layoutPosition + 1.0f; - return (index >= -1.0f) && (index <= mNumberOfColumns ); - } - -public: - unsigned int mColumnIndex; - unsigned int mNumberOfColumns; - float mColumnSpacing; -}; -}//end namespace - -namespace Dali -{ -namespace Toolkit -{ -struct NavigationLayout::Impl -{ - Impl() - : mNumberOfColumns(DEFAULT_NUMBER_OF_COLUMNS), - mColumnSpacing(DEFAULT_COLUMN_SPACING), - mTopMargin(DEFAULT_TOP_MARGIN), - mBottomMargin(DEFAULT_BOTTOM_MARGIN), - mSideMargin(DEFAULT_SIDE_MARGIN), - mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR), - mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED), - mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION), - mSizeExtend(DEFAULT_SIZE_EXTEND) - { - mColorConstraint = NavigationColorConstraint(mNumberOfColumns); - mRotationConstraint[0] = NavigationRotationConstraintUp(); - mRotationConstraint[1] = NavigationRotationConstraintLeft(); - mRotationConstraint[2] = NavigationRotationConstraintDown(); - mRotationConstraint[3] = NavigationRotationConstraintRight(); - } - - unsigned int mNumberOfColumns; - float mColumnSpacing; - float mTopMargin; - float mBottomMargin; - float mSideMargin; - float mScrollSpeedFactor; - float mMaximumSwipeSpeed; - float mItemFlickAnimationDuration; - float mSizeExtend; - - ItemLayout::QuaternionFunction mRotationConstraint[4]; - - ItemLayout::Vector4Function mColorConstraint; -}; - -NavigationLayoutPtr NavigationLayout::New() -{ - return NavigationLayoutPtr(new NavigationLayout()); -} - -NavigationLayout::~NavigationLayout() -{ - delete mImpl; -} - -void NavigationLayout::SetNumberOfColumns(unsigned int columns) -{ - mImpl->mNumberOfColumns = columns; -} - -unsigned int NavigationLayout::GetNumberOfColumns() const -{ - return mImpl->mNumberOfColumns; -} - -void NavigationLayout::SetColumnSpacing(float spacing) -{ - mImpl->mColumnSpacing = spacing; -} - -float NavigationLayout::GetColumnSpacing() const -{ - return mImpl->mColumnSpacing; -} - -void NavigationLayout::SetTopMargin(float margin) -{ - mImpl->mTopMargin = margin; -} - -float NavigationLayout::GetTopMargin() const -{ - return mImpl->mTopMargin; -} - -void NavigationLayout::SetBottomMargin(float margin) -{ - mImpl->mBottomMargin = margin; -} - -float NavigationLayout::GetBottomMargin() const -{ - return mImpl->mBottomMargin; -} - -void NavigationLayout::SetSideMargin(float margin) -{ - mImpl->mSideMargin = margin; - mImpl->mSizeExtend = (1.0f - margin) * 3.0f; -} - -void NavigationLayout::SetScrollSpeedFactor(float scrollSpeed) -{ - mImpl->mScrollSpeedFactor = scrollSpeed; -} - -void NavigationLayout::SetMaximumSwipeSpeed(float speed) -{ - mImpl->mMaximumSwipeSpeed = speed; -} - -void NavigationLayout::SetItemFlickAnimationDuration(float durationSeconds) -{ - mImpl->mItemFlickAnimationDuration = durationSeconds; -} - -float NavigationLayout::GetScrollSpeedFactor() const -{ - return mImpl->mScrollSpeedFactor; -} - -float NavigationLayout::GetMaximumSwipeSpeed() const -{ - return mImpl->mMaximumSwipeSpeed; -} - -float NavigationLayout::GetItemFlickAnimationDuration() const -{ - return mImpl->mItemFlickAnimationDuration; -} - -float NavigationLayout::GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const -{ - unsigned int itemsLastRow = numberOfItems % mImpl->mNumberOfColumns; - if (itemsLastRow == 0) - { - itemsLastRow = mImpl->mNumberOfColumns; - } - - float itemsLastPage = static_cast(itemsLastRow); - return itemsLastPage - static_cast(numberOfItems) - 2.0f; - -} - -float NavigationLayout::GetClosestAnchorPosition(float layoutPosition) const -{ - return round(layoutPosition); -} - -float NavigationLayout::GetItemScrollToPosition(unsigned int itemId) const -{ - return - static_cast(itemId); -} - -ItemRange NavigationLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const -{ - int itemsPerPage = mImpl->mNumberOfColumns; - - int firstItemIndex = std::max(0.0f, -firstItemPosition -1.0f ); - int lastItemIndex = std::max(0.0f, -(firstItemPosition) + itemsPerPage ); - - return ItemRange(firstItemIndex , lastItemIndex ); -} - -unsigned int NavigationLayout::GetReserveItemCount(Vector3 layoutSize) const -{ - float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width; - float itemWidth = (layoutWidth * mImpl->mSizeExtend - mImpl->mColumnSpacing * (mImpl->mNumberOfColumns - 1))/( mImpl->mNumberOfColumns ); - return static_cast(layoutWidth / itemWidth); -} - -bool NavigationLayout::GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const -{ - float layoutWidth = IsHorizontal(mOrientation) ? (DEFAULT_HEIGHT_FACTOR * layoutSize.height) : layoutSize.width; - layoutWidth = layoutWidth * mImpl->mSizeExtend; - - float itemWidth = (layoutWidth - mImpl->mColumnSpacing*(mImpl->mNumberOfColumns-1)) / mImpl->mNumberOfColumns; - float itemHeight = layoutWidth * (1.0f - mImpl->mBottomMargin - mImpl->mTopMargin); - itemSize = Vector3(itemWidth, itemHeight, (itemWidth/4)*3); - - return true; -} - -void NavigationLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const -{ -} - -bool NavigationLayout::GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const -{ - unsigned int columnIndex = itemId % mImpl->mNumberOfColumns; - if (mOrientation == ControlOrientation::Left) - { - constraint = NavigationPositionConstraintLeft(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin); - } - else if (mOrientation == ControlOrientation::Up) - { - constraint = NavigationPositionConstraintUp(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin); - } - else if (mOrientation == ControlOrientation::Down) - { - constraint = NavigationPositionConstraintDown(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin); - } - else if (mOrientation == ControlOrientation::Right) - { - constraint = NavigationPositionConstraintRight(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin); - } - - return true; -} - -bool NavigationLayout::GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const -{ - return false; // No scaling -} - -bool NavigationLayout::GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const -{ - constraint = mImpl->mRotationConstraint[mOrientation]; - return true; -} - -bool NavigationLayout::GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const -{ - constraint = mImpl->mColorConstraint; - return true; -} - -bool NavigationLayout::GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const -{ - unsigned int columnIndex = itemId % mImpl->mNumberOfColumns; - constraint = NavigationVisibilityConstraint(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing); - return true; -} - -Degree NavigationLayout::GetScrollDirection() const -{ - Degree scrollDirection(0); - if (mOrientation == ControlOrientation::Down) - { - scrollDirection = 0.0f - 45.0f; - } - else if (mOrientation == ControlOrientation::Right) - { - scrollDirection = 90.0f - 45.0f; - } - else if (mOrientation == ControlOrientation::Up) - { - scrollDirection = 180.0f - 45.0f; - } - else // mOrientation == ControlOrientation::Left - { - scrollDirection = 270.0f - 45.0f; - } - - return scrollDirection; -} - -NavigationLayout::NavigationLayout() - :mImpl(NULL) -{ - mImpl = new Impl(); -} - -} -} diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h b/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h deleted file mode 100755 index eb49a07..0000000 --- a/dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h +++ /dev/null @@ -1,236 +0,0 @@ -#ifndef __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__ -#define __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ -namespace Toolkit -{ -class NavigationLayout; - -typedef IntrusivePtr NavigationLayoutPtr; - -/** - * An ItemView layout which arranges items in navigation mode. - */ -class DALI_IMPORT_API NavigationLayout: public ItemLayout -{ -public: - - typedef boost::function ResizeFunction; - - /** - * Create a new navigation layout - */ - static NavigationLayoutPtr New(); - - /** - * Virtual destructor. - */ - virtual ~NavigationLayout(); - - /** - * Set the number of columns in the layout. - * @param[in] columns The number of columns. - */ - void SetNumberOfColumns(unsigned int columns); - - /** - * Get the number of columns in the layout. - * @return The number of columns. - */ - unsigned int GetNumberOfColumns() const; - - /** - * Set the spacing between columns. - * @param[in] spacing The spacing. - */ - void SetColumnSpacing(float spacing); - - /** - * Get the spacing between columns. - * @return The spacing. - */ - float GetColumnSpacing() const; - - /** - * Set the margin in the top of the layout - * @param[in] margin The layout top margin. - */ - void SetTopMargin(float margin); - - /** - * Get the margin in the top of the layout - * @return The layout top margin. - */ - float GetTopMargin() const; - - /** - * Set the margin in the bottom of the layout - * @param[in] margin The layout bottom margin. - */ - void SetBottomMargin(float margin); - - /** - * Get the margin in the bottom of the layout - * @return The layout bottom margin. - */ - float GetBottomMargin() const; - - /** - * Set the margin in the left and right of the layout - * @param[in] margin The layout side margin. - */ - void SetSideMargin(float margin); - - /** - * Get the margin in the left and right of the layout - * @return The layout side margin. - */ - float GetSideMargin() const; - - /** - * Set the factor used to customise the scroll speed while dragging and swiping the layout. - * @param[in] scrollSpeed The scroll speed factor. - */ - void SetScrollSpeedFactor(float scrollSpeed); - - /** - * Set the maximum swipe speed in pixels per second. - * @param[in] speed The maximum swipe speed. - */ - void SetMaximumSwipeSpeed(float speed); - - /** - * Set the duration of the flick animation in second. This is the time taken to animate each - * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered - * by a swipe gesture. - * @pre durationSeconds must be greater than zero. - * @param[in] durationSeconds The duration of flick animation in seconds. - */ - void SetItemFlickAnimationDuration(float durationSeconds); - - /** - * @copydoc ItemLayout::GetScrollSpeedFactor() - */ - virtual float GetScrollSpeedFactor() const; - - /** - * @copydoc ItemLayout::GetMaximumSwipeSpeed() - */ - virtual float GetMaximumSwipeSpeed() const; - - /** - * @copydoc ItemLayout::GetItemFlickAnimationDuration() - */ - virtual float GetItemFlickAnimationDuration() const; - -private: - - /** - * @copydoc ItemLayout::GetMinimumLayoutPosition() - */ - virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetClosestAnchorPosition() - */ - virtual float GetClosestAnchorPosition(float layoutPosition) const; - - /** - * @copydoc ItemLayout::GetItemScrollToPosition() - */ - virtual float GetItemScrollToPosition(unsigned int itemId) const; - - /** - * @copydoc ItemLayout::GetItemsWithinArea() - */ - virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetReserveItemCount() - */ - virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetItemSize() - */ - virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const; - - /** - * @copydoc ItemLayout::GetResizeAnimation() - */ - virtual void GetResizeAnimation(Animation& animation, - Actor actor, - Vector3 size, - float durationSeconds) const; - - /** - * @copydoc ItemLayout::GetPositionConstraint() - */ - virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const; - - /** - * @copydoc ItemLayout::GetRotationConstraint() - */ - virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const; - - /** - * @copydoc ItemLayout::GetScaleConstraint() - */ - virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const; - - /** - * @copydoc ItemLayout::GetColorConstraint() - */ - virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const; - - /** - * @copydoc ItemLayout::GetVisibilityConstraint() - */ - virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const; - - /** - * @copydoc ItemLayout::GetScrollDirection() - */ - virtual Degree GetScrollDirection() const; - -protected: - - /** - * Protected constructor; see also GridLayout::New() - */ - NavigationLayout(); - -private: - - struct Impl; - Impl* mImpl; -}; - -} -} -#endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__ diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.cpp deleted file mode 100644 index 966b665..0000000 --- a/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace // unnamed namespace -{ - -const float DEFAULT_ROW_SPACING = 20.0f; -const float DEFAULT_SCROLL_SPEED_FACTOR = 0.0015f; -const float DEFAULT_MAXIMUM_SWIPE_SPEED = 8.0f; -const float DEFAULT_ITEM_FLICK_ANIMATION_DURATION = 0.4f; - -// 4 orientations are supported -static const unsigned int ORIENTATION_COUNT = 4; - -static Vector3 GetItemSizeDefaultFunction(float layoutWidth, float layoutHeight, float rowSpacing) -{ - float height = (layoutHeight - rowSpacing) * 0.5f; - return Vector3(layoutWidth, height, height); -} - -struct RollPositionConstraint0 -{ - RollPositionConstraint0(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing); - - float adjustedLayoutPosition = layoutPosition; - float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed * scrollSpeed; - float y = 0.0f; - - float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor; - - if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0) - { - float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f); - adjustedLayoutPosition = adjustment * 2.0f; - y = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.height * 0.5f + itemSize.y * 0.5f; - } - else - { - float yStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor)); - y = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * yStep : (layoutSize.height * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * yStep; - y += itemSize.y * 0.5f - layoutSize.height * 0.5f; - } - - float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor); - z -= std::min(3000.0f, scrollSpeedFactor * 2.0f); - - return Vector3(itemSize.x * 0.5f - layoutSize.x * 0.5f, y, z); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -struct RollPositionConstraint90 -{ - RollPositionConstraint90(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing); - - float adjustedLayoutPosition = layoutPosition; - float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed; - float x = 0.0f; - - float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor; - - if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0) - { - float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f); - adjustedLayoutPosition = adjustment * 2.0f; - x = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.width * 0.5f + itemSize.y * 0.5f; - } - else - { - float xStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor)); - x = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * xStep : (layoutSize.width * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * xStep; - x += itemSize.y * 0.5f - layoutSize.width * 0.5f; - } - - float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor); - z -= std::min(3000.0f, scrollSpeedFactor * 2.0f); - - return Vector3(x, itemSize.x * 0.5f - layoutSize.y * 0.5f, z); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -struct RollPositionConstraint180 -{ - RollPositionConstraint180(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing); - - float adjustedLayoutPosition = layoutPosition; - float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed; - float y = 0.0f; - - float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor; - - if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0) - { - float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f); - adjustedLayoutPosition = adjustment * 2.0f; - y = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.height * 0.5f + itemSize.y * 0.5f; - } - else - { - float yStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor)); - y = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * yStep : (layoutSize.height * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * yStep; - y += itemSize.y * 0.5f - layoutSize.height * 0.5f; - } - - float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor); - z -= std::min(3000.0f, scrollSpeedFactor * 2.0f); - - - return Vector3(-(itemSize.x * 0.5f - layoutSize.x * 0.5f), - -y, - z); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -struct RollPositionConstraint270 -{ - RollPositionConstraint270(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing); - - float adjustedLayoutPosition = layoutPosition; - float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed; - float x = 0.0f; - - float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor; - - if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0) - { - float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f); - adjustedLayoutPosition = adjustment * 2.0f; - x = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.width * 0.5f + itemSize.y * 0.5f; - } - else - { - float xStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor)); - x = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * xStep : (layoutSize.width * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * xStep; - x += itemSize.y * 0.5f - layoutSize.width * 0.5f; - } - - float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor); - z -= std::min(3000.0f, scrollSpeedFactor * 2.0f); - - return Vector3(-x, - itemSize.x * 0.5f - layoutSize.y * 0.5f, - z); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -struct RollRotationConstraint0 -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - return Quaternion(0.0f, Vector3::ZAXIS); - } -}; - -struct RollRotationConstraint90 -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - return Quaternion(1.5f * Math::PI, Vector3::ZAXIS); - } -}; - -struct RollRotationConstraint180 -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - return Quaternion(Math::PI, Vector3::ZAXIS); - } -}; - -struct RollRotationConstraint270 -{ - Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - return Quaternion(0.5f * Math::PI, Vector3::ZAXIS); - } -}; - -struct RollScaleConstraint -{ - Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float adjustedLayoutPosition = layoutPosition; - float factor = 0.0f; - if(adjustedLayoutPosition < Math::MACHINE_EPSILON_0) - { - factor = fabsf(adjustedLayoutPosition); - } - if(adjustedLayoutPosition - 1.0f > Math::MACHINE_EPSILON_0) - { - factor = adjustedLayoutPosition - 1.0f; - } - - float scale = std::min(1.0f, std::max(0.1f, 1.0f - 0.1f * factor)); - if(scrollSpeed > 0.0f) - { - scale *= std::min(1.0f, std::max(0.1f, 1.0f / (scrollSpeed * 0.05f))); - } - - return Vector3(scale, scale, scale); - } -}; - -struct RollColorConstraint -{ - Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - float adjustedLayoutPosition = layoutPosition; - - float factor = 0.0f; - if(adjustedLayoutPosition < Math::MACHINE_EPSILON_0) - { - factor = fabsf(adjustedLayoutPosition); - } - if(adjustedLayoutPosition - 1.0f > Math::MACHINE_EPSILON_0) - { - factor = adjustedLayoutPosition - 1.0f; - } - - float darkness = std::min(1.0f, std::max(0.5f, 1.0f - 0.5f * factor)); - float alpha = std::min(1.0f, std::max(0.0f, 1.0f - 0.9f * factor)); - return Vector4(darkness, darkness, darkness, alpha); - } -}; - -struct RollVisibilityConstraintPortrait -{ - RollVisibilityConstraintPortrait(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing); - int rowsPerPage = ceil(layoutSize.height / (itemSize.y + mRowSpacing)); - return (layoutPosition > -rowsPerPage) && (layoutPosition < rowsPerPage); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -struct RollVisibilityConstraintLandscape -{ - RollVisibilityConstraintLandscape(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction) - : mRowSpacing(rowSpacing), - mItemSizeFunction(itemSizeFunction) - { - } - - bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize) - { - Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing); - int rowsPerPage = ceil(layoutSize.width / (itemSize.y + mRowSpacing)); - return (layoutPosition + 2.0f > Math::MACHINE_EPSILON_0) && (layoutPosition < rowsPerPage); - } - -public: - - float mRowSpacing; - RollLayout::ItemSizeFunction mItemSizeFunction; -}; - -} // unnamed namespace - -namespace Dali -{ - -namespace Toolkit -{ - -struct RollLayout::Impl -{ - Impl() - : mRowSpacing(DEFAULT_ROW_SPACING), - mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR), - mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED), - mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION), - mItemSizeFunction(GetItemSizeDefaultFunction) - { - mScaleConstraint = RollScaleConstraint(); - mColorConstraint = RollColorConstraint(); - - mRotationConstraint[0] = RollRotationConstraint0(); - mRotationConstraint[1] = RollRotationConstraint90(); - mRotationConstraint[2] = RollRotationConstraint180(); - mRotationConstraint[3] = RollRotationConstraint270(); - } - - float mRowSpacing; - - float mScrollSpeedFactor; - float mMaximumSwipeSpeed; - float mItemFlickAnimationDuration; - - ItemLayout::QuaternionFunction mRotationConstraint[ORIENTATION_COUNT]; - ItemLayout::Vector3Function mScaleConstraint; - ItemLayout::Vector4Function mColorConstraint; - - ItemSizeFunction mItemSizeFunction; -}; - -RollLayoutPtr RollLayout::New() -{ - return RollLayoutPtr(new RollLayout()); -} - -RollLayout::~RollLayout() -{ - delete mImpl; -} - -void RollLayout::SetRowSpacing(float spacing) -{ - mImpl->mRowSpacing = spacing; -} - -float RollLayout::GetRowSpacing() const -{ - return mImpl->mRowSpacing; -} - -void RollLayout::SetItemSizeFunction(ItemSizeFunction function) -{ - mImpl->mItemSizeFunction = function; -} - -RollLayout::ItemSizeFunction RollLayout::GetItemSizeFunction() const -{ - return mImpl->mItemSizeFunction; -} - -void RollLayout::SetScrollSpeedFactor(float scrollSpeed) -{ - mImpl->mScrollSpeedFactor = scrollSpeed; -} - -void RollLayout::SetMaximumSwipeSpeed(float speed) -{ - mImpl->mMaximumSwipeSpeed = speed; -} - -void RollLayout::SetItemFlickAnimationDuration(float durationSeconds) -{ - mImpl->mItemFlickAnimationDuration = durationSeconds; -} - -float RollLayout::GetScrollSpeedFactor() const -{ - return mImpl->mScrollSpeedFactor; -} - -float RollLayout::GetMaximumSwipeSpeed() const -{ - return mImpl->mMaximumSwipeSpeed; -} - -float RollLayout::GetItemFlickAnimationDuration() const -{ - return mImpl->mItemFlickAnimationDuration; -} - -float RollLayout::GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const -{ - return 2.0f - static_cast(numberOfItems); -} - -float RollLayout::GetClosestAnchorPosition(float layoutPosition) const -{ - return static_cast(round(layoutPosition)); -} - -float RollLayout::GetItemScrollToPosition(unsigned int itemId) const -{ - return 0.0f - static_cast(itemId); -} - -ItemRange RollLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const -{ - float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width; - float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height; - - Vector3 itemSize = mImpl->mItemSizeFunction( layoutWidth,layoutHeight, mImpl->mRowSpacing); - - float itemsPerPage = (layoutHeight / (itemSize.y + mImpl->mRowSpacing)); - if(firstItemPosition + 0.001f >= Math::MACHINE_EPSILON_0) - { - itemsPerPage = std::max(0.0f, itemsPerPage - 1.0f); - } - int firstVisibleItem = -(static_cast(firstItemPosition)); - - int firstItemIndex = std::max(0, firstVisibleItem); - int lastItemIndex = std::max(0, static_cast(ceil(firstVisibleItem + itemsPerPage - 1))); - return ItemRange(firstItemIndex, lastItemIndex); -} - -unsigned int RollLayout::GetReserveItemCount(Vector3 layoutSize) const -{ - float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width; - float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height; - - Vector3 itemSize = mImpl->mItemSizeFunction(layoutWidth, layoutHeight, mImpl->mRowSpacing); - int itemsPerPage = ceil(layoutHeight / (itemSize.y + mImpl->mRowSpacing)); - return itemsPerPage * 5; -} - -bool RollLayout::GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const -{ - // Note: itemId is not checked, since every item has the same size - float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width; - float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height; - - itemSize = mImpl->mItemSizeFunction(layoutWidth, layoutHeight, mImpl->mRowSpacing); - - return true; -} - -void RollLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const -{ - if(animation) - { - animation.Resize(actor, size); - } -} - -bool RollLayout::GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const -{ - if (mOrientation == ControlOrientation::Up) - { - constraint = RollPositionConstraint0(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - else if (mOrientation == ControlOrientation::Left) - { - constraint = RollPositionConstraint90(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - else if (mOrientation == ControlOrientation::Down) - { - constraint = RollPositionConstraint180(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - else // mOrientation == ControlOrientation::Right - { - constraint = RollPositionConstraint270(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - - return true; -} - -bool RollLayout::GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const -{ - constraint = mImpl->mRotationConstraint[mOrientation]; - return true; -} - -bool RollLayout::GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const -{ - constraint = mImpl->mScaleConstraint; - return true; -} - -bool RollLayout::GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const -{ - constraint = mImpl->mColorConstraint; - return true; -} - -bool RollLayout::GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const -{ - if (IsVertical(mOrientation)) - { - constraint = RollVisibilityConstraintPortrait(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - else // horizontal - { - constraint = RollVisibilityConstraintLandscape(mImpl->mRowSpacing, mImpl->mItemSizeFunction); - } - - return true; -} - -Degree RollLayout::GetScrollDirection() const -{ - Degree scrollDirection(0.0f); - - if (mOrientation == ControlOrientation::Up) - { - scrollDirection = 0.0f; - } - else if (mOrientation == ControlOrientation::Left) - { - scrollDirection = 90.0f; - } - else if (mOrientation == ControlOrientation::Down) - { - scrollDirection = 180.0f; - } - else // mOrientation == ControlOrientation::Right - { - scrollDirection = 270.0f; - } - - return scrollDirection; -} - -RollLayout::RollLayout() -: mImpl(NULL) -{ - mImpl = new Impl(); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h b/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h deleted file mode 100644 index bbaea00..0000000 --- a/dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h +++ /dev/null @@ -1,198 +0,0 @@ -#ifndef __DALI_TOOLKIT_ROLL_LAYOUT_H__ -#define __DALI_TOOLKIT_ROLL_LAYOUT_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES - -#include - -namespace Dali -{ - -namespace Toolkit -{ - -class RollLayout; - -typedef IntrusivePtr RollLayoutPtr; - -/** - * An ItemView layout which arranges items in a roll. - */ -class DALI_IMPORT_API RollLayout : public ItemLayout -{ -public: - - typedef boost::function ItemSizeFunction; - - /** - * Create a new roll layout - */ - static RollLayoutPtr New(); - - /** - * Virtual destructor. - */ - virtual ~RollLayout(); - - /** - * Set the spacing between rows. - * @param[in] spacing The row spacing. - */ - void SetRowSpacing(float spacing); - - /** - * Get the spacing between rows. - * @return The row spacing. - */ - float GetRowSpacing() const; - - /** - * Set the function used to calculate the item-size, for a given layout-size. - * @param[in] function The item-size function. - */ - void SetItemSizeFunction(ItemSizeFunction function); - - /** - * Get the function used to calculate the item-size. - * @return The item-size function. - */ - ItemSizeFunction GetItemSizeFunction() const; - - /** - * Set the factor used to customise the scroll speed while dragging and swiping the layout. - * @param[in] scrollSpeed The scroll speed factor. - */ - void SetScrollSpeedFactor(float scrollSpeed); - - /** - * Set the maximum swipe speed in pixels per second. - * @param[in] speed The maximum swipe speed. - */ - void SetMaximumSwipeSpeed(float speed); - - /** - * Set the duration of the flick animation in second. This is the time taken to animate each - * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered - * by a swipe gesture. - * @pre durationSeconds must be greater than zero. - * @param[in] durationSeconds The duration of flick animation in seconds. - */ - void SetItemFlickAnimationDuration(float durationSeconds); - - /** - * @copydoc ItemLayout::GetScrollSpeedFactor() - */ - virtual float GetScrollSpeedFactor() const; - - /** - * @copydoc ItemLayout::GetMaximumSwipeSpeed() - */ - virtual float GetMaximumSwipeSpeed() const; - - /** - * @copydoc ItemLayout::GetItemFlickAnimationDuration() - */ - virtual float GetItemFlickAnimationDuration() const; - -private: - - /** - * @copydoc ItemLayout::GetMinimumLayoutPosition() - */ - virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetClosestAnchorPosition() - */ - virtual float GetClosestAnchorPosition(float layoutPosition) const; - - /** - * @copydoc ItemLayout::GetItemScrollToPosition() - */ - virtual float GetItemScrollToPosition(unsigned int itemId) const; - - /** - * @copydoc ItemLayout::GetItemsWithinArea() - */ - virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetReserveItemCount() - */ - virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const; - - /** - * @copydoc ItemLayout::GetItemSize() - */ - virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const; - - /** - * @copydoc ItemLayout::GetResizeAnimation() - */ - virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const; - - /** - * @copydoc ItemLayout::GetPositionConstraint() - */ - virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const; - - /** - * @copydoc ItemLayout::GetRotationConstraint() - */ - virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const; - - /** - * @copydoc ItemLayout::GetScaleConstraint() - */ - virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const; - - /** - * @copydoc ItemLayout::GetColorConstraint() - */ - virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const; - - /** - * @copydoc ItemLayout::GetVisibilityConstraint() - */ - virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const; - - /** - * @copydoc ItemLayout::GetScrollDirection() - */ - virtual Degree GetScrollDirection() const; - -protected: - - /** - * Protected constructor; see also RollLayout::New() - */ - RollLayout(); - -private: - - struct Impl; - Impl* mImpl; -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_ROLL_LAYOUT_H__ diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index 8e1ccdf..cf45789 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -29,8 +29,6 @@ public_api_src_files = \ $(public_api_src_dir)/controls/scrollable/item-view/item-factory.cpp \ $(public_api_src_dir)/controls/scrollable/item-view/item-layout.cpp \ $(public_api_src_dir)/controls/scrollable/item-view/item-view.cpp \ - $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.cpp \ - $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.cpp \ $(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.cpp \ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect.cpp \ $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.cpp \ @@ -157,8 +155,6 @@ public_api_item_view_header_files = \ $(public_api_src_dir)/controls/scrollable/item-view/item-layout.h \ $(public_api_src_dir)/controls/scrollable/item-view/item-view-declarations.h \ $(public_api_src_dir)/controls/scrollable/item-view/item-view.h \ - $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.h \ - $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.h \ $(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.h public_api_magnifier_header_files = \ diff --git a/docs/content/example-code/property-example.cpp b/docs/content/example-code/property-example.cpp new file mode 100644 index 0000000..35e7869 --- /dev/null +++ b/docs/content/example-code/property-example.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include + +using namespace Dali; + +namespace +{ + +// The name we will use to register our custom property by. +const char* const TAG_PROPERTY_NAME = "tag-identifier"; + +const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png"; +const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png"; + +// Define the grid geometry. +#define BUTTON_ROWS 9.0f +#define BUTTON_COLUMNS 7.0f +#define BUTTON_GAP 10.0f + +} // namespace + +/** + * This example shows how to register and look-up custom properties. + * A button grid is created, each with a new "tag" property which is set to a unique value. + * When pressed, the "tag" property is looked up to retrieve the unique value and display it. + */ +class PropertyButtonsController: public ConnectionTracker +{ + public: + + PropertyButtonsController( Application& application ) + { + // Connect to the Application's Init signal + application.InitSignal().Connect( this, &PropertyButtonsController::Create ); + } + + ~PropertyButtonsController() + { + } + + void Create( Application& application ) + { + // Setup precalculations for button size and start positions. + Toolkit::PushButton button; + int index = 0; + Vector2 stageSize = Stage::GetCurrent().GetSize(); + float buttonSize = ( stageSize.x - ( BUTTON_GAP * ( BUTTON_COLUMNS + 1 ) ) ) / BUTTON_COLUMNS; + float yStart = ( stageSize.y - ( ( buttonSize * BUTTON_ROWS ) + ( BUTTON_GAP * ( BUTTON_ROWS - 1 ) ) ) ) / 2.0f; + + // Create a grid of buttons. + for( int y = 0; y < BUTTON_ROWS; ++y ) + { + for( int x = 0; x < BUTTON_COLUMNS; ++x ) + { + // Create a button and position it. + button = Toolkit::PushButton::New(); + button.SetParentOrigin( ParentOrigin::TOP_LEFT ); + button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + button.SetPosition( Vector3( BUTTON_GAP + ( x * ( buttonSize + BUTTON_GAP ) ), yStart + ( y * ( buttonSize + BUTTON_GAP ) ), 0.0f ) ); + button.SetSize( Vector3( buttonSize, buttonSize, 0) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + + // Label the button with a unique value. + std::stringstream label; + label << index; + button.SetLabel( label.str() ); + + // Register our custom property, and use it to store a unique number. + // Store the index to the property so we can look it up later. + // Note: This is much faster than looking the property up by name and should always be used if possible. + // As all our control types are the same (PushButtons) the indecies to our unique property is the same for each one. + Property::Value tag = ( float )index; + mTagPropertyIndex = button.RegisterProperty( TAG_PROPERTY_NAME, tag ); + + // Hook a callback when the button is clicked. + button.ClickedSignal().Connect( this, &PropertyButtonsController::OnButtonClicked ); + + // Add the button to the stage. + Stage::GetCurrent().Add( button ); + index++; + } + } + + // Create the last selected button text view. + mTagText = Toolkit::TextView::New( "None selected" ); + mTagText.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + mTagText.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + mTagText.SetPosition( Vector3( 0.0f, -30.0f, 0.0f ) ); + Stage::GetCurrent().Add( mTagText ); + } + + /** + * Called when any button within the grid is clicked. + * param[in] The clicked button control + * return Set to true if the signal was consumed correctly + */ + bool OnButtonClicked( Toolkit::Button button ) + { + std::stringstream valueText; + // Look up the tag property by the cached property index. + // Note: If the property belongs to a control in another library, or we do not know the index, we can look the index up first with: + // Property::Index index = button.GetPropertyIndex( TAG_PROPERTY_NAME ); + valueText << "Selected: " << button.GetProperty< float >( mTagPropertyIndex ); + + mTagText.SetText( valueText.str() ); + + return true; + } + + private: + + Toolkit::TextView mTagText; ///< A text label used to show the last button pressed. + Property::Index mTagPropertyIndex; ///< A cached property index of our custom tag property. +}; + +// Entry point for applications. +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + PropertyButtonsController test( application ); + application.MainLoop(); + + return 0; +} diff --git a/docs/content/programming-guide/animation-rotation.h b/docs/content/programming-guide/animation-rotation.h index 3d0a5d2..2e01044 100644 --- a/docs/content/programming-guide/animation-rotation.h +++ b/docs/content/programming-guide/animation-rotation.h @@ -9,7 +9,7 @@ * * @code * Dali::Actor actor; - * actor.SetRotation(Quaternion(Radian(Degree(45.0f)).value, Vector3::XAXIS)), + * actor.SetOrientation(Quaternion(Radian(Degree(45.0f)).value, Vector3::XAXIS)), * * Quaternion q(Radian(Degree(30.0f)).value, Vector3(1.0f, 1.0f, 0.0f)); * actor.RotateBy(q); diff --git a/docs/content/programming-guide/performance-profiling.h b/docs/content/programming-guide/performance-profiling.h index c4a1d98..8e70c5d 100644 --- a/docs/content/programming-guide/performance-profiling.h +++ b/docs/content/programming-guide/performance-profiling.h @@ -51,8 +51,8 @@ * $ dali-demo * $ * $ ... - * $ I/DALI ( 5692): slp-logging.cpp: LogMessage(40) > Update , min 0.59 ms, max 6.43 ms, total (3.4 secs), avg 1.26 ms - * $ I/DALI ( 5692): slp-logging.cpp: LogMessage(40) > Render , min 1.67 ms, max 5.01 ms, total (4.5 secs), avg 3.71 ms + * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Update , min 0.59 ms, max 6.43 ms, total (3.4 secs), avg 1.26 ms + * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Render , min 1.67 ms, max 5.01 ms, total (4.5 secs), avg 3.71 ms * \endcode * * If nothing is animating Dali will enter a paused state to save power. At this diff --git a/docs/content/programming-guide/properties.h b/docs/content/programming-guide/properties.h index 4c124cb..8838e78 100644 --- a/docs/content/programming-guide/properties.h +++ b/docs/content/programming-guide/properties.h @@ -1,20 +1,256 @@ /*! \page properties Properties * +@section what-is-a-property What is a property? + +A property is a value used by an object that can be modified or read externally to that object. +This could be from within Dali or externally by an application. + +

What is a property used for?

+ +Properties can be set externally by an application, allowing that application to change the configuration or behaviour of an actor. +This could include the physical geometry of the actor, or how it is drawn or moves. + +Properties can also be read. This feature can be used in conjunction with constraints to allow changes to a property within one actor to cause changes to the property of another actor. For example, an actor following the movement of another separate actor (that it is not a child of). + +Properties can be used to expose any useful information or behaviour of an actor. +Other actor variables that are used to implement this bevahiour, or do not make useful sense from an application developers point of view should not be exposed. + +

How to implement a property within Dali-core:

+ +There are two stages: + +- Define the properties as an enum in the public-api header file. +- Define the property details using the pre-defined macros to build up a table of property information. + +There are some pre-defined macros designed to help with and standardise the definition of the propery details table per class. + +These macros generate an array of property details which allow efficient lookup of flags like "animatable" or "constraint input". + +Example: ImageActor + +Within the public-api header file; image-actor.h: + +@code +/** + * @brief An enumeration of properties belonging to the ImageActor class. + * Properties additional to RenderableActor. + */ +struct Property +{ + enum + { + PIXEL_AREA = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "pixel-area", type Rect + STYLE, ///< name "style", type std::string + BORDER, ///< name "border", type Vector4 + IMAGE, ///< name "image", type Map {"filename":"", "load-policy":...} + }; +}; +@endcode +From @ref Dali::ImageActor::Property + +Notes: + +- The properties are enumerated within a named struct to give them a namespace. +- The properties are then refered to as <OBJECT>::%Property::<PROPERTY_NAME>. + +Within the internal implementation; image-actor-impl.cpp: + +@code +namespace // Unnamed namespace +{ + +// Properties + +// Name Type writable animatable constraint-input enum for index-checking +DALI_PROPERTY_TABLE_BEGIN +DALI_PROPERTY( "pixel-area", RECTANGLE, true, false, true, Dali::ImageActor::Property::PIXEL_AREA ) +DALI_PROPERTY( "style", STRING, true, false, true, Dali::ImageActor::Property::STYLE ) +DALI_PROPERTY( "border", VECTOR4, true, false, true, Dali::ImageActor::Property::BORDER ) +DALI_PROPERTY( "image", MAP, true, false, false, Dali::ImageActor::Property::IMAGE ) +DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX ) +@endcode + +Notes: + +- The table lays within an unnamed namespace. +- The table should be in the same order as the enum. +- The table should be the only place where the text names of the properties are defined. +- The information in the table should be used within the classes IsDefaultPropertyWritable / Animatable / ConstraintInput methods for quick lookup. +- The last entry in the table is optionally used in debug builds for index checking. +- The parameter to DALI_PROPERTY_TABLE_END should match the start index of the property enumeration. + +
+

How to implement a property within Dali-toolkit:

+ +Note that toolkit properties have extra limitations in that they cannot be animated or used as a constraint input. For this reason there is no requirement for a table of property details. +Macros are still used to define properties, but for the following reasons: + +To standardise the way properties are defined. +To handle type-registering for properties, signals and actions in one place. +To facilitate the posibility of running the code with the type-registry disabled. + +There are two stages: + +- Define the properties as an enum in the public-api header file, along with a definition of the property ranges. +- Define the property details using the pre-defined macros to perform the type-registering of the properties. This is done for signals and actions also. + +Example: Button + +Source file: button.h: +Note that the “PropertyRange” contents “PROPERTY_START_INDEX” is also used by the macro for order checking. + +@code + /** + * @brief The start and end property ranges for this control. + */ + enum PropertyRange + { + PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices + }; + + /** + * @brief An enumeration of properties belonging to the Button class. + */ + struct Property + { + enum + { + DISABLED = PROPERTY_START_INDEX, ///< name "disabled", @see SetDisabled(), type bool + AUTO_REPEATING, ///< name "auto-repeating", @see SetAutoRepeating(), type bool + INITIAL_AUTO_REPEATING_DELAY, ///< name "initial-auto-repeating-delay", @see SetInitialAutoRepeatingDelay(), type float + NEXT_AUTO_REPEATING_DELAY, ///< name "next-auto-repeating-delay", @see SetNextAutoRepeatingDelay(), type float + TOGGLABLE, ///< name "togglable", @see SetTogglableButton(), type bool + SELECTED, ///< name "selected", @see SetSelected(), type bool + NORMAL_STATE_ACTOR, ///< name "normal-state-actor", @see SetButtonImage(), type Map + SELECTED_STATE_ACTOR, ///< name "selected-state-actor", @see SetSelectedImage(), type Map + DISABLED_STATE_ACTOR, ///< name "disabled-state-actor", @see SetDisabledImage(), type Map + LABEL_ACTOR, ///< name "label-actor", @see SetLabel(), type Map + }; + }; +@endcode + +Source file: button-impl.cpp, within an unnamed namespace: + +@clip{"button-impl.cpp",DALI_TYPE_REGISTRATION_BEGIN,DALI_TYPE_REGISTRATION_END} + +Notes: + +- The “Create” parameter to the begin macro is the function pointer to the creation function. +- Properties should be in the same order as in the enum. +- Signals and actions are registered likewise in that order. +- Properties type-registered using these macros will have their order checked at compile time. If you get an indexing compile error, check the order matches the enum order. + + +
+
@section property-indices Property Indices +The properties are enumerated to give them a unique index. This index can be used to access them. +The indecies must be unique per flattened derivation heirachy. +EG: +- CameraActor derives from Actor. No property indicies in either CameraActor or Actor should collide with each other. +- ActiveConstraintBase derives from Object. It CAN have property indices that match Actor or CameraActor. + +There are some predefined start indecies and ranges that should be used for common cases, these are defined below: + + DALi has a property system and provides several different kinds of properties. The following table shows the index range of the different properties in place. - - - - - - + + + + + +
Kind Description Range
Default Properties defined within DALi Core, e.g. Dali::Actor, Dali::ShaderEffect default properties etc. 0 to 9999999
Registered Properties registered using Dali::PropertyRegistration 10000000 to 19999999
Control Property range reserved by Dali::Toolkit::Control 10000000 to 10001000
- \link Dali::Toolkit::Control::CONTROL_PROPERTY_START_INDEX CONTROL_PROPERTY_START_INDEX\endlink - to \link Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX CONTROL_PROPERTY_END_INDEX\endlink
Derived Control Property range for control deriving directly from Dali::Toolkit::Control 10001001 to 19999999
Custom Custom properties added to instance using Dali::Handle::RegisterProperty 50000000 onwards
Kind Description Start IndexEnd Index
Default Properties defined within DALi Core, e.g. Dali::Actor, Dali::ShaderEffect default properties etc. \link Dali::DEFAULT_OBJECT_PROPERTY_START_INDEX DEFAULT_OBJECT_PROPERTY_START_INDEX\endlink (0)9999999
Registered Properties registered using Dali::PropertyRegistration \link Dali::PROPERTY_REGISTRATION_START_INDEX PROPERTY_REGISTRATION_START_INDEX\endlink (10000000)\link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999)
Control Property range reserved by Dali::Toolkit::Control \link Dali::Toolkit::Control::CONTROL_PROPERTY_START_INDEX CONTROL_PROPERTY_START_INDEX\endlink (10000000) + \link Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX CONTROL_PROPERTY_END_INDEX\endlink (10001000)
Derived Control Property range for control deriving directly from Dali::Toolkit::Control 10001001\link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999)
Custom Custom properties added to instance using Dali::Handle::RegisterProperty \link Dali::PROPERTY_CUSTOM_START_INDEX PROPERTY_CUSTOM_START_INDEX\endlink (50000000)Onwards...
+ +
+
+@section property-use-example-cpp Property use example C++ + +Common uses for properties are constraints and animations. + +An application developer can use an existing property, or, if necessary, register their own. + +Here is a code example. + +This example shows how to register and look-up custom properties. +A grid of buttons is created, each with a new "tag" property which is set to a unique value. The index to this property is cached for later use. +When pressed, the property is looked up by index (as this is much faster than a text lookup of the property name). + +Property lookup via index should always be used unless the indecies cannot be known. If the property reader was completely decoupled from the creation, EG. A custom control with a custom property being used by external application code, then it may be necessary. In this case the application writer should aim to perform the text lookup once at start-up, and cache the property index locally. + +@clip{"property-example.cpp", void Create, return true;} + +Once run, a grid of buttons will appear. When a button is pressed, the unique number stored in the property (in this case the index) is displayed at the bottom of the screen. + +
+
+@section property-use-example-js Property use in JavaScript + +Note that constraints cannot be used within JavaScript, so below is a simple example that sets one of the default properties; scale: + +@code +var image = new dali.ResourceImage( {url:"background.png"} ); +var imageActor = new dali.ImageActor( image ); + +// by default an actor is anchored to the top-left of it's parent actor +// change it to the middle +imageActor.parentOrigin = dali.CENTER; + +// scale it up by 2 times in x,y +imageActor.scale = [ 2, 2, 1 ]; + +// add to the stage +dali.stage.add( imageActor ); +@endcode + +For a more detailed example see the ShaderEffect example in the JavaScript documentation. + +
+
+@section property-use-example-json Property use in JSON + +This is a basic example of a button defined in JSON by setting the default properties. + +@code +{ + "constants": { + "CONFIG_SCRIPT_LOG_LEVEL": "Verbose" + }, + "stage": [ + // First Button + { + "type": "PushButton", + "parent-origin": "TOP_CENTER", + "anchor-point": "TOP_CENTER", + "position": [0, 0, 0], + "size": [0, 200, 0], + "normal-state-actor": { + "type": "ImageActor", + "image": { + "filename": "{DALI_IMAGE_DIR}blocks-brick-1.png" + } + }, + "selected-state-actor": { + "type": "ImageActor", + "image": { + "filename": "{DALI_IMAGE_DIR}blocks-brick-2.png" + } + }, + "label-actor": { + "type": "TextView", + "text": "Normal" + } + } + ] +} +@endcode + * */ diff --git a/docs/content/shared-javascript-and-cpp-documentation/documentation-guide.md b/docs/content/shared-javascript-and-cpp-documentation/documentation-guide.md new file mode 100644 index 0000000..3be5549 --- /dev/null +++ b/docs/content/shared-javascript-and-cpp-documentation/documentation-guide.md @@ -0,0 +1,18 @@ +/** + * +## Writing documentation for the DALi programing guide + +To allow documentation to be shared between C++ and JavaScript, please follow these guidelines: + + - Create a mark down file (.md) using GitHub Flavoured Markdown https://help.github.com/articles/github-flavored-markdown/ + - Put it into the shared C++ / JavaScript documentation: ~dali-toolkit/docs/content/shared-javascript-and-cpp-documentation/~ + - Include code samples for both C++ and JavaScript in the mark down. + - See multi-touch-guide.md in toolkit for an example + +Why use GitHub flavoured markdown? + - Table support is good and language specific code blocks are easier to define ( javascript/C++). + - Doxygen and YUIDOC both support it. + + +@class Writing_DALi_Programming_Guide_Documentation +*/ diff --git a/plugins/dali-script-v8/docs/content/actor.js b/plugins/dali-script-v8/docs/content/actor.js index ce095cd..7bd5b20 100644 --- a/plugins/dali-script-v8/docs/content/actor.js +++ b/plugins/dali-script-v8/docs/content/actor.js @@ -196,8 +196,8 @@ See worldPositionX |FLOAT | ✘ | ✘ worldPositionY |FLOAT | ✘ | ✘ worldPositionZ |FLOAT | ✘ | ✘ - rotation |ROTATION | ✔ | ✔ - worldRotation |ROTATION | ✘ | ✘ + orientation |ROTATION | ✔ | ✔ + worldOrientation |ROTATION | ✘ | ✘ scale |VECTOR3 | ✔ | ✔ scaleX |FLOAT | ✔ | ✔ scaleY |FLOAT | ✔ | ✔ @@ -214,7 +214,7 @@ See name |STRING | ✔ | ✘ sensitive |BOOLEAN | ✔ | ✘ leaveRequired |BOOLEAN | ✔ | ✘ - inheritRotation |BOOLEAN | ✔ | ✘ + inheritOrientation |BOOLEAN | ✔ | ✘ inheritScale |BOOLEAN | ✔ | ✘ colorMode |NUMBER | ✔ | ✘ positionInheritance |NUMBER | ✔ | ✘ @@ -381,19 +381,19 @@ WORLD_POSITION_Z /** - * Actors rotation - * @property rotation - * @type dali Rotation object + * Actors orientation + * @property orientation + * @type dali orientation object */ -ROTATION +ORIENTATION /** - * Actors world-rotation - * @property worldRotation - * @type dali Rotation object ( read only) + * Actors world-orientation + * @property worldOrientation + * @type dali Orientation object ( read only) */ -WORLD_ROTATION +WORLD_ORIENTATION /** * Actors scale @@ -521,10 +521,10 @@ LEAVE_REQUIRED /** * Set whether a child actor inherits it's parent's orientation. * @type Boolean - * @property inheritRotation + * @property inheritOrientation * @default true */ -INHERIT_ROTATION, +INHERIT_ORIENTATION, /** @@ -644,4 +644,4 @@ POSTITION_INHERITANCE * @type Vector3 * @property sizeModeFactor */ -SIZE_MODE_FACTOR \ No newline at end of file +SIZE_MODE_FACTOR diff --git a/plugins/dali-script-v8/docs/content/camera-actor.js b/plugins/dali-script-v8/docs/content/camera-actor.js index 818bc85..71b750b 100644 --- a/plugins/dali-script-v8/docs/content/camera-actor.js +++ b/plugins/dali-script-v8/docs/content/camera-actor.js @@ -7,10 +7,10 @@ Allows the developer to use actor semantics to control a camera. There are two types of camera actor, FREE_LOOK and LOOK_AT_TARGET. By default the camera actor will be FREE_LOOK. -A FREE_LOOK camera uses actor's rotation to control where the camera is looking. +A FREE_LOOK camera uses actor's orientation to control where the camera is looking. If no additional rotations are specified, the camera looks in the negative Z direction. -For LOOK_AT_TARGET the actor's rotation is ignored, instead the camera looks at TARGET_POSITION +For LOOK_AT_TARGET the actor's orientation is ignored, instead the camera looks at TARGET_POSITION in world coordinates. ``` // get the camera currently used diff --git a/plugins/dali-script-v8/src/actors/actor-api.cpp b/plugins/dali-script-v8/src/actors/actor-api.cpp index 89a3a67..4027a1b 100644 --- a/plugins/dali-script-v8/src/actors/actor-api.cpp +++ b/plugins/dali-script-v8/src/actors/actor-api.cpp @@ -502,13 +502,13 @@ void ActorApi::GetActorType( const v8::FunctionCallbackInfo& args ) * @example * * // using an array - * actor.moveBy( [20,40,0] ); + * actor.translateBy( [20,40,0] ); * * @for Actor - * @method moveBy + * @method translateBy * @param {object} an array of 3 numbers */ -void ActorApi::MoveBy( const v8::FunctionCallbackInfo& args ) +void ActorApi::TranslateBy( const v8::FunctionCallbackInfo& args ) { v8::Isolate* isolate = args.GetIsolate(); v8::HandleScope handleScope( isolate ); @@ -532,7 +532,7 @@ void ActorApi::MoveBy( const v8::FunctionCallbackInfo& args ) DALI_SCRIPT_EXCEPTION( isolate, "Vector3 move parameter missing" ); return; } - actor.MoveBy( vector ); + actor.TranslateBy( vector ); } @@ -557,7 +557,7 @@ void ActorApi::RotateBy( const v8::FunctionCallbackInfo& args ) bool found( false ); Property::Value rotation = V8Utils::GetPropertyValueParameter( PARAMETER_0, found, isolate, args ); - if( rotation.GetType() != Property::ROTATION ) + if( rotation.GetType() != Property::ORIENTATION ) { DALI_SCRIPT_EXCEPTION( isolate, "Rotation parameter missing" ); return; @@ -608,74 +608,6 @@ void ActorApi::ScaleBy( const v8::FunctionCallbackInfo& args ) } actor.ScaleBy( vector ); } -/** - * Apply a relative scale to an actor. - * Actor opacity ranges from 0 (see through ) to 1 ( solid ) - * @example - * // reduce actor opactiy by a half - * actor.opaictyBy(-0.5); - * - * @for Actor - * @method OpacityBy - * @param {float} relative opacity - */ -void ActorApi::OpacityBy( const v8::FunctionCallbackInfo& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - Actor actor = GetActor( isolate, args ); - - // void OpacityBy(float relativeOpacity); - bool found; - float opacity = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f ); - if( !found ) - { - DALI_SCRIPT_EXCEPTION( isolate, "float parameter missing" ); - return; - } - actor.OpacityBy( opacity ); -} - -/** - * Apply a relative color change to an actor. - * - * @example - * // increase actor red by half - * actor.colorBy( [0.5, 0, 0, 0]); - * - * - * @for Actor - * @method colorBy - * @param {Object} Color JavaScript array - */ -void ActorApi::ColorBy( const v8::FunctionCallbackInfo& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - Actor actor = GetActor( isolate, args ); - - bool found; - int argCount( args.Length() ); - Vector4 color; - - if( argCount == 1 ) - { - color = V8Utils::GetVector4Parameter( PARAMETER_0, found, isolate, args ); - if( !found ) - { - DALI_SCRIPT_EXCEPTION( isolate, "Vector4 parameter missing" ); - return; - } - } - else - { - DALI_SCRIPT_EXCEPTION( isolate, "Vector4 parameter missing" ); - return; - } - - actor.ColorBy( color ); -} - } // namespace V8Plugin diff --git a/plugins/dali-script-v8/src/actors/actor-api.h b/plugins/dali-script-v8/src/actors/actor-api.h index 8b27961..9d1bb16 100644 --- a/plugins/dali-script-v8/src/actors/actor-api.h +++ b/plugins/dali-script-v8/src/actors/actor-api.h @@ -64,11 +64,9 @@ namespace ActorApi void ScreenToLocal( const v8::FunctionCallbackInfo< v8::Value >& args ); void SetKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args ); void IsKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args ); - void MoveBy( const v8::FunctionCallbackInfo< v8::Value >& args ); + void TranslateBy( const v8::FunctionCallbackInfo< v8::Value >& args ); void RotateBy( const v8::FunctionCallbackInfo< v8::Value >& args ); void ScaleBy( const v8::FunctionCallbackInfo< v8::Value >& args ); - void OpacityBy( const v8::FunctionCallbackInfo< v8::Value >& args ); - void ColorBy( const v8::FunctionCallbackInfo< v8::Value >& args ); // new function just for JavaScript API, to help developers know what type of actor // they're dealing with, returns actor name as a string diff --git a/plugins/dali-script-v8/src/actors/actor-wrapper.cpp b/plugins/dali-script-v8/src/actors/actor-wrapper.cpp index dded413..6f2d6f0 100644 --- a/plugins/dali-script-v8/src/actors/actor-wrapper.cpp +++ b/plugins/dali-script-v8/src/actors/actor-wrapper.cpp @@ -211,17 +211,17 @@ const ActorFunctions ActorFunctionTable[]= // ignore. GetCurrentSize() use Actor.size // ignore. SetPosition(....) use Actor.position // ignore. SetX, SetY, SetZ, use Actor.position.x, Actor.position.y, Actor.position.z - { "MoveBy", ActorApi::MoveBy, ACTOR_API }, + { "TranslateBy", ActorApi::TranslateBy, ACTOR_API }, // ignore GetCurrentPosition(). use Actor.position // ignore GetCurrentWorldPosition() use Actor.worldPosition // ignore SetPositionInheritanceMode() use Actor.positionInheritance // ignore GetPositionInheritanceMode() use Actor.positionInheritance - // ignore SetRotation() use Actor.rotation + // ignore SetOrientation() use Actor.orientation { "RotateBy", ActorApi::RotateBy, ACTOR_API }, - // ignore GetCurrentRotation() use Actor.rotation - // ignore SetInheritRotation() use Actor.inheritRotation - // ignore IsRotationInherited() use Actor.inheritRotation - // ignore GetCurrentWorldRotation() use Actor.worldRotation + // ignore GetCurrentOrientation() use Actor.orientation + // ignore SetInheritOrientation() use Actor.inheritOrientation + // ignore IsOrientationInherited() use Actor.inheritOrientation + // ignore GetCurrentWorldOrientation() use Actor.worldOrientation // ignore SetScale() use Actor.scale { "ScaleBy", ActorApi::ScaleBy, ACTOR_API }, // ignore GetCurrentScale() use Actor.scale @@ -232,10 +232,8 @@ const ActorFunctions ActorFunctionTable[]= // ignore SetVisible() use Actor.visible // ignore IsVisible() use Actor.visible // ignore SetOpacity() use Actor.opacity - { "OpactiyBy", ActorApi::OpacityBy, ACTOR_API }, // ignore GetCurrentOpacity() use Actor.opacity // ignore SetColor() use Actor.color - { "ColorBy", ActorApi::ColorBy, ACTOR_API }, // ignore GetCurrentColor() use Actor.color // ignore SetColorMode() use Actor.colorMode // ignore GetColorMode() use Actor.colorMode diff --git a/plugins/dali-script-v8/src/module-loader/module-loader.cpp b/plugins/dali-script-v8/src/module-loader/module-loader.cpp index c9d58ea..39b23d2 100644 --- a/plugins/dali-script-v8/src/module-loader/module-loader.cpp +++ b/plugins/dali-script-v8/src/module-loader/module-loader.cpp @@ -170,11 +170,11 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * * * // ImageActor.js - * function ImageActor( position, rotation, image, name ) + * function ImageActor( position, orientation, image, name ) * { * this = new dali.ImageActor( image ); * this.position = position; - * this.rotation = rotation; + * this.orientation = orientation; * this.name = name; * } * module.exports = ImageActor; @@ -185,7 +185,7 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * * var ImageActor = require(" ImageActor.js"); * - * var imageActor = new ImageActor( position, rotation, image, "my first image actor"); + * var imageActor = new ImageActor( position, orientation, image, "my first image actor"); * * #### Exporting as a singleton *