--- /dev/null
+Testing environment {#auto_testing}
+===================
+
+The new test environment from Tizen is the Web-TCT test suite. This was written for testing web components, but can easily be used for testing Dali.
+
+Each of the DALi repositories, **dali-core**, **dali-adaptor** and **dali-toolkit**, have their own test suites under the `automated-tests` folder. Within the src folder are a number of secondary folders - these correspond to 'managed' tests (for testing the frozen API for products), unmanaged tests (tests for other APIs) and internal (for desktop testing only)
+
+Installation
+------------
+
+There are usage instructions and installation instructions on the Tizen.org website [here](http://download.tizen.org/tct/2.2.1/Manual/Web_TCT_2.2.1_User_Guide_v1.0.pdf)
+
+These are device specific instructions, however, installing the test suite will also provide the relevant packages for running tests on Ubuntu ( follow the first block of quickstart instructions below ).
+
+If you are planning on running tests on device, then flash your handset with latest image, or turn off ssh: `set_usb_debug.sh --mtp-sdb` and plug it in, then follow the quickstart instructions repeated below.
+
+Quickstart
+----------
+
+For target or desktop testing:
+
+ cd ~/Packages
+ wget http://download.tizen.org/tct/2.2.1/2.2.1_r1/web-tct_2.2.1_r1.tar.gz
+ sudo tar xzf web-tct_2.2.1_r1.tar.gz
+ cd web-tct_2.2.1_r1/tools
+ sudo -E ./tct-config-host.sh
+
+
+If you are planning on running tests on device, then plug in your freshly flashed device and run the following commands:
+
+ sudo apt-get install sdb
+ ./tct-config-device.sh
+
+**NOTE:** After flashing a handset, you will need to run this step of the installation again.
+
+Testing on desktop
+==================
+
+Building libraries with coverage options
+----------------------------------------
+
+Building dali core:
+
+ cd dali-core # the location of your dali-core repository
+ cd build/tizen
+ export CC=gcc
+ export CXX=g++
+ git clean -fxd . # Only do this in the build folder
+ autoreconf --install
+ CXXFLAGS='-g -O0 --coverage' LDFLAGS='--coverage' ./configure --prefix=$DESKTOP_PREFIX --enable-debug
+ make -j8 install
+
+Repeat for dali-adaptor and toolkit.
+
+Note, you __must__ use a local build and not a distributed build, and you __must__ also build with debug enabled to allow *DALI_ASSERT_DEBUG* to trigger on wrong behaviour ( Which should always be a test case failure! )
+
+Building the tests
+------------------
+
+Run the following commands:
+
+ cd automated-tests
+ ./build.sh
+
+This will build dali, dali-unmanaged and dali-internal test sets.
+
+Test sets can be built individually:
+
+ ./build.sh dali-unmanaged
+
+They can also be built without regenerating test case scripts (Useful for quicker rebuilds)
+
+ ./build.sh -n dali-internal
+
+Or without cleaning down the build area (Useful for fast build/run/debug cycles)
+
+ ./build.sh -n -r dali-internal
+
+
+Executing the tests
+-------------------
+
+To execute tests, cd into automated-tests and run
+
+ ./execute.sh
+
+This will execute dali, dali-unmanaged and dali-internal test sets. Note that the output summary for the first will be printed before running the second.
+
+To execute a subset of tests, you can run individual test sets, e.g.
+
+ ./execute.sh dali
+
+or for finer granularity, specify a test source file:
+
+ ./execute.sh dali utc-Dali-Actor.cpp
+
+To see the results, you can open the summary.xml in firefox.
+
+ firefox --new-window summary.xml
+
+To get coverage output, run
+
+ ./coverage.sh
+
+
+Testing on target
+=================
+
+To build for target, first build and install dali-core, dali-adaptor and dali-toolkit, then build dali-capi without --keep-packs option.
+
+You will need to install libconfig-tiny-perl:
+
+sudo apt-get install libconfig-tiny-perl
+
+If you use a non-standard `GBS_ROOT` then you will need to edit the tcbuild script to match your configuration - change line 96 and add a -B option with your GBS-ROOT path (line 96 = `gbs build -A armv7l --spec core-$1-tests.spec --include-all --keep-packs` ).
+To install on device from a non-standard GBS_ROOT, also modify line 28 (`RPM_DIR="$HOME/GBS-ROOT/local/repos/$PROFILE/armv7l/RPMS"`).
+
+For core Dali cd into automated-tests, and use:
+
+sudo ./tcbuild build dali
+
+ sudo ./tcbuild build dali-unmanaged
+ ./tcbuild install dali
+ ./tcbuild install dali-unmanaged
+
+For Dali Adaptor, cd into automated-tests, and use:
+
+ sudo ./tcbuild build dali-adaptor
+ sudo ./tcbuild build dali-adaptor-unmanaged # < Currently failing as needs a ".spec" file.
+ sudo ./tcbuild build dali-platform-abstraction
+ ./tcbuild install dali-adaptor
+ ./tcbuild install dali-adaptor-unmanaged
+ ./tcbuild install dali-platform-abstraction
+
+Ensure your handset's filesystem is writable:
+
+ sdb shell su -c "change-booting-mode.sh --update"
+
+To execute tests, cd into automated-tests and run
+
+ tct-mgr
+
+This will bring up the java test suite program. You should see the Plan pane with a list of all tests in. Select the tct-dali-core-tests and tct-dali-unmanaged-tests. and you will be offered a dialog to choose a test plan: either create a new one or use temp.
+Select dali test suite, and click Run, then "Create a new plan", and call it "Dali-Core" or some such. It will now run the dali-test suite.
+
+You can find the output files under /opt/tct/manager/result/
+
+
+Adding tests
+============
+
+To Managed API
+--------------
+
+If you are adding test cases for new or existing managed API (CAPI), you need to add your changes to the src/dali mirror, and copy your change to the managed test suite in core-api. You need to inform HQ of your update.
+
+To Unmanaged API
+----------------
+
+If you are adding test cases for unmanaged API, you need to add your changes to the src/dali-unmanaged test suite.
+
+For internal API
+----------------
+
+If you are adding tests for internal API, then this will only work on desktop, and you should add your tests to the src/dali-internal test suite.
+
+General
+-------
+
+If you are adding test cases to existing files, then all you need to do is create functions with the method signature
+
+ int UtcTestcase(void)
+ {
+ TestApplication application;
+ ...
+ END_TEST;
+ }
+
+
+Note that **there must be no extra whitespace in the method signature** (i.e., it must violate our coding convention and follow __exactly__ this pattern: `int UtcDaliMyTestcaseName(void)`), as it's parsed by an awk script to auto-generate the testcase arrays in the main header file.
+
+You can contine to use the TET api, e.g. `tet_infoline`, `tet_result` and our test check methods `DALI_TEST_CHECK`, `DALI_TEST_EQUALS`, etc.
+
+If you need any non-test methods or variables, ensure they are wrapped in an anonymous namespace.
+
+If you are adding new test files, then you need to add the filename to the SET(TC_SOURCES...
+section of CMakeLists.txt (this is also parsed by an awk script prior to building)
+
+Debugging
+=========
+
+On desktop, you can debug the tests by running gdb on the test program:
+
+ $ cd automated-tests
+ $ gdb build/src/dali/tct-dali-core
+ gdb> r <TestCase>
+
+replace `<TestCase>` with the name of the failing testcase.
+
+For example, using testcase UtcDaliNinePatch01 from the dali-core unmanaged test suite:
+
+ $ gdb build/src/dali-unmanaged/tct-dali-unmanaged-core
+ gdb> r UtcDaliNinePatch01
+
+
+On target, you can re-install the test RPM and associated debug RPMs manually using
+
+ sdb push <test-package>.rpm /tmp
+
+After installing the rpm and it's debug RPMs, you can find the executable in /opt/usr/bin/tct-dali-core. First ensure you have smack permissions set:
+
+ chsmack -e "^" /usr/bin/gdb
+ chsmack -e "^" /opt/usr/bin/tct-dali-core/tct-dali-core
+
+then run it under gdb as above.
+
+
+Troubleshooting
+===============
+
+If when running tct-mgr tests, if "Health-Check get" fails and leaves a white screen on the device, you will need to run `tct-config-device.sh` from your `web-tct/tools` directory (wherever you untarred it) and power cycle your handset. If that still fails, you can work-around the issue by running "`mkdir –p /opt/usr/media/Documents/tct/`" on target – you may also need to kill the getCapabilities app from App Manager on the handset)
+
+If the test results show that the test cases fail with "Undefined reference to XXX", it means you have probably failed to update the dali packages on target.
+
+If all the tests are failing then make sure that you have enabled the engineering mode on the target with the 'change-booting-mode.sh --update' command in sdb shell, as the tests may not have installed correctly.
print RESULTS_OUT "<?xml-stylesheet type=\"text/xsl\" href=\"./style/testresult.xsl\"?>\n";
while(<RESULTS>)
{
- print RESULTS_OUT $_;
+ if( ! /xml-stylesheet/ )
+ {
+ print RESULTS_OUT $_;
+ }
}
close RESULTS_OUT;
close RESULTS;
# List of test case sources (Only these get parsed for test cases)
SET(TC_SOURCES
- utc-Dali-AlbumLayout.cpp
utc-Dali-BendyEffect.cpp
utc-Dali-BlindEffect.cpp
utc-Dali-BloomView.cpp
+++ /dev/null
-/*
- * 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 <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-using namespace Dali;
-
-using namespace Toolkit;
-
-using namespace std;
-
-
-namespace
-{
-
-Vector3 AlbumLayoutItemSizeFunction(const Vector3& layoutSize)
-{
- float width = layoutSize.width * 0.2f;
- return Vector3(width, width, width);
-}
-
-float AlbumLayoutAlbumRadiusFunction(const Vector3& layoutSize)
-{
- return layoutSize.width * 0.5f;
-}
-} // namespace
-
-
-void album_layout_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void album_layout_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliAlbumLayoutNew(void)
-{
- ToolkitTestApplication application;
-
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- DALI_TEST_CHECK(albumLayout);
- END_TEST;
-}
-
-int UtcDaliAlbumSetAndGetItemSizeFunction(void)
-{
- ToolkitTestApplication application;
-
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- // Set the item size function
- albumLayout->SetItemSizeFunction(AlbumLayoutItemSizeFunction);
-
- // Check whether we get the correct item size function
- DALI_TEST_CHECK(albumLayout->GetItemSizeFunction() == AlbumLayoutItemSizeFunction);
- END_TEST;
-}
-
-int UtcDaliAlbumSetAndGetScrollSpeedFactor(void)
-{
- ToolkitTestApplication application;
-
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- // Set the scroll speed factor
- albumLayout->SetScrollSpeedFactor(0.05f);
-
- // Check whether we get the correct scroll speed factor
- DALI_TEST_EQUALS( albumLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAlbumSetAndGetMaximumSwipeSpeed(void)
-{
- ToolkitTestApplication application;
-
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- // Set the maximum swipe speed
- albumLayout->SetMaximumSwipeSpeed(50.0f);
-
- // Check whether we get the correct maximum swipe speed
- DALI_TEST_EQUALS( albumLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration(void)
-{
- ToolkitTestApplication application;
-
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- // Set the flick animaiton duration
- albumLayout->SetItemFlickAnimationDuration(0.35f);
-
- // Check whether we get the correct flick animaiton duration
- DALI_TEST_EQUALS( albumLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAlbumSetNumOfItems(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetNumOfItems(15);
-
- DALI_TEST_CHECK(albumLayout->GetNumOfItems() == 15);
- END_TEST;
-}
-
-int UtcDaliAlbumSetStackNum(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetStackNum(30);
-
- DALI_TEST_CHECK(albumLayout->GetStackNum() == 30);
- END_TEST;
-}
-
-int UtcDaliAlbumSetPosition(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- std::vector<Vector3> position_list;
-
- /*(0.0f)*/
- Vector3 pos = Vector3(850.0f,-250.0f,0.0);
- position_list.push_back(pos);
-
- /*(1.0f)*/
- pos = Vector3(700.0f,50.0f,0.0);
- position_list.push_back(pos);
-
- /*(2.0f)*/
- pos = Vector3(440.0f,227.0f,0.0);
- position_list.push_back(pos);
-
- /*(4.0f)*/
- pos = Vector3(-440.0f,227.0f,0.0);
- position_list.push_back(pos);
-
- /*(5.0f)*/
- pos = Vector3(-700.0f,50.0f,0.0);
- position_list.push_back(pos);
-
- /*(6.0f)*/
- pos = Vector3(-850.0f,-250.0f,0.0);
- position_list.push_back(pos);
-
- albumLayout->SetPosition(position_list);
-
- DALI_TEST_CHECK(albumLayout->GetPosition() == position_list);
- END_TEST;
-}
-
-int UtcDaliAlbumSetRotationX(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetRotationX(Math::PI/4.0f);
-
- DALI_TEST_CHECK(albumLayout->GetRotationX() == Math::PI/4.0f);
- END_TEST;
-}
-
-int UtcDaliAlbumSetRotationZ(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- std::vector<float> rotation_list;
-
- /*(0.0f)*/
- float rotate = Math::PI/6.0f;
- rotation_list.push_back(rotate);
-
- /*(1.0f)*/
- rotate = 0.0f;
- rotation_list.push_back(rotate);
-
- /*(2.0f)*/
- rotate = Math::PI/6.0f;
- rotation_list.push_back(rotate);
-
- /*(4.0f)*/
- rotate = -Math::PI/6.0f;
- rotation_list.push_back(rotate);
-
- /*(5.0f)*/
- rotate = 0.0f;
- rotation_list.push_back(rotate);
-
- /*(6.0f)*/
- rotate = -Math::PI/6.0f;
- rotation_list.push_back(rotate);
-
- albumLayout->SetRotationZ(rotation_list);
-
- DALI_TEST_CHECK(albumLayout->GetRotationZ() == rotation_list);
- END_TEST;
-}
-
-int UtcDaliAlbumSetScale(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- std::vector<float> scale_list;
-
- /*(0.0f)*/
- float scale = 1.0f;
- scale_list.push_back(scale);
-
- /*(1.0f)*/
- scale = 0.0f;
- scale_list.push_back(scale);
-
- /*(2.0f)*/
- scale = Math::PI/6.0f;
- scale_list.push_back(scale);
-
- /*(4.0f)*/
- scale = -Math::PI/6.0f;
- scale_list.push_back(scale);
-
- /*(5.0f)*/
- scale = 0.0f;
- scale_list.push_back(scale);
-
- /*(6.0f)*/
- scale = -Math::PI/6.0f;
- scale_list.push_back(scale);
-
- albumLayout->SetScale(scale_list);
-
- DALI_TEST_CHECK(albumLayout->GetScale() == scale_list);
- END_TEST;
-}
-
-int UtcDaliAlbumSetColor(void)
-{
- // Create a album layout
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- std::vector<Vector2> color_list;
-
- /*(0.0f)*/
- Vector2 color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- /*(1.0f)*/
- color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- /*(2.0f)*/
- color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- /*(4.0f)*/
- color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- /*(5.0f)*/
- color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- /*(6.0f)*/
- color = Vector2(1.0f,1.0f);
- color_list.push_back(color);
-
- albumLayout->SetColor(color_list);
-
- DALI_TEST_CHECK(albumLayout->GetColor() == color_list);
- END_TEST;
-}
-
-int UtcDaliAlbumSetCenterPosition(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetCenterPosition(Vector3( 0.0f,-80.0f,100.0f));
-
- DALI_TEST_CHECK(albumLayout->GetCenterPosition() == Vector3( 0.0f,-80.0f,100.0f));
- END_TEST;
-}
-
-int UtcDaliAlbumSetSetCenterScale(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetCenterScale(1.75f);
-
- DALI_TEST_CHECK(albumLayout->GetCenterScale() == 1.75f);
- END_TEST;
-}
-
-int UtcDaliAlbumSetSetCenterColor(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetCenterColor(Vector2(1.0f,1.0f));
-
- DALI_TEST_CHECK(albumLayout->GetCenterColor() == Vector2(1.0f,1.0f));
- END_TEST;
-}
-
-int UtcDaliAlbumSetStackPosition(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetStackPosition(Vector3(750.0f,-500.0f,0.0f),Vector3(-750.0f,-500.0f,0.0f));
-
- DALI_TEST_CHECK(albumLayout->GetRightStackPosition() == Vector3(750.0f,-500.0f,0.0f) && albumLayout->GetLeftStackPosition() == Vector3(-750.0f,-500.0f,0.0f));
- END_TEST;
-}
-
-int UtcDaliAlbumSetSetStackScale(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetStackScale(1.0f,1.0f);
-
- DALI_TEST_CHECK(albumLayout->GetRightStackScale() == 1.0f && albumLayout->GetLeftStackScale() == 1.0f);
- END_TEST;
-}
-
-int UtcDaliAlbumSetStackColor(void)
-{
- AlbumLayoutPtr albumLayout = AlbumLayout::New();
-
- albumLayout->SetStackColor(Vector2(1.0f,1.0f),Vector2(1.0f,1.0f));
-
- DALI_TEST_CHECK(albumLayout->GetRightStackColor() == Vector2(1.0f,1.0f) && albumLayout->GetLeftStackColor() == Vector2(1.0f,1.0f));
- END_TEST;
-}
void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
void DummyControlImplOverride::OnThemeChange(StyleManager change) { themeChangeCalled = true;}
void DummyControlImplOverride::OnFontChange(bool defaultFontChange, bool defaultFontSizeChange) { fontChangeCalled = true; }
-void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; }
-void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; }
-void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; }
-void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; }
+void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
+void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
+void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
+void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; }
void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
virtual void OnInitialize();
virtual void OnThemeChange( StyleManager styleManager );
virtual void OnFontChange(bool defaultFontChange, bool defaultFontSizeChange);
- virtual void OnPinch(PinchGesture pinch);
- virtual void OnPan(PanGesture pan);
- virtual void OnTap(TapGesture tap);
- virtual void OnLongPress(LongPressGesture longPress);
+ virtual void OnPinch(const PinchGesture& pinch);
+ virtual void OnPan(const PanGesture& pan);
+ virtual void OnTap(const TapGesture& tap);
+ virtual void OnLongPress(const LongPressGesture& longPress);
private: // From CustomActorImpl
END_TEST;
}
-int UtcDaliScrollViewTwistEffectSetup(void)
-{
- tet_infoline(" UtcDaliScrollViewTwistEffectSetup");
-
- ScrollViewTwistEffect effect;
-
- DALI_TEST_CHECK( !effect );
-
- BaseHandle handle = ScrollViewTwistEffect::New();
-
- DALI_TEST_CHECK( handle );
-
- effect = ScrollViewTwistEffect::DownCast(handle);
-
- DALI_TEST_CHECK( effect );
- END_TEST;
-}
-
int UtcDaliScrollViewCubeEffectTest(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliScrollViewTwistEffectTest(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewTwistEffectTest");
-
- Vector2 size = Stage::GetCurrent().GetSize();
-
- ScrollView scrollView = SetupTestScrollView(1, 3, size);
- Actor testPage = gPages[1];
- Wait(application, 500);
-
- ScrollViewTwistEffect effect = ScrollViewTwistEffect::New();
- float shrinkDist = 0.2f;
- effect.SetMinimumDistanceForShrink(shrinkDist);
- DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0);
- effect.EnableEffect(true);
- scrollView.ApplyEffect(effect);
-
- Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3);
- Wait(application);
- Vector3 actorPrePosition = actor.GetCurrentPosition();
-
- effect.ApplyToActor( actor,
- true,
- Vector2(Math::PI_2, Math::PI_2),
- 0.0f);
-
- scrollView.ScrollTo(1);
- while(!gOnScrollCompleteCalled)
- {
- Wait(application);
- }
- // test that the first page has reached centre of screen
- Vector3 actorPostPosition = actor.GetCurrentPosition();
- // just check the actor has moved
- DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1);
- CleanupTest();
- END_TEST;
-}
-
int UtcDaliScrollViewCustomEffectTest(void)
{
ToolkitTestApplication application;
{
if( Property::INVALID_INDEX == index )
{
- index = actor.RegisterProperty( key, value );
+ actor.RegisterProperty( key, value );
}
else
{
default:
{
DALI_ASSERT_ALWAYS( !"Property type incorrect" );
- return Property::Value();
}
}
}
void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
{
- DALI_ASSERT_ALWAYS( format == Dali::Toolkit::Builder::JSON && "Currently only JSON is supported" );
-
// parser to get constants and includes only
Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
std::string actorName;
std::string actionName;
std::string childAlias;
- std::vector<Property::Value> parameters;
+ PropertyValueContainer parameters;
void operator()(void)
{
{
std::string actorName;
std::string actionName;
- std::vector<Property::Value> parameters;
+ PropertyValueContainer parameters;
void operator()(void)
{
* Gets Parmeter list from child
* params is be cleared before insertion
*/
-void GetParameters(const TreeNode &child, std::vector<Property::Value> ¶ms)
+void GetParameters(const TreeNode& child, PropertyValueContainer& params)
{
if( OptionalChild c = IsChild(child, "parameters") )
{
{
f = IsFloat( IsChild(child, "min") );
}
+
DALI_ASSERT_ALWAYS(f && "Notification condition for arg0 not specified");
- if(f)
- {
- return *f;
- }
- else
- {
- return 0.f;
- }
+
+ return *f;
}
/**
{
f = IsFloat( IsChild(child, "max") );
}
+
DALI_ASSERT_ALWAYS(f && "Notification condition for arg1 not specified");
- if(f)
- {
- return *f;
- }
- else
- {
- return 0.f;
- }
+
+ return *f;
}
{}
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- ScaleToFillConstraint( const ScaleToFillConstraint& rhs )
- : mPadding( rhs.mPadding )
- {}
-
- /**
* Called by render thread
*/
Vector3 operator()( const Vector3& currentSize,
{}
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- ScaleToFitKeepAspectConstraint( const ScaleToFitKeepAspectConstraint& rhs )
- : mPadding( rhs.mPadding ),
- mSizeStored( rhs.mSizeStored ),
- mOriginalSize( rhs.mOriginalSize )
- {}
-
- /**
* Called by render thread
*/
Vector3 operator()( const Vector3& currentSize,
{ }
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- ScaleToFillKeepAspectConstraint( const ScaleToFillKeepAspectConstraint& rhs )
- : mPadding( rhs.mPadding ),
- mSizeStored( rhs.mSizeStored ),
- mOriginalSize( rhs.mOriginalSize )
- {}
-
- /**
* Called by render thread
*/
Vector3 operator()( const Vector3& currentSize,
{}
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- ShrinkToFitConstraint( const ShrinkToFitConstraint& rhs )
- : mPadding( rhs.mPadding ),
- mSizeStored( rhs.mSizeStored ),
- mOriginalSize( rhs.mOriginalSize )
- { }
-
- /**
* Called by render thread
*/
Vector3 operator()( const Vector3& currentSize,
{}
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- ShrinkToFitKeepAspectConstraint( const ShrinkToFitKeepAspectConstraint& rhs )
- : mPadding( rhs.mPadding ),
- mSizeStored( rhs.mSizeStored ),
- mOriginalSize( rhs.mOriginalSize )
- { }
-
- /**
* Called by render thread
*/
Vector3 operator()( const Vector3& currentSize,
{}
/**
- * CopyConstructor. Used by Boost.
- * @param rhs Copying from.
- */
- PositionConstraint( const PositionConstraint& rhs )
- : mPadding( rhs.mPadding ),
- mHorizontalAlignment( rhs.mHorizontalAlignment ),
- mVerticalAlignment( rhs.mVerticalAlignment )
- {}
-
- /**
* Called by render thread.
*/
Vector3 operator()( const Vector3& currentPosition,
}
}
-void Button::OnTap(Actor actor, TapGesture tap)
+void Button::OnTap(Actor actor, const TapGesture& tap)
{
// Do nothing.
}
* @param[in] actor The tapped actor.
* @param[in] tap The tap gesture.
*/
- void OnTap(Actor actor, TapGesture tap);
+ void OnTap(Actor actor, const TapGesture& tap);
private:
void CheckBoxButton::OnActivated()
{
// When the button is activated, it performs the click action
- std::vector<Property::Value> attributes;
+ PropertyValueContainer attributes;
DoClickAction(attributes);
}
}
}
-bool CheckBoxButton::DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool CheckBoxButton::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
{
bool ret = false;
CheckBoxButton::CheckBoxButton()
: Button(),
mChecked( false ),
- mClickActionPerforming(false)
+ mClickActionPerforming(false),
+ mUseFadeAnimationProperty(Property::INVALID_INDEX),
+ mUseCheckAnimationProperty(Property::INVALID_INDEX)
{
// Creates specific painter.
mPainter = new CheckBoxButtonDefaultPainter();
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
protected: // From Button
void PushButton::OnActivated()
{
// When the button is activated, it performs the click action
- std::vector<Property::Value> attributes;
+ PropertyValueContainer attributes;
DoClickAction(attributes);
}
}
}
-bool PushButton::DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool PushButton::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
{
bool ret = false;
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
/**
* Construct a new PushButton.
#include <dali-toolkit/public-api/focus-manager/focus-manager.h>
using namespace Dali;
-using namespace std;
namespace
{
mShowing(false),
mState(Toolkit::Popup::POPUP_NONE), // Initially, the popup state should not be set, it's set in OnInitialize
mAlterAddedChild(false),
- mPopupStyle(PopupStylePtr(&style))
+ mPopupStyle(PopupStylePtr(&style)),
+ mPropertyTitle(Property::INVALID_INDEX),
+ mPropertyState(Property::INVALID_INDEX)
{
SetKeyboardNavigationSupport( true );
}
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
mIsPanning(false),
mCurrentScrollPosition(0.0f),
mIndicatorHeightPolicy(Toolkit::ScrollBar::Variable),
- mIndicatorFixedHeight(DEFAULT_INDICATOR_FIXED_HEIGHT)
+ mIndicatorFixedHeight(DEFAULT_INDICATOR_FIXED_HEIGHT),
+ mPropertyIndicatorPosition(Property::INVALID_INDEX)
{
}
meshActor.SetAffectedByLighting(false);
Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( "", MESH_FRAGMENT_SHADER,
- GEOMETRY_TYPE_MESH,
+ GEOMETRY_TYPE_UNTEXTURED_MESH,
Dali::ShaderEffect::HINT_BLENDING );
meshActor.SetShaderEffect(shaderEffect);
mRefreshOrderHint(true/*Refresh item 0 first*/),
mMinimumSwipeSpeed(DEFAULT_MINIMUM_SWIPE_SPEED),
mMinimumSwipeDistance(DEFAULT_MINIMUM_SWIPE_DISTANCE),
+ mMouseWheelScrollDistanceStep(0.0f),
mScrollDistance(0.0f),
mScrollSpeed(0.0f),
mTotalPanDisplacement(Vector2::ZERO),
mIsFlicking(false),
mGestureState(Gesture::Clear),
mAddingItems(false),
+ mPropertyPosition(Property::INVALID_INDEX),
+ mPropertyMinimumLayoutPosition(Property::INVALID_INDEX),
+ mPropertyScrollSpeed(Property::INVALID_INDEX),
mRefreshEnabled(true),
mItemsParentOrigin( ParentOrigin::CENTER),
mItemsAnchorPoint( AnchorPoint::CENTER)
void ItemView::SetRefreshInterval(float intervalLayoutPositions)
{
- if(mRefreshIntervalLayoutPositions != intervalLayoutPositions)
+ if( !Equals(mRefreshIntervalLayoutPositions, intervalLayoutPositions) )
{
mRefreshIntervalLayoutPositions = intervalLayoutPositions;
return clamppedPosition;
}
-void ItemView::OnPan(PanGesture gesture)
+void ItemView::OnPan( const PanGesture& gesture )
{
Actor self = Self();
const Vector3 layoutSize = Self().GetCurrentSize();
void ItemView::GetItemsRange(ItemRange& range)
{
- range.begin = mItemPool.begin()->first;
- range.end = mItemPool.rbegin()->first + 1;
+ if( !mItemPool.empty() )
+ {
+ range.begin = mItemPool.begin()->first;
+ range.end = mItemPool.rbegin()->first + 1;
+ }
+ else
+ {
+ range.begin = 0;
+ range.end = 0;
+ }
}
void ItemView::OnScrollPositionChanged( float position )
*
* @param[in] gesture The gesture event.
*/
- void OnPan(PanGesture pan);
+ void OnPan( const PanGesture& pan );
/**
* Helper to handle anchoring animations.
{
mScrollOvershootAnimation.FinishedSignal().Disconnect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished );
mScrollOvershootAnimation.Stop();
- mScrollOvershootAnimation.Clear();
- mScrollOvershootAnimation = NULL;
+ mScrollOvershootAnimation.Reset();
}
mScrollOvershootAnimation = Animation::New(duration);
mScrollOvershootAnimation.FinishedSignal().Connect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished );
}
mScrollOvershootAnimation.FinishedSignal().Disconnect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished );
mScrollOvershootAnimation.Stop();
- mScrollOvershootAnimation.Clear();
- mScrollOvershootAnimation = NULL;
+ mScrollOvershootAnimation.Reset();
mAnimationStateFlags = 0;
if( animateOff )
{
mSwingAnchorAlphaFunctionIn(swingAnchorAlphaFunctionIn), mSwingAnchorAlphaFunctionOut(swingAnchorAlphaFunctionOut),
mTranslateAlphaFunctionIn(translateAlphaFunctionIn), mTranslateAlphaFunctionOut(translateAlphaFunctionOut),
mOpacityAlphaFunctionIn(opacityAlphaFunctionIn), mOpacityAlphaFunctionOut(opacityAlphaFunctionOut),
+ mWrap(false),
mPanning(false),
mScrolling(false),
mWasOutsideView(true),
+ mIsStraightOnView(false),
+ mWasStraightOnView(false),
mWrapped(false),
mWasWrapped(false),
+ mCanChangeDirection(false),
mSkipConstraints(false),
mPassedCentreThisFrame(false),
mForceDirectionUpdate(true),
+ mDirectionChanged(false),
mDirectionFlags(0),
mLastDirectionFlags(0),
+ mCurrentSwingAngle(0.f),
+ mCurrentOpacity(0.f),
mCurrentOpacityAlphaFunction(NULL)
{
}
}
const Vector3& pageSize = pageSizeProperty.GetVector3();
+
// Don't have enough parameters, to provide Wrap mode (need a way of having 'uniforms' instead of scrollWrap.GetBoolean())
- const bool wrap = true;
- if(wrap)
- {
- const Vector3& min = scrollPositionMin.GetVector3();
- const Vector3& max = scrollPositionMax.GetVector3();
+ const Vector3& min = scrollPositionMin.GetVector3();
+ const Vector3& max = scrollPositionMax.GetVector3();
- if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
- {
- // WRAP X (based on the position of the right side)
- position.x = WrapInDomain(position.x + pageSize.x, min.x, max.x) - pageSize.x;
- }
+ if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
+ {
+ // WRAP X (based on the position of the right side)
+ position.x = WrapInDomain(position.x + pageSize.x, min.x, max.x) - pageSize.x;
+ }
- if(fabsf(min.y - max.y) > Math::MACHINE_EPSILON_1)
- {
- // WRAP Y (based on the position of the bottom side)
- position.y = WrapInDomain(position.y + pageSize.y, min.y, max.y) - pageSize.y;
- }
+ if(fabsf(min.y - max.y) > Math::MACHINE_EPSILON_1)
+ {
+ // WRAP Y (based on the position of the bottom side)
+ position.y = WrapInDomain(position.y + pageSize.y, min.y, max.y) - pageSize.y;
}
// short circuit: for pages outside of view.
// TODO: Upgrade to use a more powerful gesture detector (one that supports multiple touches on pan - so works as pan and flick gesture)
// BUG: Gesture::Finished doesn't always return velocity on release (due to
// timeDelta between last two events being 0 sometimes, or posiiton being the same)
-void ScrollView::OnPan(PanGesture gesture)
+void ScrollView::OnPan( const PanGesture& gesture )
{
// Guard against destruction during signal emission
// Note that Emit() methods are called indirectly e.g. from within ScrollView::OnGestureEx()
*
* @param[in] gesture The gesture event.
*/
- void OnPan(PanGesture pan);
+ void OnPan( const PanGesture& pan);
/**
* Extension of the above gestures.
* Constructor
*/
ScrollSlideInfo()
+ : mScrollWrap(false),
+ mVertical(false)
{
}
ScrollSlideInfoPtr mScrollSlideInfo; ///< Info structure to keep track of common properties amongst many constraints.
ActiveConstraint mInfoUpdateConstraint; ///< Constraint applied to scroll-view to update Info structure.
- Animation mAnimation; ///< Animation Timer to drive the twist effect constraint.
+ Animation mAnimation; ///< Animation Timer to drive the slide effect constraint.
Animation mAnimationSnap; ///< Animation Snap (this animates from from 1.0 to 0.0 when contents snap)
- Property::Index mPropertyTime; ///< Time property used by twist effect constraint to calculate timePassed.
+ Property::Index mPropertyTime; ///< Time property used by slide effect constraint to calculate timePassed.
Property::Index mPropertyReference; ///< Reference point in scroll-contents, this point has no delay.
///< The further out from this point, the further the delay.
Property::Index mPropertyActive; ///< Property indicates the progress of the scrolling from 1.0f (scrolling) to 0.0f (fully snapped)
+++ /dev/null
-
-/*
- * 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 <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
-#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h>
-
-using namespace Dali;
-
-namespace // unnamed namespace
-{
-
-const char * const EFFECT_TIME( "ScrollViewTwistEffect::EFFECT_TIME" );
-const char * const EFFECT_REFERENCE( "ScrollViewTwistEffect::EFFECT_REFERENCE" );
-const char * const EFFECT_DEPTH( "ScrollViewTwistEffect::EFFECT_DEPTH");
-const char * const EFFECT_ACTIVATE( "ScrollViewTwistEffect::EFFECT_ACTIVATE");
-
-const float TWISTEFFECT_ANIMATION_MAX_TIME = 60.0f; ///< Animation time (every time finishes, checks if it needs to go again)
-const float TWISTEFFECT_DEFAULT_DROPOFF = 0.7f; ///< Default drop off amount
-const float TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_X = 720.0f; ///< Default drop off distance
-const float TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_Y = 1280.0f; ///< Default drop off distance
-
-// Hop Easing equation.
-// Starts with a -ve cosine ranging from 0 to pi.
-// Then plateaus.
-// Then finishes with a -ve cosine ranging from pi to 0
-// 0......(RISE).....PI (SUSTAIN) PI.....(FALL)......0
-// xxxxxxxxxxxxxxxxxxxxx
-// x x
-// x x
-// x x
-// x x
-// x x
-// x x
-// xxxxxx xxxxxx
-
-const float HOP_RISE(0.25f);
-const float HOP_FALL(0.5f);
-const float DELAY(0.5f);
-
-float HopEasing(float progress)
-{
- // progress from 0.0 - HOP_RISE (go from 0.0 to 1.0)
- if(progress < HOP_RISE)
- {
- return 0.5f - cosf(progress/HOP_RISE * Math::PI) * 0.5f;
- }
-
- progress += HOP_FALL - 1.0f;
-
- // progress from 0.0 - HOP_FALL (go from 1.0 to 0.0)
- if(progress > 0.0f )
- {
- return 0.5f + cosf(progress/HOP_FALL * Math::PI) * 0.5f;
- }
-
- // progress at plateau.
- return 1.0f;
-}
-
-/**
- * Gets a property index. If the property doesn't already exist, then
- * it will create the property.
- * @param[in] handle The handle that owns or will own the property
- * @param[in] name The name for this property
- * @param[in] propertyValue The initial value for this property
- * @return The property index for this property is returned.
- */
-Property::Index SafeRegisterProperty( Handle& handle, const std::string& name, Property::Value propertyValue )
-{
- Property::Index index = handle.GetPropertyIndex( name );
-
- if(index == Property::INVALID_INDEX)
- {
- index = handle.RegisterProperty( name, propertyValue );
- }
-
- return index;
-}
-
-/**
- * Re-scales input value x from x0 - x1, to linearly map
- * over the values y0 - y1. Values outside of this range
- * will also conform to the trend (gradient) set.
- * @param[in] x input X value
- * @param[in] x0 input minimum bound
- * @param[in] x1 input maximum bound
- * @param[in] y0 output minimum bound
- * @param[in] y1 output maximum bound
- * @return The result of the mapping is returned.
- */
-float Rescale(float x, float x0, float x1, float y0, float y1)
-{
- return y0 + (y1 - y0) * (x - x0) / (x1-x0);
-}
-
-/**
- * Returns the value of x chasing target.
- * returns a value of x which is closer to target.
- * but limited by maxDelta. #
- * For example:
- * x = 10.0f
- * target = 50.0f
- * maxDelta = 20.0f
- * result is 30.0f (x is 20.0f units closer to target)
- * However, if x is already within maxDelta units
- * of target, x will equal target.
- * For example:
- * x = 55.0f
- * target = 50.0f
- * maxDelta = 20.0f
- * result is 50.0f (x was already within 20.0f units of target)
- */
-float Chase( float x, float target, float maxDelta )
-{
- float delta = target - x;
-
- if(delta > 0.0f)
- {
- x = std::min( x + maxDelta, target );
- }
- else
- {
- x = std::max( x - maxDelta, target );
- }
-
- return x;
-}
-
-// constraints ////////////////////////////////////////////////////////////////
-
-/**
- * ScrollTwistRotationConstraint
- *
- * Rotate constraint adjusts the angle of the Actors
- * based on actor's world-position relative to the middle of the screen.
- * When at middle of screen Angles on X and Y Axes is 0.
- * When one screen away from the middle Angle is 90 degrees (pi/2)
- */
-struct ScrollDropoffTwistRotationConstraint
-{
- /**
- * Constraint constructor
- * @param[in] angleSwing The amount the Actor should revolve in radians
- * for a given page worth of distance.
- */
- ScrollDropoffTwistRotationConstraint(const Vector2& angleSwing, const Vector2& dropOff, const Vector2& distance, AlphaFunction function)
- : mAngleSwing(angleSwing),
- mDropOff(dropOff),
- mDropOffDistance(distance),
- mDropOffFunction(function)
- {
- }
-
- /**
- * @param[in] current The current orientation of this Actor
- * @param[in] actorPositionProperty The actor's world-position property
- * @param[in] scrollOvershootXProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_X_PROPERTY_NAME)
- * @param[in] scrollOvershootYProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_Y_PROPERTY_NAME)
- * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
- * @return The new orientation of this Actor.
- */
- Quaternion operator()(const Quaternion& current,
- const PropertyInput& actorPositionProperty,
- const PropertyInput& scrollablePositionProperty,
- const PropertyInput& scrollOvershootXProperty,
- const PropertyInput& scrollOvershootYProperty,
- const PropertyInput& pageSizeProperty)
- {
- const Vector3& position = actorPositionProperty.GetVector3();
- const Vector3& parentPosition = scrollablePositionProperty.GetVector3();
- const Vector3& pageSize = pageSizeProperty.GetVector3();
- const Vector2 overshoot(scrollOvershootXProperty.GetFloat(), scrollOvershootYProperty.GetFloat());
-
- if(fabsf(overshoot.x) < Math::MACHINE_EPSILON_0 && fabsf(overshoot.y) < Math::MACHINE_EPSILON_0)
- {
- return current;
- }
-
- // get distance from centre of scrollable container
- Vector2 distance = position.GetVectorXY() - parentPosition.GetVectorXY();
-
- if( overshoot.x > 0.0f )
- {
- distance.x += pageSize.x * 0.5f;
- }
- else
- {
- distance.x -= pageSize.x * 0.5f;
- }
- distance.x = Clamp(fabsf(distance.x), 0.0f, mDropOffDistance.x);
-
- if( overshoot.y > 0.0f )
- {
- distance.y += pageSize.y * 0.5f;
- }
- else
- {
- distance.y -= pageSize.y * 0.5f;
- }
- distance.y = Clamp(fabsf(distance.y), 0.0f, mDropOffDistance.y);
-
- Vector2 angleMod = distance / mDropOffDistance;
- if(mDropOffFunction)
- {
- angleMod.x = mDropOffFunction(angleMod.x);
- angleMod.y = mDropOffFunction(angleMod.y);
- }
- angleMod = Vector2::ONE - (angleMod * mDropOff);
-
- Vector2 angle = angleMod * mAngleSwing * overshoot;
-
- Quaternion rotation = Quaternion(angle.x, Vector3::YAXIS) *
- Quaternion(-angle.y, Vector3::XAXIS) *
- current;
-
- return rotation;
- }
-
- const Vector2 mAngleSwing; ///< Maximum amount in X and Y axes to rotate.
- const Vector2 mDropOff;
- const Vector2 mDropOffDistance;
- AlphaFunction mDropOffFunction;
-};
-
-/**
- * ScrollTwistRotationConstraint
- *
- * Rotate constraint adjusts the angle of the Actors
- * based on actor's world-position relative to the middle of the screen.
- * When at middle of screen Angles on X and Y Axes is 0.
- * When one screen away from the middle Angle is 90 degrees (pi/2)
- */
-struct ScrollTwistRotationConstraint
-{
- /**
- * Constraint constructor
- * @param[in] angleSwing The amount the Actor should revolve in radians
- * for a given page worth of distance.
- */
- ScrollTwistRotationConstraint(const Vector2& angleSwing)
- : mAngleSwing(angleSwing)
- {
- }
-
- /**
- * @param[in] current The current orientation of this Actor
- * @param[in] actorPositionProperty The actor's world-position property
- * @param[in] scrollOvershootXProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_X_PROPERTY_NAME)
- * @param[in] scrollOvershootYProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_Y_PROPERTY_NAME)
- * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
- * @return The new orientation of this Actor.
- */
- Quaternion operator()(const Quaternion& current,
- const PropertyInput& scrollOvershootXProperty,
- const PropertyInput& scrollOvershootYProperty)
- {
- const Vector2 overshoot(scrollOvershootXProperty.GetFloat(), scrollOvershootYProperty.GetFloat());
-
- if( fabsf(overshoot.x) < Math::MACHINE_EPSILON_0 && fabsf(overshoot.y) < Math::MACHINE_EPSILON_0 )
- {
- return current;
- }
-
- Quaternion rotation = Quaternion(overshoot.x * mAngleSwing.x, Vector3::YAXIS) *
- Quaternion(-overshoot.y * mAngleSwing.y, Vector3::XAXIS) *
- current;
-
- return rotation;
- }
-
- const Vector2 mAngleSwing;
-};
-
-/**
- * ScrollTwistPositionConstraint
- *
- * Position constraint adjusts the position of the Actors
- * based on their parent page's position relative to the middle of the screen.
- * When at middle of the screen the position is not altered.
- * When one screen away from middle the position is rotated about it's origin + mAnchor
- */
-struct ScrollTwistPositionConstraint
-{
- /**
- * Constraint constructor
- */
- ScrollTwistPositionConstraint(float delayMin, float delayMax)
- : mDelayMin(delayMin),
- mDelayMax(delayMax),
- mCurrentDelayFactor(0.0f)
- {
- }
-
- /**
- * @param[in] current The current position
- * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME)
- * @param[in] effectReferenceProperty The point in the scroll-view where the user touched the screen
- * @param[in] effectTimeProperty The current timer. Starting from 0.0 when scroll animation/dragging
- * commences. Ensures that constraint is applied and processed every frame (to achieve the delay effect)
- * @param[in] sizeProperty The size of the ScrollView.
- * @return The new position of this Actor.
- */
- Vector3 operator()(const Vector3& current,
- const PropertyInput& pagePositionProperty,
- const PropertyInput& scrollPositionProperty,
- const PropertyInput& effectReferenceProperty,
- const PropertyInput& effectTimeProperty,
- const PropertyInput& sizeProperty,
- const PropertyInput& activateProperty)
- {
- const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
- const float& activate = activateProperty.GetFloat();
-
- if(activate < Math::MACHINE_EPSILON_0)
- {
- mScrollPosition = scrollPosition;
- return current + mScrollPosition;
- }
- const Vector3& pagePosition = pagePositionProperty.GetVector3();
- const Vector3& referencePoint = effectReferenceProperty.GetVector3();
- // Determine the relative position of the actor from the scrolling reference point.
- // (the further away from the refernce, the longer the delay should be)
- Vector3 relativePosition = pagePosition + current - referencePoint;
- float f = relativePosition.x;
-
- // f represents this absolute distance. Get as a relative distance and inverse exponential
- // (as delay equation is has an exponential effect i.e. the closer delayFactor to 1.0f,
- // the longer the delay would appear exponentially)
- f = fabsf(f / sizeProperty.GetVector3().width);
- f = std::min(f, 1.0f);
- f = 1.0f - (1.0f - f) * (1.0f - f);
- // at center delay factor is mDelayMin, at maximum (1.0) it is mDelayMax
- f = Rescale(f, 0.0f, 1.0f, mDelayMin, mDelayMax);
-
- // Will take 0.25s for current delay factor to equal target delay factor
- // This prevents users quickly dragging from different points and noticing a jerk.
- mCurrentDelayFactor = Chase( mCurrentDelayFactor, f, 4.0f/60.0f );
- float delay = activate * mCurrentDelayFactor;
- mScrollPosition = mScrollPosition * delay + scrollPosition * (1.0f-delay);
-
- return current + mScrollPosition;
- }
-
-private:
-
- Vector3 mScrollPosition; ///< The current scroll position
- float mDelayMin;
- float mDelayMax;
- float mCurrentDelayFactor;
-
-};
-
-/**
- * ScrollTwistScaleConstraint
- *
- * Scale constraint adjusts the scale of the Actors
- * based on a supplied depth property value.
- */
-struct ScrollTwistScaleConstraint
-{
- /**
- * Constraint constructor
- */
- ScrollTwistScaleConstraint(float scaleAmount)
- : mScaleAmount(scaleAmount)
- {
- }
-
- /**
- * @param[in] current The current position
- * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME)
- * @return The new position of this Actor.
- */
- Vector3 operator()(const Vector3& current,
- const PropertyInput& depthProperty)
- {
- float depth = depthProperty.GetFloat();
-
- return current * (1.0f - depth * mScaleAmount); // contract by mScaleAmount of original size.
- }
-
-private:
-
- float mScaleAmount;
-};
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-ScrollViewTwistEffect::ScrollViewTwistEffect()
-: mFlags(DefaultFlags),
- mPropertyTime(Property::INVALID_INDEX),
- mEnableEffect(true),
- mAdditionalEffects(false),
- mPropertyReference(Property::INVALID_INDEX),
- mPropertyActivate(Property::INVALID_INDEX),
- mMinimumDistanceForShrink(Toolkit::ScrollViewTwistEffect::DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK),
- mMaxSwingAngle(Math::PI_2, Math::PI_2),
- mDropOff(TWISTEFFECT_DEFAULT_DROPOFF, TWISTEFFECT_DEFAULT_DROPOFF),
- mDropOffDistance(TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_X, TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_Y),
- mDropOffFunction(NULL)
-{
-}
-
-ScrollViewTwistEffect::~ScrollViewTwistEffect()
-{
-}
-
-
-float ScrollViewTwistEffect::GetMinimumDistanceForShrink() const
-{
- return mMinimumDistanceForShrink;
-}
-
-void ScrollViewTwistEffect::SetMinimumDistanceForShrink(float distance)
-{
- mMinimumDistanceForShrink = distance;
-}
-
-void ScrollViewTwistEffect::EnableEffect(bool enableFlag)
-{
- mEnableEffect = enableFlag;
-}
-
-void ScrollViewTwistEffect::ApplyToActor(Actor child,
- bool additionalEffects,
- const Vector2& angleSwing,
- float scaleAmount,
- float delayMin,
- float delayMax)
-{
- mMaxSwingAngle = angleSwing;
- mAdditionalEffects = additionalEffects;
- mScaleFactor = scaleAmount;
- mDelayMin = delayMin;
- mDelayMax = delayMax;
- if(mFlags & FlagDefaultDropOff)
- {
- Vector3 size = GetScrollView().GetCurrentSize();
- // size may still be 0 if the effect is applied before scroll view hits the stage
- if(size.x > Math::MACHINE_EPSILON_1)
- {
- mDropOffDistance.x = size.x;
- }
- if(size.y > Math::MACHINE_EPSILON_1)
- {
- mDropOffDistance.y = size.y;
- }
- }
- if(scaleAmount > Math::MACHINE_EPSILON_0)
- {
- mFlags |= FlagScale;
- }
- else
- {
- mFlags = mFlags & ~FlagScale;
- }
- if(mMaxSwingAngle.LengthSquared() > Math::MACHINE_EPSILON_0)
- {
- mFlags |= FlagTwist;
- }
- else
- {
- mFlags = mFlags & ~FlagTwist;
- }
- Apply(child);
-}
-
-void ScrollViewTwistEffect::Apply(Actor child)
-{
- // Apply constraints to these actors //
- Constraint constraint;
-
- Toolkit::ScrollView scrollView = GetScrollView();
-
- if( mFlags & FlagScale )
- {
- constraint = Constraint::New<Vector3>( Actor::SCALE,
- Source(scrollView, scrollView.GetPropertyIndex( EFFECT_DEPTH ) ),
- ScrollTwistScaleConstraint(mScaleFactor) );
- constraint.SetRemoveAction( Constraint::Discard );
- child.ApplyConstraint( constraint );
- }
-
- constraint = Constraint::New<Vector3>( Actor::POSITION,
- ParentSource(Actor::POSITION),
- Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
- Source(scrollView, scrollView.GetPropertyIndex( EFFECT_REFERENCE ) ),
- Source(scrollView, scrollView.GetPropertyIndex( EFFECT_TIME ) ),
- Source(scrollView, Actor::SIZE),
- Source(scrollView, scrollView.GetPropertyIndex( EFFECT_ACTIVATE) ),
- ScrollTwistPositionConstraint(mDelayMin, mDelayMax) );
- constraint.SetRemoveAction( Constraint::Discard );
- child.ApplyConstraint( constraint );
-
- // use actor position to affect rotation
- if(mFlags & FlagTwist)
- {
- if(mFlags & FlagDropOff)
- {
- constraint = Constraint::New<Quaternion>( Actor::ROTATION,
- LocalSource(Actor::WORLD_POSITION),
- Source(scrollView, Actor::WORLD_POSITION ),
- Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME ) ),
- Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME ) ),
- Source(scrollView, Actor::SIZE ),
- ScrollDropoffTwistRotationConstraint(mMaxSwingAngle, mDropOff, mDropOffDistance, mDropOffFunction) );
- }
- else
- {
- constraint = Constraint::New<Quaternion>( Actor::ROTATION,
- Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME ) ),
- Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME ) ),
- ScrollTwistRotationConstraint(mMaxSwingAngle) );
- }
- constraint.SetRemoveAction( Constraint::Discard );
- child.ApplyConstraint( constraint );
- }
-}
-
-void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle)
-{
- mMaxSwingAngle = maxSwingAngle;
-}
-
-Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const
-{
- return mMaxSwingAngle;
-}
-
-void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function)
-{
- if( distance.LengthSquared() > Math::MACHINE_EPSILON_1 && dropOff.LengthSquared() > Math::MACHINE_EPSILON_1 )
- {
- mFlags |= FlagDropOff;
- mDropOff = dropOff;
- mDropOffDistance = distance;
- mDropOffFunction = function;
- }
- else
- {
- mFlags = mFlags & ~FlagDropOff;
- }
- // can no longer use default dop off
- mFlags = mFlags & ~FlagDefaultDropOff;
-}
-
-void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const
-{
- dropOff = mDropOff;
- distance = mDropOffDistance;
- function = mDropOffFunction;
-}
-
-void ScrollViewTwistEffect::OnAttach(Toolkit::ScrollView& scrollView)
-{
- // Create effect-time property if not already created.
- if(mPropertyTime == Property::INVALID_INDEX)
- {
- mPropertyTime = SafeRegisterProperty( scrollView, EFFECT_TIME, 0.0f );
- mPropertyReference = SafeRegisterProperty( scrollView, EFFECT_REFERENCE, Vector3::ZERO );
- mPropertyDepth = SafeRegisterProperty( scrollView, EFFECT_DEPTH, 0.0f);
- mPropertyActivate = SafeRegisterProperty(scrollView, EFFECT_ACTIVATE, 0.0f);
- }
- // currently cant change overshoot snap back duration, use the constant one from ScrollView
- mActivationTime = Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION;
-
- // Connect to the scroll view signals
- scrollView.ScrollStartedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollStart);
- scrollView.SnapStartedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollSnap);
- scrollView.ScrollUpdatedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollUpdate);
- scrollView.ScrollCompletedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollComplete);
-
- AttachActor(scrollView);
-}
-
-void ScrollViewTwistEffect::OnDetach(Toolkit::ScrollView& scrollView)
-{
- scrollView.ScrollStartedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollStart);
- scrollView.SnapStartedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollSnap);
- scrollView.ScrollUpdatedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollUpdate);
- scrollView.ScrollCompletedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollComplete);
-
- if(mAnimation)
- {
- mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished);
- mAnimation.Clear();
- mAnimation.Reset();
- }
-}
-
-void ScrollViewTwistEffect::AttachActor(Actor actor)
-{
-
-}
-
-void ScrollViewTwistEffect::DetachActor(Actor actor)
-{
- // TODO: remove the specific constraint defined in AttachActor (and possibly
- // unregister property) - neither functionality exists in Dali.
-}
-
-void ScrollViewTwistEffect::ContinueAnimation(float endTime)
-{
- // continue animating
- if(mAnimation)
- {
- mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished);
- mAnimation.Clear();
- }
-
- Actor scrollView = GetScrollView();
-
- mAnimation = Animation::New(TWISTEFFECT_ANIMATION_MAX_TIME);
- mAnimation.AnimateTo( Property(scrollView, mPropertyTime), endTime, AlphaFunctions::Linear );
- mAnimation.FinishedSignal().Connect(this, &ScrollViewTwistEffect::OnAnimationFinished);
- mAnimation.Play();
-}
-
-void ScrollViewTwistEffect::OnScrollStart( const Vector3& position )
-{
- if(mActivateAnimation)
- {
- // if the animation after Scroll complete not terminate before another scroll action, stop the animation before start again
- mActivateAnimation.Stop();
- mActivateAnimation.Clear();
- mActivateAnimation = NULL;
- }
-
- GetScrollView().SetProperty(mPropertyTime, 0.0f);
- if(mEnableEffect)
- {
- GetScrollView().SetProperty(mPropertyActivate, 1.0f);
- }
- else
- {
- GetScrollView().SetProperty(mPropertyActivate, 0.0f);
- }
- GetScrollView().SetProperty(mPropertyReference, position);
-
- ContinueAnimation(TWISTEFFECT_ANIMATION_MAX_TIME);
-}
-
-void ScrollViewTwistEffect::OnScrollUpdate( const Vector3& position )
-{
- // nothing to do
-}
-
-void ScrollViewTwistEffect::OnScrollComplete( const Vector3& position )
-{
- if(!mEnableEffect)
- {
- OnActivateAnimationFinished(mAnimation);
- return;
- }
- Actor scrollView = GetScrollView();
- scrollView.SetProperty(mPropertyActivate, 1.0f);
- mActivateAnimation = Animation::New(mActivationTime);
- mActivateAnimation.AnimateTo( Property(scrollView, mPropertyActivate), 0.0f, AlphaFunctions::Linear);
- mActivateAnimation.FinishedSignal().Connect(this, &ScrollViewTwistEffect::OnActivateAnimationFinished);
- mActivateAnimation.Play();
-}
-
-void ScrollViewTwistEffect::OnScrollSnap( const Toolkit::ScrollView::SnapEvent& event )
-{
- // If a Flicking snap is occuring and the distance is more than mMinimumDistanceForShrink
- // then animate depth effect i.e. shrink actors and then bring back in to regular size.
- // NOTE: ScrollView Snap returns a value opposite of GetCurrentScrollPosition
- // i.e. if you've "scrolled 100 pixels right" (so content on screen has shifted 100 pixels left)
- // then GetCurrentScrollPosition returns a positive value (100.0f, 0.0f) (position of where you're
- // look, not where content has been moved to).
- // event.position returns a negative value (-100.0f, 0.0f)
- // Would be a good idea to change SnapEvent in the API so it reflects GetCurrentScrollPosition.
- // TODO: Change scroll-view API, check if anything uses SnapEvent and change them correspondingly
- Vector3 targetScrollPosition(-event.position);
-
- Vector3 delta = targetScrollPosition - GetScrollView().GetCurrentScrollPosition();
-
- if(event.type==Flick && delta.Length() > mMinimumDistanceForShrink)
- {
- Actor scrollView = GetScrollView();
-
- Animation animation = Animation::New(event.duration);
- animation.AnimateTo( Property(scrollView, mPropertyDepth), 1.0f, HopEasing);
- animation.Play();
- }
-}
-
-void ScrollViewTwistEffect::OnAnimationFinished( Animation& animation )
-{
- // still unstable, so continue animating.
- // TODO: Requires an instability check to ensure time animation finishes when delay is
- // less noticeable. i.e. all present scrollPositions are approx the same as mScrollPosition in constraints.
- // best solution for this is to switch to a single history vector of scroll position, and compare if
- // position has not deviated >= 0.5 pixel for the past 1 second.
- float endTime = GetScrollView().GetProperty<float>(mPropertyTime) + TWISTEFFECT_ANIMATION_MAX_TIME;
- ContinueAnimation(endTime);
-}
-
-void ScrollViewTwistEffect::OnActivateAnimationFinished( Animation& animation )
-{
- if(mAnimation)
- {
- mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished);
- mAnimation.Clear();
- mAnimation.Reset();
- }
-}
-
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_TWIST_EFFECT_H__
-#define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_TWIST_EFFECT_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 <dali/public-api/animation/animation.h>
-#include <dali/public-api/animation/alpha-functions.h>
-#include <dali/public-api/animation/time-period.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h>
-
-namespace Dali
-{
-
-class Animation;
-
-namespace Toolkit
-{
-
-class ScrollView;
-
-namespace Internal
-{
-
-class ScrollViewEffect;
-
-/**
- * @copydoc Toolkit::ScrollViewTwistEffect
- */
-class ScrollViewTwistEffect : public ScrollViewEffect
-{
-
-public:
- enum Flag
- {
- FlagTwist = 0x01,
- FlagScale = 0x02,
- FlagDropOff = 0x04,
- FlagDefaultDropOff = 0x08,
- DefaultFlags = FlagTwist | FlagDropOff | FlagDefaultDropOff
- };
-
- /**
- * Constructor
- */
- ScrollViewTwistEffect();
-
-public:
-
- /**
- * @copydoc ScrollViewEffect::GetMinimumDistanceForShrink
- */
- float GetMinimumDistanceForShrink() const;
-
- /**
- * @copydoc ScrollViewEffect::SetMinimumDistanceForShrink
- */
- void SetMinimumDistanceForShrink(float distance);
-
- /**
- * enable or disable this effect
- * @param[in] enable when enableFlag is true, disable when enableFlag is false.
- */
- void EnableEffect(bool enableFlag);
-
- /**
- * @copydoc ScrollViewEffect::ApplyToActor
- */
- void ApplyToActor( Actor child,
- bool additionalEffects,
- const Vector2& angleSwing,
- float scaleAmount,
- float delayMin,
- float delayMax );
-
- /**
- * @copydoc Toolkit::ScrollViewEffect::Apply
- */
- void Apply(Actor child);
-
- /**
- * @copydoc Toolkit::ScrollViewEffect::SetMaxSwingAngle
- */
- void SetMaxSwingAngle(const Vector2& maxSwingAngle);
-
- /**
- * @copydoc Toolkit::ScrollViewEffect::GetMaxSwingAngle
- */
- Vector2 GetMaxSwingAngle() const;
-
- /**
- * @copydoc Toolkit::ScrollViewEffect::SetSwingDropOff
- */
- void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL);
-
- /**
- * @copydoc Toolkit::ScrollViewEffect::GetSwingDropOff
- */
- void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const;
-
-public:
-
- /**
- * @copydoc ScrollViewEffect::OnAttach
- */
- virtual void OnAttach(Toolkit::ScrollView& scrollView);
-
- /**
- * @copydoc ScrollViewEffect::OnDetach
- */
- virtual void OnDetach(Toolkit::ScrollView& scrollView);
-
-protected:
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~ScrollViewTwistEffect();
-
-private:
-
- /**
- * Signal handler, called when the ScrollView starts to move
- *
- * @param[in] position The current scroll position
- */
- void OnScrollStart( const Vector3& position );
-
- /**
- * Signal handler, called when the ScrollView is moving
- *
- * @param[in] position The current scroll positionApply
- */
- void OnScrollUpdate( const Vector3& position );
-
- /**
- * Signal handler, called when the ScrollView has completed movement
- *
- * @param[in] position The current scroll position
- */
- void OnScrollComplete( const Vector3& position );
-
- void OnScrollSnap( const Toolkit::ScrollView::SnapEvent& event );
-
- /**
- * Signal handler, called when the Wobble Effect animation has completed.
- *
- * @param[in] animation The animation.
- */
- void OnAnimationFinished( Animation& animation );
-
- void OnActivateAnimationFinished( Animation& animation );
- /**
- * Attaches effect to Scroll Actor (ScrollView)
- *
- * Applies the same wobble effect to each Scroll Actor.
- *
- * @param[in] actor The attached Actor
- */
- void AttachActor(Actor actor);
-
- /**
- * Detaches effect from Scroll Actor (ScrollView)
- *
- * @param[in] actor The attached Actor
- */
- void DetachActor(Actor actor);
-
- /**
- * Continues Animation to time reaches endTime
- *
- * @param[in] endTime the target time to reach.
- */
- void ContinueAnimation(float endTime);
-
-private:
-
- ushort mFlags;
- Animation mAnimation; ///< Animation Timer to drive the twist effect constraint.
- float mActivationTime; ///< Time taken for overshoot to reach zero, which is the time we need to allow effect to be active
- Animation mActivateAnimation;
- Property::Index mPropertyTime; ///< Time property used by twist effect constraint to calculate timePassed.
- bool mEnableEffect; ///< flag that decide whether enable or disable the twist effect.
- bool mAdditionalEffects; ///< whether we want to apply extra effects
- Property::Index mPropertyReference; ///< Reference point in scroll-contents, this point has no delay.
- Property::Index mPropertyActivate; ///::< The further out from this point, the further the delay.
- Property::Index mPropertyDepth; ///< Depth property used by twist effect constraint to shrink Actors.
- float mMinimumDistanceForShrink; ///< Scrolling animation must last for longer than this amount to do shrink effect.s
- Vector2 mMaxSwingAngle; ///< Maximum swing angle to be applied to x and y axes
- Vector2 mDropOff; ///< Amount to drop off the angle on each axis of drop off distance
- Vector2 mDropOffDistance; ///< Distance to apply the full drop off over
- AlphaFunction mDropOffFunction; ///< Function to adjust how drop off is aplied over the distance, NULL for linear
- float mScaleFactor; ///< Amount to scale by during translation
- float mDelayMin;
- float mDelayMax;
-};
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::ScrollViewTwistEffect& GetImpl(Dali::Toolkit::ScrollViewTwistEffect& obj)
-{
- DALI_ASSERT_ALWAYS(obj);
-
- Dali::RefObject& handle = obj.GetBaseObject();
-
- return static_cast<Internal::ScrollViewTwistEffect&>(handle);
-}
-
-inline const Internal::ScrollViewTwistEffect& GetImpl(const Dali::Toolkit::ScrollViewTwistEffect& obj)
-{
- DALI_ASSERT_ALWAYS(obj);
-
- const Dali::RefObject& handle = obj.GetBaseObject();
-
- return static_cast<const Internal::ScrollViewTwistEffect&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_TWIST_EFFECT_H__
};
ScrollViewWobbleEffect::ScrollViewWobbleEffect()
-: mPropertyTime(Property::INVALID_INDEX)
+: mPropertyTime(Property::INVALID_INDEX),
+ mStableCurrent(0),
+ mAnimationCycleId(0)
{
-
}
ScrollViewWobbleEffect::~ScrollViewWobbleEffect()
instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, false));
break;
}
- default:
+ case Toolkit::Scrollable::OvershootIndicator:
{
- DALI_ASSERT_ALWAYS(true && "Unrecognized component type");
+ DALI_ASSERT_ALWAYS(!"Unrecognized component type");
+ break;
}
}
// EXTERNAL INCLUDES
#include <sstream>
-#include <dali/public-api/adaptor-framework/physical-keyboard.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
-
using namespace Dali;
-using namespace std;
namespace
{
}
// debugging support, very useful when new features are added or bugs are hunted down
// currently not called from code so compiler will optimize these away, kept here for future debugging
-void PrintVector( vector<float>& array )
+void PrintVector( std::vector<float>& array )
{
TV_LOG( "vector, size [%d]\n", array.size() );
// print values
void TableView::DeleteRow( unsigned int rowIndex )
{
- vector< Actor > ignored;
+ std::vector< Actor > ignored;
DeleteRow( rowIndex, ignored );
}
-void TableView::DeleteRow( unsigned int rowIndex, vector<Actor>& removed )
+void TableView::DeleteRow( unsigned int rowIndex, std::vector<Actor>& removed )
{
RelayoutingLock lock( *this );
- vector< CellData > lost;
+ std::vector< CellData > lost;
mCellData.DeleteRow( rowIndex, lost );
// need to update the cellinfos for the items that moved
const unsigned int rowCount = mCellData.GetRows();
void TableView::DeleteColumn( unsigned int columnIndex )
{
- vector< Actor > ignored;
+ std::vector< Actor > ignored;
DeleteColumn( columnIndex, ignored );
}
-void TableView::DeleteColumn( unsigned int columnIndex, vector<Actor>& removed )
+void TableView::DeleteColumn( unsigned int columnIndex, std::vector<Actor>& removed )
{
RelayoutingLock lock( *this );
- vector< CellData > lost;
+ std::vector< CellData > lost;
mCellData.DeleteColumn( columnIndex, lost );
// need to update the cellinfos for the items that moved
const unsigned int rowCount = mCellData.GetRows();
void TableView::Resize( unsigned int rows, unsigned int columns )
{
- vector< Actor > ignored;
+ std::vector< Actor > ignored;
Resize( rows, columns, ignored );
}
-void TableView::Resize( unsigned int rows, unsigned int columns, vector<Actor>& removed )
+void TableView::Resize( unsigned int rows, unsigned int columns, std::vector<Actor>& removed )
{
RelayoutingLock lock( *this );
unsigned int oldRows = GetRows();
unsigned int oldColumns = GetColumns();
// resize data array
- vector< CellData > lost;
+ std::vector< CellData > lost;
ResizeContainers( rows, columns, lost );
// calculate if we lost rows or columns
unsigned int rowsRemoved = 0;
void TableView::ResizeContainers( unsigned int rows, unsigned int columns )
{
- vector<CellData> ignored;
+ std::vector<CellData> ignored;
ResizeContainers( rows, columns, ignored );
}
-void TableView::ResizeContainers( unsigned int rows, unsigned int columns, vector<CellData>& removed )
+void TableView::ResizeContainers( unsigned int rows, unsigned int columns, std::vector<CellData>& removed )
{
mCellData.Resize( rows, columns, removed );
// we dont care if these go smaller, data will be regenerated or is not needed anymore
mRelativeWidths.resize( columns );
}
-void TableView::RemoveAndGetLostActors( const vector<CellData>& lost, vector<Actor>& removed,
+void TableView::RemoveAndGetLostActors( const std::vector<CellData>& lost, std::vector<Actor>& removed,
unsigned int rowsRemoved, unsigned int columnsRemoved )
{
// iterate through all lost cells
- vector< CellData >::const_iterator iter = lost.begin();
+ std::vector< CellData >::const_iterator iter = lost.begin();
for( ; iter != lost.end(); ++iter )
{
// if it is a valid actor
{
Property::Value& item = map.GetValue(i);
- if( istringstream(map.GetKey(i)) >> rowIndex // the key is a number
+ if( std::istringstream(map.GetKey(i)) >> rowIndex // the key is a number
&& Property::MAP == item.GetType())
{
if( item.HasKey( "policy" ) && item.HasKey( "value" ) )
{
- Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
+ Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<std::string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
if( policy == Toolkit::TableView::Fixed )
{
(tableViewImpl.*funcFixed)( rowIndex, item.GetValue("value").Get<float>() );
void TableView::GetMapPropertyValue( const std::vector<float>& fixedSize, const std::vector<float>& relativeSize, Property::Map& map )
{
- string fixedPolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Fixed, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
- string relativePolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Relative, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
- Property::StringValuePair fixedPolicyPair( "policy", fixedPolicy );
- Property::StringValuePair relativePolicyPair( "policy", relativePolicy );
+ std::string fixedPolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Fixed, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
+ std::string relativePolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Relative, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) );
size_t count = fixedSize.size();
for( size_t index = 0; index < count; index++ )
{
if( ! EqualsZero( fixedSize[index] ) )
{
- Property::StringValuePair valuePair( "value", fixedSize[index] );
Property::Map item;
- item[ fixedPolicyPair.first ] = fixedPolicyPair.second;
- item[ valuePair.first ] = valuePair.second;
+ item[ "policy" ] = fixedPolicy;
+ item[ "value" ] = fixedSize[index];
map[ static_cast<std::ostringstream*>( &(std::ostringstream() << index ) )->str() ] = item;
}
else if( ! EqualsZero( relativeSize[index] ) )
{
- Property::StringValuePair valuePair( "value", relativeSize[index] );
Property::Map item;
- item[ relativePolicyPair.first ] = relativePolicyPair.second;
- item[ valuePair.first ] = valuePair.second;
+ item[ "policy" ] = relativePolicy;
+ item[ "value" ] = relativeSize[index];
map[ static_cast<std::ostringstream*>( &(std::ostringstream() << index ) )->str() ] = item;
}
Decorator::Decorator( TextViewCharacterPositioning& textViewManager, TextInputTextStyle& textStyle ):
mTextViewCharacterPositioning( textViewManager ),
mTextStyle( textStyle ),
+ mSelectionHandleOnePosition(0),
+ mSelectionHandleTwoPosition(0),
+ mGrabHandlePosition(0),
mCursorPosition( 0 ),
mTextHighlight( textViewManager ),
mCursorBlinkStatus( true ),
mCursorVisibility( true ),
+ mCursorRTLEnabled( false ),
+ mIsGrabHandleInScrollArea( false ),
+ mIsCursorInScrollArea( false ),
mGrabHandleEnabled( true )
{
}
/**
* Selection Handles
*/
-void Decorator::OnHandlePan(Actor actor, PanGesture gesture)
+void Decorator::OnHandlePan(Actor actor, const PanGesture& gesture)
{
Actor selectionHandleOne = mTextInputHandles.GetSelectionHandleOne();
Actor selectionHandleTwo = mTextInputHandles.GetSelectionHandleTwo();
selectionHandle.SetPosition( actualPosition += DEFAULT_HANDLE_OFFSET );
- if( mTextViewCharacterPositioning.IsScrollEnabled() )
- {
- const Vector3 controlSize = mTextViewCharacterPositioning.GetTextView().GetCurrentSize();
- const Size cursorSize( GetCursorSizeAt( position ) );
- bool handleVisible = IsPositionWithinControl( actualPosition, Vector2(DEFAULT_HANDLE_OFFSET.width, DEFAULT_HANDLE_OFFSET.height), controlSize );
-
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextInputDecorationLayouter::PositionSelectionHandle controlSize[%f,%f] cursorSize[%f,%f] actualPos[%f,%f] visible[%s] \n",
- controlSize.x, controlSize.y, cursorSize.x, cursorSize.y, actualPosition.x, actualPosition.y, ( handleVisible )?"true":"false" );
-
- selectionHandle.SetVisible( handleVisible );
- }
return actualPosition;
}
{
Vector3 actualHandlePosition;
actualSelectionHandlePosition.x += displacement.x * selectionHandle.GetCurrentScale().x;
- actualSelectionHandlePosition.y += displacement.y * selectionHandle.GetCurrentScale().y;;
+ actualSelectionHandlePosition.y += displacement.y * selectionHandle.GetCurrentScale().y;
// Selection handles should jump to the nearest character
std::size_t newHandlePosition = 0;
bool handleVisible = true;
- Vector2 min, max;
- if( mTextViewCharacterPositioning.IsScrollEnabled() )
- {
- const Vector3 controlSize = mTextViewCharacterPositioning.GetTextView().GetCurrentSize();
- const Size cursorSize( GetCursorSizeAt( newHandlePosition ) );
-
- handleVisible = IsPositionWithinControl( actualHandlePosition,
- cursorSize,
- controlSize );
-
- if( handleVisible )
- {
- StopScrollTimer();
- mCurrentHandlePosition = actualHandlePosition;
- mScrollDisplacement = Vector2::ZERO;
- }
- else
- {
-
- if( ( actualHandlePosition.x < SCROLL_THRESHOLD ) && ( displacement.x <= 0.f ) )
- {
- mScrollDisplacement.x = -SCROLL_SPEED;
- }
- else if( ( actualHandlePosition.x > controlSize.width - SCROLL_THRESHOLD ) && ( displacement.x >= 0.f ) )
- {
- mScrollDisplacement.x = SCROLL_SPEED;
- }
- if( ( actualHandlePosition.y < SCROLL_THRESHOLD ) && ( displacement.y <= 0.f ) )
- {
- mScrollDisplacement.y = -SCROLL_SPEED;
- }
- else if( ( actualHandlePosition.y > controlSize.height - SCROLL_THRESHOLD ) && ( displacement.y >= 0.f ) )
- {
- mScrollDisplacement.y = SCROLL_SPEED;
- }
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextInputDecorationLayouter::MoveSelectionHandle Handle not visible scroll displacement [%f]\n", mScrollDisplacement.x);
-
- StartScrollTimer();
- }
- }
-
if ( handleVisible && // Ensure the handle is visible.
( newHandlePosition != currentSelectionHandlePosition ) && // Ensure the handle has moved.
( newHandlePosition != mSelectionHandleTwoPosition ) && // Ensure new handle position not the same position as an existing handle.
bool handleVisible = true;
- if( mTextViewCharacterPositioning.IsScrollEnabled() )
- {
- const Vector3 controlSize = mTextViewCharacterPositioning.GetTextView().GetCurrentSize();
- const Size cursorSize( GetCursorSizeAt( newHandlePosition ) );
- // Scrolls the text if the handle is not in a visible position
- handleVisible = IsPositionWithinControl( actualHandlePosition,
- cursorSize,
- controlSize );
-
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextInputDecorationLayouter::MoveGrabHandle handleVisible[%s]\n", ( handleVisible )?"true":"false");
-
- if( handleVisible )
- {
- StopScrollTimer();
- mCurrentHandlePosition = actualHandlePosition;
- mScrollDisplacement = Vector2::ZERO;
- }
- else
- {
- if( ( actualHandlePosition.x < SCROLL_THRESHOLD ) && ( displacement.x <= 0.f ) )
- {
- mScrollDisplacement.x = -SCROLL_SPEED;
- }
- else if( ( actualHandlePosition.x > controlSize.width - SCROLL_THRESHOLD ) && ( displacement.x >= 0.f ) )
- {
- mScrollDisplacement.x = SCROLL_SPEED;
- }
- if( ( actualHandlePosition.y < SCROLL_THRESHOLD ) && ( displacement.y <= 0.f ) )
- {
- mScrollDisplacement.y = -SCROLL_SPEED;
- }
- else if( ( actualHandlePosition.y > controlSize.height - SCROLL_THRESHOLD ) && ( displacement.y >= 0.f ) )
- {
- mScrollDisplacement.y = SCROLL_SPEED;
- }
- StartScrollTimer();
- }
- }
-
- if( ( newHandlePosition != mGrabHandlePosition ) && // Only redraw cursor and do updates if position changed
+ if( ( newHandlePosition != mGrabHandlePosition ) && // Only redraw cursor and do updates if position changed
( handleVisible ) )// and the new position is visible (if scroll is not enabled, it's always true).
{
mActualGrabHandlePosition = actualHandlePosition;
if ( !mTextViewCharacterPositioning.IsStyledTextEmpty() && ( cursorPosition > 0 ) )
{
DALI_ASSERT_DEBUG( ( 0 <= cursorPosition-1 ) && ( cursorPosition-1 < mTextViewCharacterPositioning.StyledTextSize() ) );
- const TextStyle inputStyle = mTextViewCharacterPositioning.GetStyleAt( cursorPosition-1 );
- mTextStyle.SetInputStyle( inputStyle );
}
}
}
// Get height of cursor and set its size
Size size( CURSOR_THICKNESS, 0.0f );
- if ( !mTextViewCharacterPositioning.IsTextEmpty() )
- {
- Vector2 min, max; // out parameters for GetRowRectFromCharacterPosition
- size.height = mTextViewCharacterPositioning.GetRowRectFromCharacterPosition( mTextViewCharacterPositioning.GetVisualPosition( cursorPosition ), min, max ).height;
- }
- else
- {
- // Measure Font so know how big text will be if no initial text to measure.
- size.height = mTextViewCharacterPositioning.GetLineHeight( nthChar );
- }
+
+ Vector2 min, max; // out parameters for GetRowRectFromCharacterPosition
+ size.height = mTextViewCharacterPositioning.GetRowRectFromCharacterPosition( mTextViewCharacterPositioning.GetVisualPosition( cursorPosition ), min, max ).height;
mCursor.SetSize(size);
SetAltCursorEnabled( altPositionValid );
- if(!altPositionValid)
- {
- mCursor.SetPosition( position + UI_OFFSET );
- }
- else
- {
- size.height *= 0.5f;
- mCursor.SetSize(size);
- mCursor.SetPosition( position + UI_OFFSET - Vector3(0.0f, directionRTL ? 0.0f : size.height, 0.0f) );
- Vector2 min, max; // out parameters for GetRowRectFromCharacterPosition
- Size rowSize = mTextViewCharacterPositioning.GetRowRectFromCharacterPosition( mTextViewCharacterPositioning.GetVisualPosition( cursorPosition ), min, max );
- size.height = rowSize.height * 0.5f;
- mCursorRTL.SetSize(size);
- mCursorRTL.SetPosition( altPosition + UI_OFFSET - Vector3(0.0f, directionRTL ? size.height : 0.0f, 0.0f) );
- }
-
- if( mTextViewCharacterPositioning.IsScrollEnabled() )
- {
- // Whether cursor and grab handle are inside the boundaries of the text-input when text scroll is enabled.
- const Vector3& controlSize = mTextViewCharacterPositioning.GetTextView().GetCurrentSize();
- mIsCursorInScrollArea = mIsGrabHandleInScrollArea = IsPositionWithinControl( position, size, controlSize );
- }
+ mCursor.SetPosition( position + UI_OFFSET );
}
}
void Decorator::HidePopUp( bool animate, bool signalFinished )
{
- if ( ( mPopUpPanel.GetState() == TextInputPopupNew::StateShowing ) || ( mPopUpPanel.GetState() == TextInputPopupNew::StateShown ) )
- {
- mPopUpPanel.Hide( animate );
- }
}
void Decorator::AddPopupOption(const std::string& name, const std::string& caption, const Image icon, bool finalOption)
scrollPosition += scrollDelta;
mTextViewCharacterPositioning.SetScrollPosition( scrollPosition );
- // If scroll position goes too far TextView will trim it to fit.
- if ( mTextViewCharacterPositioning.IsScrollPositionTrimmed() )
- {
- StopScrollTimer();
- }
-
mActualGrabHandlePosition = mTextViewCharacterPositioning.GetActualPositionFromCharacterPosition( newGrabHandlePosition ).GetVectorXY();
}
}
scrollPosition += scrollDelta;
mTextViewCharacterPositioning.SetScrollPosition( scrollPosition );
- if( mTextViewCharacterPositioning.IsScrollPositionTrimmed() )
- {
- StopScrollTimer();
- }
-
mSelectionHandleOnePosition = newHandleOnePosition;
mSelectionHandleOneActualPosition = mTextViewCharacterPositioning.GetActualPositionFromCharacterPosition( mSelectionHandleOnePosition ).GetVectorXY();
}
scrollPosition += scrollDelta;
mTextViewCharacterPositioning.SetScrollPosition( scrollPosition );
- if( mTextViewCharacterPositioning.IsScrollPositionTrimmed() )
- {
- StopScrollTimer();
- }
-
mSelectionHandleTwoPosition = newHandleTwoPosition;
mCurrentHandlePosition = mTextViewCharacterPositioning.GetActualPositionFromCharacterPosition( mSelectionHandleTwoPosition ).GetVectorXY();
* @param actor Handle of the selection or grab handle.
* @param gesture Data structure with the parameters of the gesture.
*/
- void OnHandlePan(Actor actor, PanGesture gesture);
+ void OnHandlePan(Actor actor, const PanGesture& gesture);
// Selection Handles
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
using namespace Dali;
-using namespace std;
namespace
{
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-using namespace std;
using namespace Dali;
// Local Data
// Private Internal methods
-void TextInput::OnHandlePan(Actor actor, PanGesture gesture)
+void TextInput::OnHandlePan(Actor actor, const PanGesture& gesture)
{
switch (gesture.state)
{
return false;
}
-void TextInput::OnDoubleTap(Dali::Actor actor, Dali::TapGesture tap)
+void TextInput::OnDoubleTap(Dali::Actor actor, const Dali::TapGesture& tap)
{
// If text exists then select nearest word.
if ( !mStyledText.empty())
}
// TODO: Change the function name to be more general.
-void TextInput::OnTextTap(Dali::Actor actor, Dali::TapGesture tap)
+void TextInput::OnTextTap(Dali::Actor actor, const Dali::TapGesture& tap)
{
DALI_LOG_INFO( gLogFilter, Debug::General, "OnTap mPreEditFlag[%s] mEditOnTouch[%s] mEditModeActive[%s] ", (mPreEditFlag)?"true":"false"
, (mEditOnTouch)?"true":"false"
}
}
-void TextInput::OnLongPress(Dali::Actor actor, Dali::LongPressGesture longPress)
+void TextInput::OnLongPress(Dali::Actor actor, const Dali::LongPressGesture& longPress)
{
DALI_LOG_INFO( gLogFilter, Debug::General, "OnLongPress\n" );
{
// Some text is selected so erase it before adding space.
DeleteHighlightedText( true );
- update = true;
}
mCursorPosition = mCursorPosition + InsertAt(Text(keyString), mCursorPosition, 0);
TextInput::HighlightInfo TextInput::CalculateHighlightInfo()
{
// At the moment there is no public API to modify the block alignment option.
- const bool blockAlignEnabled = true;
mNewHighlightInfo.mQuadList.clear(); // clear last quad information.
float rowTop = rowBottom - rowSize.height;
// Still selected, and block-align mode then set rowRight to max, so it can be clamped afterwards
- if(charSelected && blockAlignEnabled)
+ if(charSelected)
{
rowRight = std::numeric_limits<float>::max();
}
if( charSelected )
{
// if block-align mode then set rowLeft to min, so it can be clamped afterwards
- rowLeft = blockAlignEnabled ? 0.0f : charInfo.mPosition.x - mTextLayoutInfo.mScrollOffset.x;
+ rowLeft = 0.0f;
rowRight = ( charInfo.mPosition.x - mTextLayoutInfo.mScrollOffset.x ) + charInfo.mSize.width;
selectionState = SelectionStarted;
}
mNewHighlightInfo.Clamp2D( topLeft, bottomRight );
// For block-align align Further Clamp quads to max left and right extents
- if(blockAlignEnabled)
- {
// BlockAlign: Will adjust highlight to block:
// i.e.
// H[ello] (top row right = max of all rows right)
// [is some]
// [text]
// (common in regular text editors/web browser selection)
-
mNewHighlightInfo.Clamp2D( Vector2(maxRowLeft, topLeft.y), Vector2(maxRowRight, bottomRight.y ) );
- }
// Finally clamp quads again so they don't exceed the boundry of the control.
const Vector3& controlSize = GetControlSize();
++closestIndex;
}
}
- else if( closestIndex == numeric_limits<std::size_t>::max() ) // -1 RTL (after last arabic character on line)
+ else if( closestIndex == std::numeric_limits<std::size_t>::max() ) // -1 RTL (after last arabic character on line)
{
closestIndex = mTextLayoutInfo.mCharacterVisualToLogicalMap.size();
}
* @param actor Handle of the selection or grab handle.
* @param gesture Data structure with the parameters of the gesture.
*/
- void OnHandlePan(Actor actor, PanGesture gesture);
+ void OnHandlePan(Actor actor, const PanGesture& gesture);
/**
* Callback for touch down on Grab handle
* @param[in] actor
* @param[in] tap touch event
*/
- void OnTextTap(Dali::Actor actor, Dali::TapGesture tap);
+ void OnTextTap(Dali::Actor actor, const Dali::TapGesture& tap);
/**
* Callback for double tap on TextInput
* @param[in] actor
* @param[in] tap touch event
*/
- void OnDoubleTap(Dali::Actor actor, Dali::TapGesture tap);
+ void OnDoubleTap(Dali::Actor actor, const Dali::TapGesture& tap);
/**
* Callback for long press on TextInput
* @param[in] actor
* @param[in] longPress long press event
*/
- void OnLongPress(Dali::Actor actor, Dali::LongPressGesture longPress);
+ void OnLongPress(Dali::Actor actor, const Dali::LongPressGesture& longPress);
/**
* Callback for the ClipboardEventNotifier when text is selected in the clipboard window.
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-using namespace std;
using namespace Dali;
#define GET_LOCALE_TEXT(string) dgettext("sys_string", string)
currentButton = CreateRequiredButton( ButtonsClipboard, mClipboardOptionPriority, OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, false );
break;
}
- case ButtonsEnumEnd:
- {
- DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
- currentButton.orderOfPriority = 0;
- break;
- }
}
bool match = false;
* Default constructor
* Creates an empty popup base actor (no content i.e. invisible)
*/
- TextInputPopupNew(){};
+ TextInputPopupNew()
+ : mState(StateHidden)
+ { };
/**
* Destructor
// INTERNAL INCLUDES
using namespace Dali;
-using namespace std;
namespace
{
TextHighlight::HighlightInfo TextHighlight::CalculateHighlightInfo( std::size_t handlePositionStart, std::size_t handlePositionEnd, Toolkit::TextView::TextLayoutInfo& textLayoutInfo )
{
// At the moment there is no public API to modify the block alignment option.
- const bool blockAlignEnabled = true;
TextHighlight::HighlightInfo newHighlightInfo;
//newHighlightInfo.mQuadList.clear(); // clear last quad information.
float rowTop = rowBottom - rowSize.height;
// Still selected, and block-align mode then set rowRight to max, so it can be clamped afterwards
- if(charSelected && blockAlignEnabled)
+ if(charSelected)
{
rowRight = std::numeric_limits<float>::max();
}
if( charSelected )
{
// if block-align mode then set rowLeft to min, so it can be clamped afterwards
- rowLeft = blockAlignEnabled ? 0.0f : charInfo.mPosition.x - textLayoutInfo.mScrollOffset.x;
+ rowLeft = 0.0f;
rowRight = ( charInfo.mPosition.x - textLayoutInfo.mScrollOffset.x ) + charInfo.mSize.width;
selectionState = SelectionStarted;
}
{
// finished selection.
Vector2 min, max;
- if(lastIt->mIsNewParagraphChar)
+ if(lastIt != end && lastIt->mIsNewParagraphChar)
{
lastIt = std::max( textLayoutInfo.mCharacterLayoutInfoTable.begin(), lastIt - 1 );
}
newHighlightInfo.Clamp2D( topLeft, bottomRight );
// For block-align align Further Clamp quads to max left and right extents
- if(blockAlignEnabled)
- {
// BlockAlign: Will adjust highlight to block:
// i.e.
// H[ello] (top row right = max of all rows right)
// [is some]
// [text]
// (common in regular text editors/web browser selection)
-
newHighlightInfo.Clamp2D( Vector2(maxRowLeft, topLeft.y), Vector2(maxRowRight, bottomRight.y ) );
- }
+
}
return newHighlightInfo;
: mType( TextView::TextSet ),
mPosition( 0u ),
mNumberOfCharacters( 0u ),
- mText()
+ mText(),
+ mStyleMask(TextStyle::NONE)
{
}
TextView::LayoutParameters::LayoutParameters()
: mMultilinePolicy( Toolkit::TextView::SplitByNewLineChar ),
+ mExceedPolicy( TextView::Original ),
mWidthExceedPolicy( Toolkit::TextView::Original ),
mHeightExceedPolicy( Toolkit::TextView::Original ),
mHorizontalAlignment( Toolkit::Alignment::HorizontalCenter ),
float lineHeightOffset,
bool markUpEnabled )
: mMultilinePolicy( multilinePolicy ),
+ mExceedPolicy( TextView::Original ),
mWidthExceedPolicy( widthExceedPolicy ),
mHeightExceedPolicy( heightExceedPolicy ),
mHorizontalAlignment(),
TextView::LayoutParameters::LayoutParameters( const TextView::LayoutParameters& layoutParameters )
: mMultilinePolicy( layoutParameters.mMultilinePolicy ),
+ mExceedPolicy( TextView::Original ),
mWidthExceedPolicy( layoutParameters.mWidthExceedPolicy ),
mHeightExceedPolicy( layoutParameters.mHeightExceedPolicy ),
mHorizontalAlignment( layoutParameters.mHorizontalAlignment ),
}
}
-void TextView::OnTextPan( Actor actor, PanGesture gesture )
+void TextView::OnTextPan( Actor actor, const PanGesture& gesture )
{
if( 1u == gesture.numberOfTouches )
{
* @param[in] actor Handle of the text-view.
* @param[in] gesture Data structure with the parameters of the gesture.
*/
- void OnTextPan( Actor actor, PanGesture gesture );
+ void OnTextPan( Actor actor, const PanGesture& gesture );
/**
* Ensures the text-view's boundaries are fully covered of text.
$(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp \
$(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp \
$(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp \
- $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp \
$(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp \
$(toolkit_base_src_dir)/controls/table-view/table-view-impl.cpp \
$(toolkit_base_src_dir)/controls/text-input/text-input-decorator-impl.cpp \
Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
if(propertyIsFocusGroup == Property::INVALID_INDEX)
{
- propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup);
+ actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup);
}
else
{
Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
if(propertyActorFocusable == Property::INVALID_INDEX)
{
- propertyActorFocusable = actor.RegisterProperty(ACTOR_FOCUSABLE, focusable);
+ actor.RegisterProperty(ACTOR_FOCUSABLE, focusable);
}
else
{
Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP_PROPERTY_NAME);
if(propertyIsFocusGroup == Property::INVALID_INDEX)
{
- propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup);
+ actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup);
}
else
{
void StyleManager::SetTheme()
{
mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
- LoadJSON( mThemeBuilder, mThemeFile );
-
- StyleChange change;
- change.themeChange = true;
- mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), change );
+ if ( LoadJSON( mThemeBuilder, mThemeFile ) )
+ {
+ StyleChange change;
+ change.themeChange = true;
+ mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), change );
+ }
+ else
+ {
+ mThemeBuilder.Reset();
+ }
}
Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
// Gesture Detection Methods
- void PinchDetected(Actor actor, PinchGesture pinch)
+ void PinchDetected(Actor actor, const PinchGesture& pinch)
{
mControlImpl.OnPinch(pinch);
}
- void PanDetected(Actor actor, PanGesture pan)
+ void PanDetected(Actor actor, const PanGesture& pan)
{
mControlImpl.OnPan(pan);
}
- void TapDetected(Actor actor, TapGesture tap)
+ void TapDetected(Actor actor, const TapGesture& tap)
{
mControlImpl.OnTap(tap);
}
- void LongPressDetected(Actor actor, LongPressGesture longPress)
+ void LongPressDetected(Actor actor, const LongPressGesture& longPress)
{
mControlImpl.OnLongPress(longPress);
}
{
// Remove Current actor, unset AFTER removal so that we do not inform deriving classes
Self().Remove( background.actor );
- background.actor = NULL;
+ background.actor.Reset();
}
ImageActor imageActor = ImageActor::New( image );
GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
}
-void Control::OnPinch(PinchGesture pinch)
+void Control::OnPinch(const PinchGesture& pinch)
{
if( !( mImpl->mStartingPinchScale ) )
{
Self().SetScale( *( mImpl->mStartingPinchScale ) * pinch.scale );
}
+void Control::OnPan( const PanGesture& pan )
+{
+}
+
+void Control::OnTap(const TapGesture& tap)
+{
+}
+
+void Control::OnLongPress( const LongPressGesture& longPress )
+{
+}
+
void Control::OnStageConnection()
{
RelayoutRequest();
return Actor();
}
-bool Control::DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool Control::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
{
bool ret = false;
#include <dali/public-api/events/pinch-gesture.h>
#include <dali/public-api/events/tap-gesture.h>
#include <dali/public-api/object/property-index.h>
+#include <dali/public-api/object/type-info.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
/**
* Connects a callback function with the object's signals.
* @param[in] pinch The pinch gesture.
* @see EnableGestureDetection
*/
- virtual void OnPinch(PinchGesture pinch);
+ virtual void OnPinch(const PinchGesture& pinch);
/**
* @brief Called whenever a pan gesture is detected on this control.
* @param[in] pan The pan gesture.
* @see EnableGestureDetection
*/
- virtual void OnPan(PanGesture pan) { }
+ virtual void OnPan( const PanGesture& pan );
/**
* @brief Called whenever a tap gesture is detected on this control.
* @param[in] tap The tap gesture.
* @see EnableGestureDetection
*/
- virtual void OnTap(TapGesture tap) { }
+ virtual void OnTap( const TapGesture& tap );
/**
* @brief Called whenever a long press gesture is detected on this control.
* @param[in] longPress The long press gesture.
* @see EnableGestureDetection
*/
- virtual void OnLongPress(LongPressGesture longPress) { }
+ virtual void OnLongPress( const LongPressGesture& longPress );
/**
* @brief Called whenever the control is added to the stage.
+++ /dev/null
-/*
- * 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 <dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h>
-
-// EXTERNAL INCLUDES
-#include <algorithm>
-#include <dali/public-api/animation/animation.h>
-#include <dali/public-api/math/random.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-using namespace std;
-
-namespace // unnamed namespace
-{
-const float DEFAULT_SCROLL_SPEED_FACTOR = 0.005f;
-const float DEFAULT_MAXIMUM_SWIPE_SPEED = 3.0f;
-const float DEFAULT_ITEM_FLICK_ANIMATION_DURATION = 0.25f;
-
-const float SELECTED_RIGHT = 2.5f;
-const float SELECTED_LEFT = 3.5f;
-const float SELECTED_CENTER = 3.0f;
-
-const float LAYOUT_POSITION_NAGATIVE_1 = -1.0f;
-const float LAYOUT_POSITION_0 = 0.0f;
-const float LAYOUT_POSITION_2 = 2.0f;
-const float LAYOUT_POSITION_3 = 3.0f;
-const float LAYOUT_POSITION_4 = 4.0f;
-const float LAYOUT_POSITION_6 = 6.0f;
-const float LAYOUT_POSITION_7 = 7.0f;
-
-const Vector3 POSITION_0 = Vector3(850.0f,-250.0f,0.0f);
-const Vector3 POSITION_1 = Vector3(700.0f,50.0f,0.0f);
-const Vector3 POSITION_2 = Vector3(440.0f,227.0f,0.0f);
-const Vector3 POSITION_4 = Vector3(-440.0f,227.0f,0.0f);
-const Vector3 POSITION_5 = Vector3(-700.0f,50.0f,0.0f);
-const Vector3 POSITION_6 = Vector3(-850.0f,-250.0f,0.0f);
-
-const float ROTATION_0 = Math::PI/6.0f;
-const float ROTATION_1 = 0.0f;
-const float ROTATION_2 = Math::PI/6.0f;
-const float ROTATION_4 = -Math::PI/6.0f;
-const float ROTATION_5 = 0.0f;
-const float ROTATION_6 = -Math::PI/6.0f;
-
-const float SCALE = 1.0f;
-
-const Vector2 COLOR = Vector2(1.0f,1.0f);
-
-const Vector3 SELECTED_ITEM_POSITION = Vector3( 0.0f,-80.0f,140.0f);
-const float SELECETED_ITEM_SCALE = 1.72f;
-const Vector2 SELECTED_ITEM_COLOR = Vector2(1.0f,1.0f);
-const Vector3 VIRTUAL_ITEM_POSITION_RIGHT = Vector3( 280.0f,130.0f,130.0f);
-const Vector3 VIRTUAL_ITEM_POSITION_LEFT = Vector3( -280.0f,130.0f,130.0f);
-const float ROTATION_X = Math::PI/4.0f;
-const float SCALE_RIGHT = 1.0f;
-const float SCALE_LEFT = 1.0f;
-const Vector2 COLOR_RIGHT = Vector2(1.0f,1.0f);
-const Vector2 COLOR_LEFT = Vector2(1.0f,1.0f);
-const Vector3 POSITION_RIGHT = Vector3(710.0f,-450.0f,0.0f);
-const Vector3 POSITION_LEFT = Vector3(-710.0f,-450.0f,0.0f);
-const float ROTATION_RIGHT = -Math::PI / 6.0f;
-const float ROTATION_LEFT = Math::PI / 6.0f;
-
-const float ALBUM_HIGHT = 7.0f;
-const float ALPHA = 1.1f;
-const float ALPHA_OF_SIZE = 0.35f;
-const float LINE_OF_BOTTOM = 360.0f;
-
-const float CHANCE_OF_RANDOM_ROTATION_OF_STACK = 0.5f;
-const float RANGE_OF_RANDOM_ROTATION_OF_STACK = 0.5f;
-
-const float THRESHHOLD_OF_MOVING = 0.02f;
-const int NUM_OF_FRAME_FILTERED = 5;
-
-const unsigned int SPREAD_ITEM_NUM = 6;
-
-typedef enum
-{
- SCROLL_LEFT = 1,
- SCROLL_NONE = 0,
- SCROLL_RIGHT = -1
-}ScrollDirection;
-
-struct DefaultItemSizeFunction
-{
- Vector3 operator()(const Vector3& layoutSize)
- {
- float width = layoutSize.height * ALPHA_OF_SIZE;
- return Vector3(width, width, width);
- }
-};
-
-struct AlbumScaleConstraint
-{
- AlbumScaleConstraint(const float scaleRight, const float scaleLeft, const float selectedItemScale, vector<float> scaleSpread)
- {
- mScaleRight = scaleRight;
- mScaleLeft = scaleLeft;
- mSelectedItemScale = selectedItemScale;
-
- if(scaleSpread.size() == SPREAD_ITEM_NUM)
- {
- mScaleVecSpread = scaleSpread;
- }
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- int begin = 0;
- int end = 0;
- float beginScale = 0.0f;
- float endScale = 0.0f;
- float scale = 0.0f;
- float pos = layoutPosition + SELECTED_CENTER;
-
- if(pos <= LAYOUT_POSITION_NAGATIVE_1)/*items of right stack*/
- {
- scale = mScaleRight;
- }
- else if(pos > LAYOUT_POSITION_NAGATIVE_1 && pos < LAYOUT_POSITION_0)/*items between -1.0f and 0.0f*/
- {
- beginScale = mScaleVecSpread.at(0);
- endScale = mScaleRight;
-
- scale = (endScale - beginScale) * fabs(pos) + beginScale;
- }
- else if(pos >= LAYOUT_POSITION_0 && pos < SELECTED_RIGHT)/*items between 0.0f and center*/
- {
- if(int(pos) < pos)
- {
- begin = int(pos);
- end = int(pos) + 1;
-
- beginScale = mScaleVecSpread.at(begin);
- endScale = mScaleVecSpread.at(end);
-
- scale = (endScale - beginScale) * fabs(pos - int(pos)) + beginScale;
- }
- else
- {
- scale = mScaleVecSpread.at(int(pos));
- }
- }
- else if(pos >= SELECTED_RIGHT && pos <= SELECTED_LEFT)/*items of center*/
- {
- scale = mSelectedItemScale;
- }
- else if(pos > SELECTED_LEFT && pos <= LAYOUT_POSITION_6)/*items between center and 6.0f*/
- {
- if(int(pos) < pos)
- {
- begin = int(pos)-1;
- end = int(pos);
-
- beginScale = mScaleVecSpread.at(begin);
- endScale = mScaleVecSpread.at(end);
-
- scale = (endScale - beginScale) * fabs(pos - int(pos)) + beginScale;
- }
- else
- {
- scale = mScaleVecSpread.at(int(pos)-1);
- }
- }
- else if(pos > LAYOUT_POSITION_6 && pos < LAYOUT_POSITION_7)/*items between 6.0f and 7.0f*/
- {
- beginScale = mScaleVecSpread.at(5);
- endScale = mScaleLeft;
-
- scale = (endScale - beginScale) * fabs(pos - int(pos)) + beginScale;
- }
- else if(pos >= LAYOUT_POSITION_7)/*items of left stack*/
- {
- scale = mScaleLeft;
- }
- else
- {
- scale = 1.0f;
- }
-
- return Vector3(scale,scale,1.0f);
- }
-
- float mScaleRight;
- float mScaleLeft;
- float mSelectedItemScale;
- vector<float> mScaleVecSpread;
-};
-
-Vector3 CalculatePosition(Vector3 pos, float rotateX)
-{
- pos.z = pos.z - fabs(pos.y - LINE_OF_BOTTOM) * sinf(rotateX) / cosf(rotateX);
- return pos;
-}
-
-Vector3 CalculateStackPosition(Vector3 pos, float rotateX, int num, bool left)
-{
- pos.z = pos.z - fabs(pos.y - LINE_OF_BOTTOM) * sinf(rotateX) / cosf(rotateX);
-
- if(left)
- {
- pos.x = pos.x + num * ALPHA;
- }
- else
- {
- pos.x = pos.x - num * ALPHA;
- }
-
- pos.y -= num * ALBUM_HIGHT * sinf(rotateX);
- pos.z += num * ALBUM_HIGHT * cosf(rotateX);
-
- return pos;
-}
-
-Vector3 GetPosition(float layoutPos, Vector3 posRight, Vector3 posLeft, Vector3 posSelectedItem, vector<Vector3> posVecSpread, float rotateX)
-{
- int begin =0;
- int end = 0;
-
- float alpha = 0.0f;
-
- Vector3 beginPos = Vector3::ZERO;
- Vector3 endPos = Vector3::ZERO;
-
- Vector3 pos = Vector3::ZERO;
-
- if(layoutPos <= LAYOUT_POSITION_NAGATIVE_1)/*items of right stack*/
- {
- if(int(layoutPos) > layoutPos)
- {
- begin = int(layoutPos);
- end = int(layoutPos)-1;
-
- beginPos = CalculateStackPosition(posRight, rotateX, int(LAYOUT_POSITION_NAGATIVE_1) - int(layoutPos),false);
-
- endPos = CalculateStackPosition(posRight, rotateX, - int(layoutPos),false);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
-
- return pos;
- }
- else
- {
- return CalculateStackPosition(posRight,rotateX,int(LAYOUT_POSITION_NAGATIVE_1) - int(layoutPos),false);
- }
- }
- else if(layoutPos < LAYOUT_POSITION_0 && layoutPos > LAYOUT_POSITION_NAGATIVE_1)/*items between -1.0f and 0.0f*/
- {
- beginPos = CalculatePosition(posVecSpread.at(int(LAYOUT_POSITION_0)),rotateX);
- endPos = CalculateStackPosition(posRight, rotateX, int(layoutPos),false);
-
- alpha = -layoutPos;
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
-
- return pos;
- }
- else if(layoutPos >= LAYOUT_POSITION_0 && layoutPos <= LAYOUT_POSITION_2)/*items between 0.0f and 2.0f*/
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos);
- end = int(layoutPos) + 1;
-
- beginPos = posVecSpread.at(begin);
- endPos = posVecSpread.at(end);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
- }
- else
- {
- pos = posVecSpread.at(int(layoutPos));
- }
- }
- else if(layoutPos >LAYOUT_POSITION_2 && layoutPos<SELECTED_RIGHT)/*items between 2.0f and center*/
- {
- beginPos = posVecSpread.at(int(LAYOUT_POSITION_2));
- endPos = VIRTUAL_ITEM_POSITION_RIGHT;
-
- alpha = (layoutPos - LAYOUT_POSITION_2) / (SELECTED_RIGHT - LAYOUT_POSITION_2);
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
- }
- else if(layoutPos > SELECTED_LEFT && layoutPos < LAYOUT_POSITION_4)/*items between center and 4.0f*/
- {
- beginPos = posVecSpread.at(int(LAYOUT_POSITION_3));
- endPos = VIRTUAL_ITEM_POSITION_LEFT;
-
- alpha = (LAYOUT_POSITION_4 - layoutPos) / (LAYOUT_POSITION_4 - SELECTED_LEFT);
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
- }
- else if(layoutPos >= LAYOUT_POSITION_4 && layoutPos <= LAYOUT_POSITION_6)/*items between 4.0f and 6.0f*/
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos);
- end = int(layoutPos) + 1;
-
- beginPos = posVecSpread.at(begin - 1);
- endPos = posVecSpread.at(end - 1);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
- }
- else
- {
- pos = posVecSpread.at(int(layoutPos) -1);
- }
- }
- else if(layoutPos > LAYOUT_POSITION_6 && layoutPos < LAYOUT_POSITION_7)/*items between 6.0f and 7.0f*/
- {
- beginPos = CalculatePosition(posVecSpread.at(int(LAYOUT_POSITION_6) - 1),rotateX);
- endPos = CalculateStackPosition(posLeft, rotateX, int(layoutPos) + 1 - int(LAYOUT_POSITION_7),true);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
-
- return pos;
- }
- else if(layoutPos >= LAYOUT_POSITION_7)/*items of left stack*/
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos);
- end = int(layoutPos) + 1;
-
- beginPos = CalculateStackPosition(posLeft, rotateX, int(layoutPos) - int(LAYOUT_POSITION_7),true);
-
- endPos = CalculateStackPosition(posLeft, rotateX, int(layoutPos) + 1 - int(LAYOUT_POSITION_7),true);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- pos.x = (endPos.x - beginPos.x) * alpha + beginPos.x;
- pos.y = (endPos.y - beginPos.y) * alpha + beginPos.y;
- pos.z = (endPos.z - beginPos.z) * alpha + beginPos.z;
-
- return pos;
- }
- else
- {
- return CalculateStackPosition(posLeft, rotateX, int(layoutPos) - int(LAYOUT_POSITION_7),true);
- }
- }
-
- return CalculatePosition(pos,rotateX);
-}
-
-struct AlbumPositionConstraint
-{
- AlbumPositionConstraint(const Vector3 posRight, const Vector3 posLeft, const Vector3 posSelectedItem, const vector<Vector3> posVecSpread, float rotateX)
- {
- mPositionRight = posRight;
- mPositionLeft = posLeft;
- mSelectedItemPosition = posSelectedItem;
- mRotationX = rotateX;
-
- if(posVecSpread.size() == SPREAD_ITEM_NUM)
- {
- mPositionVecSpread = posVecSpread;
- }
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float pos = layoutPosition + SELECTED_CENTER;
-
- /*handle if the item is selected item(in the center)*/
- if(pos >= SELECTED_RIGHT && pos <= SELECTED_LEFT)
- {
- return SELECTED_ITEM_POSITION;
- }
-
- /*get the spread items position*/
- return GetPosition(pos,mPositionRight,mPositionLeft,mSelectedItemPosition,mPositionVecSpread,mRotationX);
- }
-
- Vector3 mPositionRight;
- Vector3 mPositionLeft;
- Vector3 mSelectedItemPosition;
- vector<Vector3> mPositionVecSpread;
- float mRotationX;
- };
-
-Quaternion GetRotation(float layoutPos, vector<float> rotateVecStack, vector<float> rotateVecSpread, float rotateX)
-{
- int begin =0;
- int end = 0;
-
- float alpha = 0.0f;
-
- float beginRotation = 0.0f;
- float endRotation = 0.0f;
-
- float rotation = 0.0f;
- if(layoutPos <= LAYOUT_POSITION_NAGATIVE_1)/*items of right stack*/
- {
- if(int(layoutPos) > layoutPos)
- {
- begin = int(layoutPos) + 1;
- end = int(layoutPos);
-
- begin *= -1;
- end *= -1;
-
- beginRotation = rotateVecStack.at(begin);
- endRotation = rotateVecStack.at(end);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else
- {
- rotation = rotateVecStack.at(-int(layoutPos)-1);
- }
- }
- else if(layoutPos > LAYOUT_POSITION_NAGATIVE_1 && layoutPos < LAYOUT_POSITION_0)/*items between -1.0f and 0.0f*/
- {
- begin = 0;
- end = 0;
-
- beginRotation = rotateVecSpread.at(begin);
- endRotation = rotateVecStack.at(end);
-
- alpha = fabs(layoutPos);
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else if(layoutPos >= LAYOUT_POSITION_0 && layoutPos < LAYOUT_POSITION_3)
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos);
- end = int(layoutPos) + 1;
-
- beginRotation = rotateVecSpread.at(begin);
- endRotation = rotateVecSpread.at(end);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else
- {
- rotation = rotateVecSpread.at(int(layoutPos));
- }
- }
- else if(layoutPos > LAYOUT_POSITION_3 && layoutPos <= LAYOUT_POSITION_6)
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos) - 1;
- end = int(layoutPos);
-
- beginRotation = rotateVecSpread.at(begin);
- endRotation = rotateVecSpread.at(end);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else
- {
- rotation = rotateVecSpread.at(int(layoutPos)-1);
- }
- }
- else if(layoutPos > LAYOUT_POSITION_6 && layoutPos < LAYOUT_POSITION_7)
- {
- begin = 5;
- end = 0;
-
- beginRotation = rotateVecSpread.at(begin);
- endRotation = rotateVecStack.at(end);
-
- alpha = fabs(layoutPos - int(LAYOUT_POSITION_6));
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else if(layoutPos >= LAYOUT_POSITION_7)
- {
- if(int(layoutPos) < layoutPos)
- {
- begin = int(layoutPos) - int(LAYOUT_POSITION_7);
- end = int(layoutPos) - int(LAYOUT_POSITION_7) + 1;
-
- beginRotation = rotateVecStack.at(begin);
- endRotation = rotateVecStack.at(end);
-
- alpha = fabs(layoutPos - int(layoutPos));
-
- rotation = (endRotation - beginRotation) * alpha + beginRotation;
- }
- else
- {
- rotation = rotateVecStack.at(int(layoutPos)-int(LAYOUT_POSITION_7));
- }
- }
-
- return Quaternion(rotateX, Vector3::XAXIS) * Quaternion(rotation, Vector3::ZAXIS);
-}
-
-struct AlbumRotationConstraint
-{
- AlbumRotationConstraint(const vector<float> rotatVecSpread, const vector<float> rotatVecStack, const float rotateX, int num)
- {
- mRotationX = rotateX;
- mNumOfItems = num;
- mIndex = 0;
- mLastIndex = 0;
- mLeft = SCROLL_NONE;
- mLastPosition = 0.0f;
- mTimes = 0;
-
- if(rotatVecSpread.size() == SPREAD_ITEM_NUM)
- {
- mRotationVecSpread = rotatVecSpread;
- }
-
- mRotationVecStack = rotatVecStack;
- }
-
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float pos = layoutPosition + SELECTED_CENTER;
-
- if(mIndex == mNumOfItems)
- {
- mIndex = 0;
- }
-
- mIndex ++;
-
- if(mLastIndex != mIndex)
- {
- mLastIndex = mIndex;
-
- if(mLeft == SCROLL_RIGHT)
- {
- if(pos > mLastPosition + THRESHHOLD_OF_MOVING)
- {
- mTimes = 0;
- mLeft = SCROLL_LEFT;
- }
- else if(pos < mLastPosition)
- {
- mTimes = 0;
- mLeft = SCROLL_RIGHT;
- }
- else
- {
- mTimes++;
- if(mTimes > NUM_OF_FRAME_FILTERED)
- {
- mTimes = 0;
- mLeft = SCROLL_NONE;
- }
- }
- }
- else if(mLeft == SCROLL_LEFT)
- {
- if(pos > mLastPosition)
- {
- mTimes = 0;
- mLeft = SCROLL_LEFT;
- }
- else if(pos < mLastPosition - THRESHHOLD_OF_MOVING)
- {
- mTimes = 0;
- mLeft = SCROLL_RIGHT;
- }
- else
- {
- mTimes++;
- if(mTimes > NUM_OF_FRAME_FILTERED)
- {
- mTimes = 0;
- mLeft = SCROLL_NONE;
- }
- }
- }
- else
- {
- if(pos < mLastPosition)
- {
- mLeft = SCROLL_RIGHT;
- }
- else if(pos > mLastPosition)
- {
- mLeft = SCROLL_LEFT;
- }
- else
- {
- mLeft = SCROLL_NONE;
- }
- }
-
- mLastPosition = pos;
-
- /*rotation for the selected item(center)*/
- if(pos >= SELECTED_RIGHT && pos < SELECTED_LEFT)
- {
- if(mLeft == SCROLL_LEFT)
- {
- return Quaternion(-fabs(SELECTED_CENTER - pos), Vector3::YAXIS);
- }
- else if(mLeft == SCROLL_RIGHT)
- {
- return Quaternion(fabs(pos - SELECTED_CENTER), Vector3::YAXIS);
- }
- else
- {
- return Quaternion(0.0f, Vector3::YAXIS);
- }
- }
- }
-
- /*rotation for the spread item*/
- return GetRotation(pos,mRotationVecStack,mRotationVecSpread,mRotationX);
- }
-
- vector<float> mRotationVecSpread;
- vector<float> mRotationVecStack;
- float mRotationX;
- Actor mScrollDirectionActor;
- int mLastIndex;
- int mIndex;
- int mNumOfItems;
- int mTimes;
- ScrollDirection mLeft;
- float mLastPosition;
-};
-
-struct AlbumColorConstraint
-{
- AlbumColorConstraint(const Vector2 colorRight, const Vector2 colorLeft, const Vector2 colorSelectedItem, const vector<Vector2> spreadVecColor, const int stackNum)
- {
- mColorRight = colorRight;
- mColorLeft = colorLeft;
- mSelectedItemColor = colorSelectedItem;
- mStackNum = stackNum;
-
- if(spreadVecColor.size() == SPREAD_ITEM_NUM)
- {
- mColorVecSpread = spreadVecColor;
- }
- }
-
- Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float black = 1.0f;
- Vector4 color = current;
- float pos = layoutPosition + SELECTED_CENTER;
- Vector2 temp = Vector2(0.0f,0.0f);
-
- int begin = 0;
- int end = 0;
-
- Vector2 beginColor = Vector2(0.0f,0.0f);
- Vector2 endColor = Vector2(0.0f,0.0f);
-
- if(pos <= -mStackNum-1)
- {
- color.w = 0.0f;
- black = 0.0f;
- }
- else if(pos > -mStackNum-1 && pos < -mStackNum)
- {
- beginColor = mColorRight;
- endColor = Vector2(0.0f,0.0f);
-
- color.w = (endColor.x - beginColor.x) * fabs(pos - int(pos)) + beginColor.x;
- black = (endColor.y - beginColor.y) * fabs(pos - int(pos)) + beginColor.y;
- }
- else if(pos <= LAYOUT_POSITION_NAGATIVE_1 && pos >= -mStackNum)
- {
- color.w = mColorRight.x;
- black = mColorRight.y;
- }
- else if(pos > LAYOUT_POSITION_NAGATIVE_1 && pos < LAYOUT_POSITION_0)
- {
- beginColor = mColorVecSpread.at(int(LAYOUT_POSITION_0));
- endColor = mColorRight;
-
- color.w = (endColor.x - beginColor.x) * fabs(pos) + beginColor.x;
- black = (endColor.y - beginColor.y) * fabs(pos) + beginColor.y;
- }
- else if(pos >= LAYOUT_POSITION_0 && pos <= LAYOUT_POSITION_2)
- {
- if(int(pos) < pos)
- {
- begin = int(pos);
- end = int(pos) + 1;
-
- beginColor = mColorVecSpread.at(begin);
- endColor = mColorVecSpread.at(end);
-
- temp = (endColor - beginColor) * fabs(pos - int(pos)) + beginColor;
-
- color.w = temp.x;
- black = temp.y;
- }
- else
- {
- beginColor = mColorVecSpread.at(int(pos));
-
- color.w = beginColor.x;
- black = beginColor.y;
- }
- }
- else if(pos > LAYOUT_POSITION_2 && pos < SELECTED_RIGHT)/*items between 2.0f and center*/
- {
- beginColor = mColorVecSpread.at(int(LAYOUT_POSITION_2));
- endColor = Vector2(0.0f,0.0f);
-
- temp = (endColor - beginColor) * (pos - LAYOUT_POSITION_2)/(SELECTED_RIGHT - LAYOUT_POSITION_2) + beginColor;
-
- color.w = temp.x;
- black = temp.y;
- }
- else if(pos >= SELECTED_RIGHT && pos <= SELECTED_LEFT)/*items of center*/
- {
- color.w = mSelectedItemColor.x;
- black = mSelectedItemColor.y;
- }
- else if(pos > SELECTED_LEFT && pos < LAYOUT_POSITION_4)/*items between center and 4.0f*/
- {
- beginColor = Vector2(0.0f,0.0f);
- endColor = mColorVecSpread.at(int(LAYOUT_POSITION_3));
-
- temp = (endColor - beginColor) * (pos - SELECTED_LEFT)/(LAYOUT_POSITION_4 - SELECTED_LEFT) + beginColor;
-
- color.w = temp.x;
- black = temp.y;
- }
- else if(pos >= LAYOUT_POSITION_4 && pos <= LAYOUT_POSITION_6)/*items between 4.0f and 6.0f*/
- {
- if(int(pos) < pos)
- {
- begin = int(pos) - 1;
- end = int(pos);
-
- beginColor = mColorVecSpread.at(begin);
- endColor = mColorVecSpread.at(end);
-
- temp = (endColor - beginColor) * fabs(pos - int(pos)) + beginColor;
-
- color.w = temp.x;
- black = temp.y;
- }
- else
- {
- beginColor = mColorVecSpread.at(int(pos) - 1);
-
- color.w = beginColor.x;
- black = beginColor.y;
- }
- }
- else if(pos > LAYOUT_POSITION_6 && pos < LAYOUT_POSITION_7)/*items between 6.0f and 7.0f*/
- {
- beginColor = mColorVecSpread.at(int(LAYOUT_POSITION_6) - 1);
- endColor = mColorLeft;
-
- color.w = (endColor.x - beginColor.x) * fabs(pos - int(pos)) + beginColor.x;
- black = (endColor.y - beginColor.y) * fabs(pos - int(pos)) + beginColor.y;
- }
- else if(pos >= LAYOUT_POSITION_7 && pos <= mStackNum + int(LAYOUT_POSITION_7))/*items of left stack*/
- {
- color.w = mColorLeft.x;
- black = mColorLeft.y;
- }
- else if(pos > mStackNum + int(LAYOUT_POSITION_7) && pos < mStackNum + int(LAYOUT_POSITION_7) + 1)
- {
- beginColor = mColorLeft;
- endColor = Vector2(0.0f,0.0f);
-
- color.w = (endColor.x - beginColor.x) * fabs(pos - int(pos)) + beginColor.x;
- black = (endColor.y - beginColor.y) * fabs(pos - int(pos)) + beginColor.y;
- }
- else if(pos >= mStackNum + int(LAYOUT_POSITION_7) +1)
- {
- color.w = 0.0f;
- black = 0.0f;
- }
-
- color.r = color.r * black;
- color.g = color.g * black;
- color.b = color.b * black;
-
- return color;
- }
-
- int mStackNum;
- Vector2 mColorRight;
- Vector2 mColorLeft;
- Vector2 mSelectedItemColor;
- vector<Vector2> mColorVecSpread;
-};
-
-struct AlbumVisibilityConstraintPortrait
-{
- AlbumVisibilityConstraintPortrait()
- {
- }
-
- bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- return true;
- }
-};
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-struct AlbumLayout::Impl
-{
- Impl()
- : mItemSizeFunction(DefaultItemSizeFunction()),
- mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR),
- mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED),
- mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION),
- mNumOfItems(0)
- {
- /*Initialize the variables*/
- mSelectedItemScale = SELECETED_ITEM_SCALE;
- mRotationX = ROTATION_X;
- mScaleRight = SCALE_RIGHT;
- mScaleLeft = SCALE_LEFT;
- mRotationRight = ROTATION_RIGHT;
- mRotationLeft = ROTATION_LEFT;
- mSelectedItemColor = SELECTED_ITEM_COLOR;
- mSelectedItemPosition = SELECTED_ITEM_POSITION;
- mColorRight = COLOR_RIGHT;
- mColorLeft = COLOR_LEFT;
- mPositionRight = POSITION_RIGHT;
- mPositionLeft = POSITION_LEFT;
- mStackNum = 50;
-
- /*Initialize the position of spread items*/
- mPositionVecSpread.push_back(POSITION_0);
- mPositionVecSpread.push_back(POSITION_1);
- mPositionVecSpread.push_back(POSITION_2);
- mPositionVecSpread.push_back(POSITION_4);
- mPositionVecSpread.push_back(POSITION_5);
- mPositionVecSpread.push_back(POSITION_6);
-
- /*Initialize the rotation of spread items*/
- mRotationVecSpread.push_back(ROTATION_0);
- mRotationVecSpread.push_back(ROTATION_1);
- mRotationVecSpread.push_back(ROTATION_2);
- mRotationVecSpread.push_back(ROTATION_4);
- mRotationVecSpread.push_back(ROTATION_5);
- mRotationVecSpread.push_back(ROTATION_6);
-
- /*Initialize the scale of spread items*/
- for(unsigned int i=0; i<SPREAD_ITEM_NUM; i++)
- {
- mScaleVecSpread.push_back(SCALE);
- }
-
- /*Initialize the color of spread items*/
- for(unsigned int i=0; i<SPREAD_ITEM_NUM; i++)
- {
- mColorVecSpread.push_back(COLOR);
- }
- }
-
- void SetPosition(vector<Vector3> positionList)
- {
- if(positionList.size() == SPREAD_ITEM_NUM)
- {
- mPositionVecSpread = positionList;
- }
- }
-
- vector<Vector3> GetPosition() const
- {
- return mPositionVecSpread;
- }
-
- void SetColor(vector<Vector2> colorList)
- {
- if(colorList.size() == SPREAD_ITEM_NUM)
- {
- mColorVecSpread = colorList;
- }
- }
-
- vector<Vector2> GetColor() const
- {
- return mColorVecSpread;
- }
-
- void SetScale(vector<float> scaleList)
- {
- if(scaleList.size() == SPREAD_ITEM_NUM)
- {
- mScaleVecSpread = scaleList;
- }
- }
-
- vector<float> GetScale() const
- {
- return mScaleVecSpread;
- }
-
- void SetRotationX(float rotat_x)
- {
- mRotationX = rotat_x;
- }
-
- float GetRotationX() const
- {
- return mRotationX;
- }
-
- void SetRotationZ(vector<float> rotationList)
- {
- if(rotationList.size() == SPREAD_ITEM_NUM)
- {
- mRotationVecSpread = rotationList;
- }
- }
-
- vector<float> GetRotationZ() const
- {
- return mRotationVecSpread;
- }
-
- void SetCenterPosition(Vector3 pos)
- {
- mSelectedItemPosition = pos;
- }
-
- Vector3 GetCenterPosition() const
- {
- return mSelectedItemPosition;
- }
-
- void SetCenterScale(float scale)
- {
- mSelectedItemScale = scale;
- }
-
- float GetCenterScale() const
- {
- return mSelectedItemScale;
- }
-
- void SetCenterColor(Vector2 color)
- {
- mSelectedItemColor = color;
- }
-
- Vector2 GetCenterColor() const
- {
- return mSelectedItemColor;
- }
-
- void SetStackPosition(Vector3 rightPos, Vector3 leftPos)
- {
- mPositionRight = rightPos;
- mPositionLeft = leftPos;
- }
-
- Vector3 GetRightStackPosition() const
- {
- return mPositionRight;
- }
-
- Vector3 GetLeftStackPosition() const
- {
- return mPositionLeft;
- }
-
- void SetStackScale(float rightScale, float leftScale)
- {
- mScaleRight = rightScale;
- mScaleLeft = leftScale;
- }
-
- float GetRightStackScale() const
- {
- return mScaleRight;
- }
-
- float GetLeftStackScale() const
- {
- return mScaleLeft;
- }
-
- void SetStackColor(Vector2 rightColor, Vector2 leftColor)
- {
- mColorRight = rightColor;
- mColorLeft = leftColor;
- }
-
- Vector2 GetRightStackColor() const
- {
- return mColorRight;
- }
-
- Vector2 GetLeftStackColor() const
- {
- return mColorLeft;
- }
-
- void SetNumOfItems(int num)
- {
- mNumOfItems = num;
-
- /*Initialize the rotation of stack items*/
- for(int i=0; i<mNumOfItems; i++)
- {
- if(Random::Chance(CHANCE_OF_RANDOM_ROTATION_OF_STACK))
- {
- mRotationVecStack.push_back(Random::Range(-RANGE_OF_RANDOM_ROTATION_OF_STACK,RANGE_OF_RANDOM_ROTATION_OF_STACK));
- }
- else
- {
- mRotationVecStack.push_back(0.0f);
- }
- }
- }
-
- int GetNumOfItems() const
- {
- return mNumOfItems;
- }
-
- void SetStackNum(int num)
- {
- mStackNum = num;
- }
-
- int GetStackNum() const
- {
- return mStackNum;
- }
-
- ItemSizeFunction mItemSizeFunction;
-
- float mScrollSpeedFactor;
- float mMaximumSwipeSpeed;
- float mItemFlickAnimationDuration;
-
- Vector3 mSelectedItemPosition;/*position of selected item*/
- float mSelectedItemScale;/*scale of selected item*/
- Vector2 mSelectedItemColor;/*color of selected item*/
-
- float mRotationX;/*rotation around X*/
-
- vector<Vector3> mPositionVecSpread;/*positions of the spread items*/
- vector<float> mRotationVecSpread;/*rotations of the spread items*/
- vector<float> mScaleVecSpread;/*scales of the spread items*/
- vector<Vector2> mColorVecSpread;/*colors of the spread items*/
-
- vector<float> mRotationVecStack;/*rotations of the stack items*/
-
- float mRotationRight;/*rotation of right album stack*/
- float mRotationLeft;/*rotation of left album stack*/
-
- float mScaleRight;/*scale of right album stack*/
- float mScaleLeft;/*scale of left album stack*/
-
- Vector2 mColorRight;/*color of right album stack*/
- Vector2 mColorLeft;/*color of left album stack*/
-
- Vector3 mPositionRight;/*position of right album stack*/
- Vector3 mPositionLeft;/*position of left album stack*/
-
- int mNumOfItems;/*num of items*/
- int mStackNum;/*num of items of stack*/
-};
-
-AlbumLayoutPtr AlbumLayout::New()
-{
- return AlbumLayoutPtr(new AlbumLayout());
-}
-
-AlbumLayout::~AlbumLayout()
-{
- delete mImpl;
-}
-
-void AlbumLayout::SetItemSizeFunction(ItemSizeFunction function)
-{
- mImpl->mItemSizeFunction = function;
-}
-
-AlbumLayout::ItemSizeFunction AlbumLayout::GetItemSizeFunction() const
-{
- return mImpl->mItemSizeFunction;
-}
-
-void AlbumLayout::SetScrollSpeedFactor(float scrollSpeed)
-{
- mImpl->mScrollSpeedFactor = scrollSpeed;
-}
-
-void AlbumLayout::SetMaximumSwipeSpeed(float speed)
-{
- mImpl->mMaximumSwipeSpeed = speed;
-}
-
-void AlbumLayout::SetItemFlickAnimationDuration(float durationSeconds)
-{
- mImpl->mItemFlickAnimationDuration = durationSeconds;
-}
-
-float AlbumLayout::GetScrollSpeedFactor() const
-{
- return mImpl->mScrollSpeedFactor;
-}
-
-float AlbumLayout::GetMaximumSwipeSpeed() const
-{
- return mImpl->mMaximumSwipeSpeed;
-}
-
-float AlbumLayout::GetItemFlickAnimationDuration() const
-{
- return mImpl->mItemFlickAnimationDuration;
-}
-
-float AlbumLayout::GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const
-{
- return - static_cast<float>(numberOfItems) + 1;
-}
-
-float AlbumLayout::GetClosestAnchorPosition(float layoutPosition) const
-{
- return round(layoutPosition);
-}
-
-float AlbumLayout::GetItemScrollToPosition(unsigned int itemId) const
-{
- return -(static_cast<float>(itemId));
-}
-
-ItemRange AlbumLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const
-{
- return ItemRange(0, mImpl->mNumOfItems);
-}
-
-unsigned int AlbumLayout::GetReserveItemCount(Vector3 layoutSize) const
-{
- return 0;
-}
-
-bool AlbumLayout::GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const
-{
- itemSize = mImpl->mItemSizeFunction(layoutSize);
- return true;
-}
-
-void AlbumLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
- if(animation)
- {
- animation.Resize(actor, size);
- }
-}
-
-bool AlbumLayout::GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- constraint = AlbumPositionConstraint(mImpl->mPositionRight,mImpl->mPositionLeft,mImpl->mSelectedItemPosition,mImpl->mPositionVecSpread,mImpl->mRotationX);
- return true;
-}
-
-bool AlbumLayout::GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const
-{
- constraint = AlbumRotationConstraint(mImpl->mRotationVecSpread,mImpl->mRotationVecStack,mImpl->mRotationX,mImpl->mNumOfItems);
- return true;
-}
-
-bool AlbumLayout::GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- constraint = AlbumScaleConstraint(mImpl->mScaleRight,mImpl->mScaleLeft,mImpl->mSelectedItemScale,mImpl->mScaleVecSpread);
- return true;
-}
-
-bool AlbumLayout::GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const
-{
- constraint = AlbumColorConstraint(mImpl->mColorRight,mImpl->mColorLeft,mImpl->mSelectedItemColor,mImpl->mColorVecSpread,mImpl->mStackNum);
- return true;
-}
-
-bool AlbumLayout::GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const
-{
- constraint = AlbumVisibilityConstraintPortrait();
- return true;
-}
-
-Degree AlbumLayout::GetScrollDirection() const
-{
- Degree scrollDirection(0);
-
- scrollDirection = -90.0f;
-
- return scrollDirection;
-}
-
-void AlbumLayout::SetNumOfItems(int num)
-{
- mImpl->SetNumOfItems(num);
-}
-
-int AlbumLayout::GetNumOfItems() const
-{
- return mImpl->GetNumOfItems();
-}
-
-void AlbumLayout::SetStackNum(int num)
-{
- mImpl->SetStackNum(num);
-}
-
-int AlbumLayout::GetStackNum() const
-{
- return mImpl->GetStackNum();
-}
-
-void AlbumLayout::SetPosition(vector<Vector3> positionList)
-{
- mImpl->SetPosition(positionList);
-}
-
-vector<Vector3> AlbumLayout::GetPosition() const
-{
- return mImpl->GetPosition();
-}
-
-void AlbumLayout::SetScale(vector<float> scaleList)
-{
- mImpl->SetScale(scaleList);
-}
-
-vector<float> AlbumLayout::GetScale() const
-{
- return mImpl->GetScale();
-}
-
-void AlbumLayout::SetColor(vector<Vector2> colorList)
-{
- mImpl->SetColor(colorList);
-}
-
-vector<Vector2> AlbumLayout::GetColor() const
-{
- return mImpl->GetColor();
-}
-
-void AlbumLayout::SetRotationX(float rotation)
-{
- mImpl->SetRotationX(rotation);
-}
-
-float AlbumLayout::GetRotationX() const
-{
- return mImpl->GetRotationX();
-}
-
-void AlbumLayout::SetRotationZ(vector<float> rotationList)
-{
- mImpl->SetRotationZ(rotationList);
-}
-
-vector<float> AlbumLayout::GetRotationZ() const
-{
- return mImpl->GetRotationZ();
-}
-
-void AlbumLayout::SetCenterPosition(Vector3 pos)
-{
- mImpl->SetCenterPosition(pos);
-}
-
-Vector3 AlbumLayout::GetCenterPosition() const
-{
- return mImpl->GetCenterPosition();
-}
-
-void AlbumLayout::SetCenterScale(float scale)
-{
- mImpl->SetCenterScale(scale);
-}
-
-float AlbumLayout::GetCenterScale() const
-{
- return mImpl->GetCenterScale();
-}
-
-void AlbumLayout::SetCenterColor(Vector2 color)
-{
- mImpl->SetCenterColor(color);
-}
-
-Vector2 AlbumLayout::GetCenterColor() const
-{
- return mImpl->GetCenterColor();
-}
-
-void AlbumLayout::SetStackPosition(Vector3 rightPos, Vector3 leftPos)
-{
- mImpl->SetStackPosition(rightPos, leftPos);
-}
-
-Vector3 AlbumLayout::GetRightStackPosition() const
-{
- return mImpl->GetRightStackPosition();
-}
-
-Vector3 AlbumLayout::GetLeftStackPosition() const
-{
- return mImpl->GetLeftStackPosition();
-}
-
-void AlbumLayout::SetStackScale(float rightScale, float leftScale)
-{
- mImpl->SetStackScale(rightScale,leftScale);
-}
-
-float AlbumLayout::GetRightStackScale() const
-{
- return mImpl->GetRightStackScale();
-}
-
-float AlbumLayout::GetLeftStackScale() const
-{
- return mImpl->GetLeftStackScale();
-}
-
-void AlbumLayout::SetStackColor(Vector2 rightColor, Vector2 leftColor)
-{
- mImpl->SetStackColor(rightColor, leftColor);
-}
-
-Vector2 AlbumLayout::GetRightStackColor() const
-{
- return mImpl->GetRightStackColor();
-}
-
-Vector2 AlbumLayout::GetLeftStackColor() const
-{
- return mImpl->GetLeftStackColor();
-}
-
-AlbumLayout::AlbumLayout()
-: mImpl(NULL)
-{
- mImpl = new Impl();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_ALBUM_LAYOUT_H__
-#define __DALI_TOOLKIT_ALBUM_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.
- *
- */
-
-/*
-Note:This layout is customized for music player application, so there are some limitations:
-1.This layout can only be used with 1280x720 mode (not 720x1280);
-2.Need promram in application layer to support it(EX.SetNum).
-*/
-
-// EXTERNAL INCLUDES
-#include <boost/function.hpp>
-#include <dali/public-api/common/vector-wrapper.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-class AlbumLayout;
-
-typedef IntrusivePtr<AlbumLayout> AlbumLayoutPtr;
-
-/**
- * An ItemView layout which arranges items in a album.
- */
-class DALI_IMPORT_API AlbumLayout : public ItemLayout
-{
-public:
-
- typedef boost::function<Vector3 (const Vector3& layoutSize)> ItemSizeFunction;
- typedef boost::function<float (const Vector3& layoutSize)> AlbumRadiusFunction;
-
- /**
- * Create a new album layout
- */
- static AlbumLayoutPtr New();
-
- /**
- * Virtual destructor.
- */
- virtual ~AlbumLayout();
-
- /**
- * 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 function used to calculate the album radius, for a given layout-size.
- * @param[in] function The spiral-radius function.
- */
- void SetAlbumRadiusFunction(AlbumRadiusFunction function);
-
- /**
- * Get the function used to calculate the album radius.
- * @return The album-radius function.
- */
- AlbumRadiusFunction GetAlbumRadiusFunction() 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;
-
- /**
- * Set the num of items.
- * @param[in] num The number of items.
- */
- void SetNumOfItems(int num);
-
- /**
- * Get the num of items.
- */
- int GetNumOfItems() const;
-
- /**
- * Set the items num of stack.
- * @param[in] num The number of items on the stack.
- */
- void SetStackNum(int num);
-
- /**
- * Get the items num of stack.
- */
- int GetStackNum() const;
-
- /**
- * Set the position of each item.
- * @param[in] positionList The vector which contains the position for each item.
- */
- void SetPosition(std::vector<Vector3> positionList);
-
- /**
- * Get the position of each item.
- */
- std::vector<Vector3> GetPosition() const;
-
- /**
- * Set the rotation of each item.
- * @param[in] rotation around X, the vector which contains the rotation for each item.
- */
- void SetRotationX(float rotation);
-
- /**
- * Set the rotation of each item.
- */
- float GetRotationX() const;
-
- /**
- * Set the rotation of each item.
- * @param[in] rotationList around Z, the vector which contains the rotation for each item.
- */
- void SetRotationZ(std::vector<float> rotationList);
-
- /**
- * Get the rotation of each item.
- */
- std::vector<float> GetRotationZ() const;
-
- /**
- * Set the scale of each item.
- * @param[in] scaleList The vector which contains the scale for each item.
- */
- void SetScale(std::vector<float> scaleList);
-
- /**
- * Get the scale of each item.
- */
- std::vector<float> GetScale() const;
-
- /**
- * Set the color of each item.
- * @param[in] colorList The vector which contains the color for each item.
- */
- void SetColor(std::vector<Vector2> colorList);
-
- /**
- * Get the color of each item.
- */
- std::vector<Vector2> GetColor() const;
-
- /**
- * Set the position of center(selected) item.
- * @param[in] pos The positon to set.
- */
- void SetCenterPosition(Vector3 pos);
-
-
- /**
- * Get the position of center(selected) item.
- */
- Vector3 GetCenterPosition() const;
-
- /**
- * Set the scale of center(selected) item.
- * @param[in] scale The scale to set.
- */
- void SetCenterScale(float scale);
-
- /**
- * Get the scale of center(selected) item.
- */
- float GetCenterScale() const;
-
- /**
- * Set the color of center(selected) item.
- * @param[in] color The color to set.
- */
- void SetCenterColor(Vector2 color);
-
- /**
- * Get the color of center(selected) item.
- */
- Vector2 GetCenterColor() const;
-
- /**
- * Set the postion of stack item(right stack and left stack).
- * @param[in] rightPos The position of right stack.
- * @param[in] leftPos The position of left stack,.
- */
- void SetStackPosition(Vector3 rightPos, Vector3 leftPos);
-
- /**
- * Get the postion of right stack .
- */
- Vector3 GetRightStackPosition() const;
-
- /**
- * Get the postion of left stack .
- */
- Vector3 GetLeftStackPosition() const;
-
- /**
- * Set the scale of stack item(right stack and left stack).
- * @param[in] rightScale The scale of right stack.
- * @param[in] leftScale The scale of left stack,.
- */
- void SetStackScale(float rightScale, float leftScale);
-
- /**
- * Get the scale of right stack.
- */
- float GetRightStackScale() const;
-
- /**
- * Get the scale of left stack.
- */
- float GetLeftStackScale() const;
-
- /**
- * Set the color of stack item(right stack and left stack).
- * @param[in] rightColor The color of right stack.
- * @param[in] leftColor The color of left stack.
- */
- void SetStackColor(Vector2 rightColor, Vector2 leftColor);
-
- /**
- * Get the color of right stack.
- */
- Vector2 GetRightStackColor() const;
-
- /**
- * Get the color of left stack.
- */
- Vector2 GetLeftStackColor() 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 AlbumLayout::New()
- */
- AlbumLayout();
-
-private:
-
- struct Impl;
- Impl* mImpl;
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_ALBUM_LAYOUT_H__
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
float layoutWidth)
{
// Share the available space between margins & column spacings
- float availableSpace = max(0.0f, (layoutWidth - itemSize.width*numberOfColumns));
+ float availableSpace = std::max(0.0f, (layoutWidth - itemSize.width*numberOfColumns));
float leftMargin = availableSpace/numberOfColumns * 0.5f;
if (row < 0.0f)
{
- darkness = alpha = max(0.0f, 1.0f + row);
+ darkness = alpha = std::max(0.0f, 1.0f + row);
}
else
{
if (row > (mNumberOfRows-1.0f))
{
- alpha = max(0.0f, 1.0f - (row-(mNumberOfRows-1.0f)));
+ alpha = std::max(0.0f, 1.0f - (row-(mNumberOfRows-1.0f)));
}
}
float firstRow = -(firstItemPosition/mImpl->mNumberOfColumns);
float lastRow = firstRow + mImpl->mNumberOfRows * 0.5f;
- unsigned int firstItem = static_cast<unsigned int>(max(0.0f, firstRow * mImpl->mNumberOfColumns));
- unsigned int lastItem = static_cast<unsigned int>(max(0.0f, lastRow * mImpl->mNumberOfColumns));
+ unsigned int firstItem = static_cast<unsigned int>(std::max(0.0f, firstRow * mImpl->mNumberOfColumns));
+ unsigned int lastItem = static_cast<unsigned int>(std::max(0.0f, lastRow * mImpl->mNumberOfColumns));
return ItemRange(firstItem, lastItem+1);
}
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
mTopMargin(DEFAULT_TOP_MARGIN),
mBottomMargin(DEFAULT_BOTTOM_MARGIN),
mSideMargin(DEFAULT_SIDE_MARGIN),
+ mZGap(0.f),
mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR),
mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED),
mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION),
Vector3 currentSize( actor.GetCurrentSize() );
Vector3 shrink( currentSize );
- shrink.width = min(size.width, currentSize.width);
- shrink.height = min(size.height, currentSize.height);
+ shrink.width = std::min(size.width, currentSize.width);
+ shrink.height = std::min(size.height, currentSize.height);
// Do a nonlinear size animation to shrink the actor first when the actor size changes,
// so that we can avoid the actors overlapping during orientation change.
#include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
}
else
{
- float yStep = max(50.0f, min(itemSize.y, scrollSpeedFactor));
+ 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 -= min(3000.0f, scrollSpeedFactor * 2.0f);
+ z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
return Vector3(itemSize.x * 0.5f - layoutSize.x * 0.5f, y, z);
}
}
else
{
- float xStep = max(50.0f, min(itemSize.y, scrollSpeedFactor));
+ 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 -= min(3000.0f, scrollSpeedFactor * 2.0f);
+ z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
return Vector3(x, itemSize.x * 0.5f - layoutSize.y * 0.5f, z);
}
}
else
{
- float yStep = max(50.0f, min(itemSize.y, scrollSpeedFactor));
+ 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 -= min(3000.0f, scrollSpeedFactor * 2.0f);
+ z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
return Vector3(-(itemSize.x * 0.5f - layoutSize.x * 0.5f),
}
else
{
- float xStep = max(50.0f, min(itemSize.y, scrollSpeedFactor));
+ 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 -= min(3000.0f, scrollSpeedFactor * 2.0f);
+ z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
return Vector3(-x,
itemSize.x * 0.5f - layoutSize.y * 0.5f,
factor = adjustedLayoutPosition - 1.0f;
}
- float scale = min(1.0f, max(0.1f, 1.0f - 0.1f * factor));
+ float scale = std::min(1.0f, std::max(0.1f, 1.0f - 0.1f * factor));
if(scrollSpeed > 0.0f)
{
- scale *= min(1.0f, max(0.1f, 1.0f / (scrollSpeed * 0.05f)));
+ scale *= std::min(1.0f, std::max(0.1f, 1.0f / (scrollSpeed * 0.05f)));
}
return Vector3(scale, scale, scale);
factor = adjustedLayoutPosition - 1.0f;
}
- float darkness = min(1.0f, max(0.5f, 1.0f - 0.5f * factor));
- float alpha = min(1.0f, max(0.0f, 1.0f - 0.9f * factor));
+ 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);
}
};
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
{
mImpl->mItemSpacingRadians = itemSpacing;
- float itemsPerSpiral = max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
+ float itemsPerSpiral = std::max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
mImpl->mItemDescent = mImpl->mRevolutionDistance / itemsPerSpiral;
}
{
mImpl->mRevolutionDistance = distance;
- float itemsPerSpiral = max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
+ float itemsPerSpiral = std::max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
mImpl->mItemDescent = mImpl->mRevolutionDistance / itemsPerSpiral;
}
float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height;
float itemsPerSpiral = layoutHeight / mImpl->mItemDescent;
float itemsCachedBeforeTopItem = layoutHeight * (mImpl->mTopItemAlignment + 0.5f) / mImpl->mItemDescent;
- float itemsViewable = min(itemsPerSpiral, itemsPerSpiral - itemsCachedBeforeTopItem - firstItemPosition + 1.0f);
+ float itemsViewable = std::min(itemsPerSpiral, itemsPerSpiral - itemsCachedBeforeTopItem - firstItemPosition + 1.0f);
- unsigned int firstItem = static_cast<unsigned int>(max(0.0f, -firstItemPosition - itemsCachedBeforeTopItem - 1.0f));
- unsigned int lastItem = static_cast<unsigned int>(max(0.0f, firstItem + itemsViewable));
+ unsigned int firstItem = static_cast<unsigned int>(std::max(0.0f, -firstItemPosition - itemsCachedBeforeTopItem - 1.0f));
+ unsigned int lastItem = static_cast<unsigned int>(std::max(0.0f, firstItem + itemsViewable));
return ItemRange(firstItem, lastItem+1);
}
+++ /dev/null
-/*
- * 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 <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h>
-#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
-#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h>
-
-using namespace Dali;
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-const float ScrollViewTwistEffect::DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK( 0.0f );
-
-ScrollViewTwistEffect ScrollViewTwistEffect::New()
-{
- return ScrollViewTwistEffect(new Internal::ScrollViewTwistEffect());
-}
-
-ScrollViewTwistEffect::ScrollViewTwistEffect()
-{
-
-}
-
-ScrollViewTwistEffect::ScrollViewTwistEffect(Internal::ScrollViewTwistEffect *impl)
-: ScrollViewEffect(impl)
-{
-}
-
-ScrollViewTwistEffect ScrollViewTwistEffect::DownCast( BaseHandle handle )
-{
- return ScrollViewTwistEffect( dynamic_cast<Internal::ScrollViewTwistEffect*>(handle.GetObjectPtr()) );
-}
-
-float ScrollViewTwistEffect::GetMinimumDistanceForShrink() const
-{
- return GetImpl(*this).GetMinimumDistanceForShrink();
-}
-
-void ScrollViewTwistEffect::SetMinimumDistanceForShrink(float distance)
-{
- GetImpl(*this).SetMinimumDistanceForShrink( distance );
-}
-
-void ScrollViewTwistEffect::EnableEffect(bool enableFlag)
-{
- GetImpl(*this).EnableEffect(enableFlag);
-}
-
-void ScrollViewTwistEffect::ApplyToActor( Actor child,
- bool additionalEffects,
- const Vector2& angleSwing,
- float scaleAmount,
- float delayMin,
- float delayMax )
-{
- GetImpl(*this).ApplyToActor( child,
- additionalEffects,
- angleSwing,
- scaleAmount,
- delayMin,
- delayMax );
-}
-
-void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle)
-{
- GetImpl(*this).SetMaxSwingAngle(maxSwingAngle);
-}
-
-Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const
-{
- return GetImpl( *this ).GetMaxSwingAngle();
-}
-
-void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function)
-{
- GetImpl(*this).SetSwingDropOff(dropOff, distance, function);
-}
-
-void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const
-{
- GetImpl(*this).GetSwingDropOff(dropOff, distance, function);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__
-#define __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
-
-namespace Dali
-{
-
-class Actor;
-
-namespace Toolkit
-{
-
-class ScrollViewEffect;
-
-namespace Internal DALI_INTERNAL
-{
-class ScrollViewTwistEffect;
-}
-
-/**
- * @brief ScrollView effect that twists pages onto screen when transitioning.
- */
-class DALI_IMPORT_API ScrollViewTwistEffect : public ScrollViewEffect
-{
-
-public:
-
- static const float DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK; ///< The min distance for shrink
-
-public:
-
- /**
- * @brief Create an initialized ScrollViewTwistEffect.
- *
- * @return A handle to a newly allocated Dali resource.
- */
- static ScrollViewTwistEffect New();
-
- /**
- * @brief Create an uninitialized ScrollViewTwistEffect; this can be initialized with ScrollViewTwistEffect::New().
- *
- * Calling member functions with an uninitialized Toolkit::ScrollViewTwistEffect is not allowed.
- */
- ScrollViewTwistEffect();
-
- /**
- * @brief Downcast an Object handle to ScrollViewTwistEffect.
- *
- * If handle points to a ScrollViewTwistEffect the
- * downcast produces valid handle. If not the returned handle is left uninitialized.
- * @param[in] handle Handle to an object
- * @return handle to a ScrollViewTwistEffect or an uninitialized handle
- */
- static ScrollViewTwistEffect DownCast( BaseHandle handle );
-
- /**
- * @brief Gets the minimum animation distance for the shrink effect to
- * occur.
- *
- * @return The minimum distance in seconds is returned.
- */
- float GetMinimumDistanceForShrink() const;
-
- /**
- * @brief Sets the minimum animation distance for the shrink effect
- * to occur.
- *
- * @param[in] distance The minimum distance in pixels (default = 0.0)
- * i.e. any flick will result in shrinking.
- */
- void SetMinimumDistanceForShrink(float distance);
-
- /**
- * @brief Enable or disable this effect.
- *
- * @param[in] enableFlag Set to true if the effect should be enabled.
- */
- void EnableEffect(bool enableFlag);
-
- /**
- * @brief Manually apply effect to an Actor.
- *
- * @param[in] child The child Actor to be affected by this effect.
- * @param[in] additionalEffects Whether just the basic effect (delay)
- * should be applied. Or all effects (delay, rotation, scaling).
- * For all effects set to true. Default is true i.e. apply all effects.
- * @param[in] angleSwing The maximum amount the child actor should
- * rotate in radians for each axis (X and Y) if the scrollview reaches
- * overshoot. Default is PI/2 i.e. 90 degrees rotation.
- * @param[in] scaleAmount The relative amount to shrink Actors as they
- * are panned fast (flick animation). default is 0.125 (12.5% shrinkage)
- * @param[in] delayMin The minimum delay coefficient for Actors at the
- * scroll-view center. Set to 0 for instantaneous, and 1 for infinite delay.
- * Default is 0.0f
- * @param[in] delayMax The maximum delay coefficient for Actors at the
- * scroll-view approx 1 ScrollView size from the center. Set to 0 for
- * instantaneous, and 1 for infinite delay. Default is 0.9f (a slight delay)
- */
- void ApplyToActor( Actor child,
- bool additionalEffects = true,
- const Vector2& angleSwing = Vector2( Math::PI_4, Math::PI_4 ),
- float scaleAmount = 0.125f,
- float delayMin = 0.0f,
- float delayMax = 0.9f );
-
- /**
- * @brief Set the maximum swing angle when at zero drop off.
- *
- * @param[in] maxSwingAngle maximum swing angle for x and y axes
- */
- void SetMaxSwingAngle(const Vector2& maxSwingAngle);
-
- /**
- * @brief Retrieve the maximum swing angle when at zero drop off.
- *
- * @return The maximum swing angle for x and y axes
- */
- Vector2 GetMaxSwingAngle() const;
-
- /**
- * @brief Set the drop off values to affect the amount of swing
- * angle applied to an actor the further it is from the scroll
- * position.
- *
- * A drop off of 0.0f means no angle drop off while 1.0f will reduce
- * the angle to zero over the distance supplied for that axis.
- *
- * Example maxSwingAngle.x is Pi, dropOff.x is 0.5f and distance.x is 100.0f:
- * The angle on the x axis will reduce to (0.5f * Pi) over 100 pixels
- *
- * @param[in] dropOff amount to reduce swing angle by in the range [0.0f, 1.0f]. 0.0f
- * @param[in] distance distance to apply dropOff in pixels
- * @param[in] function Alpha Function to affect how drop off is applied over distance, NULL for linear application
- */
- void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL);
-
- /**
- * @brief Get the drop off values that affect the amount of swing angle that is applied to an actor.
- *
- * @param[out] dropOff The current drop-off amount.
- * @param[out] distance The current distance to apply drop-off in pixels.
- * @param[out] function The current alpha function used to affect how the drop iff is applied over the distance.
- */
- void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const;
-
-protected:
-
- /**
- * @brief This constructor is used by Dali New() methods.
- *
- * @param [in] impl A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL ScrollViewTwistEffect(Internal::ScrollViewTwistEffect *impl);
-
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__
FixedRuler::FixedRuler(float spacing)
: mSpacing(spacing)
{
+ if(fabsf(mSpacing) <= Math::MACHINE_EPSILON_1)
+ {
+ DALI_LOG_ERROR( "Page spacing too small (%f).", double(spacing) );
+ mSpacing = spacing >= 0.0f ? Math::MACHINE_EPSILON_1 : -Math::MACHINE_EPSILON_1;
+ }
mType = Fixed;
}
volume = 0;
// spacing must be present.
- if(mEnabled && fabsf(mSpacing) > Math::MACHINE_EPSILON_1)
+ if( mEnabled )
{
unsigned int column = page;
unsigned int page = 0;
// spacing must be present.
- if(mEnabled && fabsf(mSpacing) > Math::MACHINE_EPSILON_1)
+ if( mEnabled )
{
if( wrap )
{
if(wrap)
{
unsigned int pagesPerVolume = mDomain.GetSize() / mSpacing;
+ // Defensive check to avoid a divide by zero below when the ruler is in an invalid state (entire domain smaller than spacing between pages of it):
+ if(pagesPerVolume < 1u)
+ {
+ pagesPerVolume = 1u;
+ DALI_LOG_ERROR("Ruler domain(%f) is smaller than its spacing(%f).", mDomain.GetSize() * 1.0, mSpacing * 1.0 );
+ }
page %= pagesPerVolume;
}
}
unsigned int pagesPerVolume = 1;
// spacing must be present.
- if(mEnabled && fabsf(mSpacing) > Math::MACHINE_EPSILON_1)
+ if( mEnabled )
{
pagesPerVolume = mDomain.GetSize() / mSpacing;
}
$(public_api_base_src_dir)/controls/scrollable/item-view/navigation-layout.cpp \
$(public_api_base_src_dir)/controls/scrollable/item-view/roll-layout.cpp \
$(public_api_base_src_dir)/controls/scrollable/item-view/spiral-layout.cpp \
- $(public_api_base_src_dir)/controls/scrollable/item-view/album-layout.cpp \
$(public_api_base_src_dir)/controls/scrollable/scrollable.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-connector.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-component-impl.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp \
- $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp \
$(public_api_base_src_dir)/controls/table-view/table-view.cpp \
$(public_api_base_src_dir)/controls/text-input/text-input.cpp \
$(public_api_base_src_dir)/controls/scrollable/item-view/roll-layout.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/spiral-layout.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/navigation-layout.h \
- $(public_api_base_src_dir)/controls/scrollable/item-view/album-layout.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/grid-layout.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/item-factory.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/item-layout.h \
$(public_api_base_src_dir)/controls/scrollable/item-view/item-view.h \
- $(public_api_base_src_dir)/controls/scrollable/item-view/item-view-declarations.h
+ $(public_api_base_src_dir)/controls/scrollable/item-view/item-view-declarations.h
public_api_base_popup_header_files = \
$(public_api_base_src_dir)/controls/popup/popup.h
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-custom-effect.h \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.h \
$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h \
- $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.h \
- $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-twist-effect.h
+ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.h
public_api_base_table_view_header_files = \
$(public_api_base_src_dir)/controls/table-view/table-view.h
BouncingEffect BouncingEffect::New( const Vector4& color )
{
std::string fragmentShader = MAKE_STRING(
+ precision mediump float;\n
uniform float uProgressRate;\n
uniform vec4 uAssignedColor;\n
void main()\n
);
ShaderEffect shaderEffect;
- shaderEffect = ShaderEffect::New( "", fragmentShader, GeometryType( GEOMETRY_TYPE_IMAGE),
+ shaderEffect = ShaderEffect::New( "", fragmentShader,
+ GeometryType( GEOMETRY_TYPE_IMAGE),
ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
BouncingEffect handle( shaderEffect );
ImageRegionEffect ImageRegionEffect::New()
{
std::string vertexShader(
- "uniform vec2 uTopLeft;\n"
- "uniform vec2 uBottomRight;\n"
+ "uniform mediump vec2 uTopLeft;\n"
+ "uniform mediump vec2 uBottomRight;\n"
"void main()\n"
"{\n"
- " vec4 position = vec4(aPosition,1.0);\n"
+ " mediump vec4 position = vec4(aPosition,1.0);\n"
" gl_Position = uMvpMatrix * position;\n"
// The line below is doing the same as the following commented lines:
//" vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
} // namespace Toolkit
} // namespace Dali
-
INPUT = @DOXYGEN_DOCS_DIR@/content \
../../../../dali-toolkit/base/dali-toolkit/public-api \
../../../../dali-toolkit/optional/dali-toolkit/public-api \
+ ../../../automated-tests/README.md \
@prefix@/include/dali
# This tag can be used to specify the character encoding of the source files
*.php3 \
*.inc \
*.m \
+ *.md \
*.mm \
*.dox \
*.py \
* - \link texture-atlases Texture Atlases \endlink
* - \link Texture_Compression Compressing Textures \endlink
*
+ * \section Testing
+ * See [Automated Tests](@ref auto_testing) for instructions.
*/
/*! \page scene-graph
* return connection ;
* }
*
- * bool MyActor::DoActionCustom(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+ * bool MyActor::DoActionCustom(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
* {
* bool actioned = false ;
*
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
#include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
-#include <dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h>
mCurrentUniform( 0 ),
mDensity( 5 )
{
+ // Calculate how many BubbleEffect shaders are required
+ if( mTotalNumOfBubble>100 )
+ {
+ mNumBubblePerShader = 100;
+ mNumShader = mTotalNumOfBubble / 100;
+ }
+ else
+ {
+ mNumBubblePerShader = mTotalNumOfBubble;
+ mNumShader = 1;
+ }
}
BubbleEmitter::~BubbleEmitter()
// Generate the material object, which is used by all meshActors
GenMaterial();
- // Calculate how many BubbleEffect shaders are required
- if( mTotalNumOfBubble>100 )
- {
- mNumBubblePerShader = 100;
- mNumShader = mTotalNumOfBubble / 100;
- }
- else
- {
- mNumBubblePerShader = mTotalNumOfBubble;
- mNumShader = 1;
- }
-
mMesh.resize( mNumShader );
mMeshActor.resize( mNumShader );
mEffect.resize( mNumShader );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
-using namespace std;
using namespace Dali;
namespace // unnamed namespace
Property::Index depthProperty = child.GetPropertyIndex(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH);
if(depthProperty == Property::INVALID_INDEX)
{
- depthProperty = child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth);
+ child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth);
}
// not added prior
child.RemoveConstraints();
}
-bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
{
bool ret = false;
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
private: // From Control
const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE =
- "uniform vec2 uSampleOffsets[NUM_SAMPLES];\n"
- "uniform float uSampleWeights[NUM_SAMPLES];\n"
+ "uniform mediump vec2 uSampleOffsets[NUM_SAMPLES];\n"
+ "uniform mediump float uSampleWeights[NUM_SAMPLES];\n"
"void main()\n"
"{\n"
}
ImageView::ImageView()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) )
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mPropertyDetail( Property::INVALID_INDEX )
{
}
}
}
-void MaskedImageView::OnPan(Actor source, PanGesture gesture)
+void MaskedImageView::OnPan(Actor source, const PanGesture& gesture)
{
// Used to flag whether edit mode is setting properties
mSelfPropertySetting = true;
mSelfPropertySetting = false;
}
-void MaskedImageView::OnPinch(Actor actor, PinchGesture pinch)
+void MaskedImageView::OnPinch(Actor actor, const PinchGesture& pinch)
{
// Used to flag whether edit mode is setting properties
mSelfPropertySetting = true;
/**
* Helper for edit mode.
*/
- void OnPan( Actor source, PanGesture gesture );
+ void OnPan( Actor source, const PanGesture& gesture );
/**
* Helper for edit mode.
*/
- void OnPinch( Actor actor, PinchGesture pinch );
+ void OnPinch( Actor actor, const PinchGesture& pinch );
/**
* Construct a new MaskedImageView.
Magnifier::Magnifier()
: Control( REQUIRES_TOUCH_EVENTS ),
mPropertySourcePosition(Property::INVALID_INDEX),
+ mDefaultCameraDistance(1000.f),
mActorSize(Vector3::ZERO),
mMagnificationFactor(1.0f)
{
return mItemPoppedSignal;
}
-bool NavigationControl::DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool NavigationControl::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
{
bool ret = false;
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
public:
Page::Page()
: Control( CONTROL_BEHAVIOUR_NONE ),
mTitle(""),
- mSubTitle("")
+ mSubTitle(""),
+ mPropertyTitle(Property::INVALID_INDEX),
+ mPropertySubTitle(Property::INVALID_INDEX)
{
}
: Control( REQUIRES_TOUCH_EVENTS ),
mPageFactory( pageFactory ),
mPageSize( pageSize ),
+ mTotalPageCount( 0 ),
mIsEditMode( false ),
+ mNeedOffscreenRendering( false ),
mPanning( false ),
mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
mCurrentPageIndex( 0 ),
mIndex( 0 ),
mPress( false ),
mPageUpdated( true ),
+ mDistanceUpCorner( 0.f ),
+ mDistanceBottomCorner( 0.f ),
+ mPanDisplacement( 0.f ),
+ mConstraints( false ),
mPageTurnStartedSignal(),
mPageTurnFinishedSignal(),
mPagePanStartedSignal(),
RenderPage( mCurrentPageIndex );
}
-void PageTurnView::OnPan( PanGesture gesture )
+void PageTurnView::OnPan( const PanGesture& gesture )
{
if( mIsEditMode )
{
/**
* @copydoc Toolkit::Control::OnPan
*/
- virtual void OnPan( PanGesture gesture );
+ virtual void OnPan( const PanGesture& gesture );
/**
* @copydoc Toolkit::Control::OnInitialize
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/selectors/rotating-selector.h>
-using namespace std;
-
namespace
{
const float TOUCH_OPACITY_THRESHOLD = 0.1f;
: Control( REQUIRES_TOUCH_EVENTS ),
mSelected(false),
mSelectable(true),
+ mPressed(false),
mIsAnimating(false)
{
}
#include <sstream>
using namespace Dali;
-using namespace std;
namespace Dali
{
return true;
}
-void Slider::OnPan( Actor actor, PanGesture gesture )
+void Slider::OnPan( Actor actor, const PanGesture& gesture )
{
// gesture.position is in local actor coordinates
if( mState != DISABLED )
{
std::stringstream ss;
ss.precision( GetValuePrecision() );
- ss << fixed << clampledValue;
+ ss << std::fixed << clampledValue;
mHandleValueTextView.SetText( ss.str() );
}
}
{
std::stringstream ss;
ss.precision( GetValuePrecision() );
- ss << fixed << value;
+ ss << std::fixed << value;
mValueTextView.SetText( ss.str() );
TextStyle style;
style.SetTextColor( GetPopupTextColor() );
* @param[in] actor The actor the event is raised for
* @param[in] gesture The pan event info
*/
- void OnPan( Actor actor, PanGesture gestur );
+ void OnPan( Actor actor, const PanGesture& gesture );
/**
* Map a position onto a domain and return the result as a percentage
const char* BLUR_TWO_PASS_FRAGMENT_SOURCE =
{
+ "precision highp float;\n"
"uniform vec2 uSampleOffsets[NUM_SAMPLES];\n"
"uniform float uSampleWeights[NUM_SAMPLES];\n"
"void main()\n"
const char* EMBOSS_FRAGMENT_SOURCE1 =
{
+ "precision highp float;\n"
"uniform vec2 uTexScale;\n"
"\n"
"void main()\n"
const char* EMBOSS_FRAGMENT_SOURCE2 =
{
+ "precision highp float;\n"
"uniform vec2 uTexScale;\n"
"\n"
"void main()\n"
const char* const SPREAD_FRAGMENT_SOURCE =
{
+ "precision highp float;\n"
"uniform float uSpread;\n"
"uniform vec2 uTexScale;\n"
"void main()\n"
}//namespace
PageTurnEffect::PageTurnEffect()
+: mOriginalCenterPropertyIndex(Property::INVALID_INDEX),
+ mCurrentCenterPropertyIndex(Property::INVALID_INDEX)
{
}
* ([3][2]) float curveHeight: The height of the interpolated hermite curve.
* ([3][3]) float currentLength: The length from the current center to the curveEnd.
*/
+ precision mediump float;\n
uniform mat4 uCommonParameters;\n
\n
uniform vec2 uPageSize;\n
std::string vertexShaderEnd("}");
std::string fragmentShaderPartOne = MAKE_STRING(
+ precision mediump float;\n
uniform vec2 uPageSize;\n
uniform vec2 uSpineShadowParameter;\n
varying vec3 vNormal;\n
{
CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
-: CubeTransitionEffect( numRows, numColumns, viewAreaSize)
+: CubeTransitionEffect( numRows, numColumns, viewAreaSize),
+ mDisplacementRatio( 1.f )
{
}
static FullAreaImageCreator New()
{
std::string vertexShader(
- "uniform vec4 uRegion; \n"
+ "uniform mediump vec4 uRegion; \n"
"void main() \n"
"{\n"
" gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
);
std::string fragmentShader(
- "uniform vec4 uRegion; \n"
+ "uniform mediump vec4 uRegion; \n"
"void main() \n"
"{\n"
" if( vTexCoord.s > 0.0 && vTexCoord.s < 1.0 && vTexCoord.t > 0.0 && vTexCoord.t < 1.0) \n"
{
CubeTransitionWaveEffect::CubeTransitionWaveEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
-: CubeTransitionEffect( numRows, numColumns, viewAreaSize)
+: CubeTransitionEffect( numRows, numColumns, viewAreaSize),
+ mSaddleAA( 1.f ),
+ mSaddleBB( 1.f ),
+ mSaddleB( 1.f )
{
}
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace Dali
{
Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
if(propertyActorHittable == Property::INVALID_INDEX && hittable)
{
- propertyActorHittable = actor.RegisterProperty(ACTOR_HITTABLE, true);
+ actor.RegisterProperty(ACTOR_HITTABLE, true);
}
else
{
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 16;
+const unsigned int TOOLKIT_MICRO_VERSION = 17;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
"void main() \n"
"{ \n"
- " vec4 color = texture2D( sTexture, vTexCoord ); \n"
+ " mediump vec4 color = texture2D( sTexture, vTexCoord ); \n"
" if(color.a <= 0.0001) \n"
" { \n"
" discard; \n"
BlindEffect BlindEffect::New()
{
std::string fragmentShader(
- "uniform float uStep; \n"
+ "uniform mediump float uStep; \n"
"void main() \n"
"{ \n"
- " vec4 alphaColor; \n"
- " vec4 baseColor; \n"
+ " mediump vec4 alphaColor; \n"
+ " mediump vec4 baseColor; \n"
" baseColor = texture2D( sTexture, vTexCoord); \n"
" alphaColor = vec4(0.1,0.1,0.1,1.0); \n"
- " float index = 0.0; \n"
+ " lowp float index = 0.0; \n"
" index = floor(vTexCoord.y/0.1); \n"
" if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
" { \n"
std::ostringstream vertexShaderStringStream;
vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numberOfBubble << "\n";
std::string vertexShader(
+ " precision mediump float;\n"
// the gravity applied to the y direction
" uniform float uGravity; \n"
// Width of the texture in pixels
vertexShaderStringStream << vertexShader;
std::string fragmentShader(
+ " precision mediump float;\n"
" varying float vPercentage;\n"
" varying vec2 vEffectTexCoord;\n"
"\n"
" gl_FragColor = fragColor;\n"
" }\n");
- ShaderEffect shaderEffect = ShaderEffect::New( vertexShaderStringStream.str(), fragmentShader,
- GeometryType( GEOMETRY_TYPE_TEXTURED_MESH),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+ ShaderEffect shaderEffect = ShaderEffect::New(
+ vertexShaderStringStream.str(),
+ fragmentShader,
+ GeometryType( GEOMETRY_TYPE_TEXTURED_MESH),
+ ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+
BubbleEffect handle( shaderEffect );
handle.mNumberOfBubbles = numberOfBubble;
handle.SetMovementArea( Stage::GetCurrent().GetSize() );
-
handle.SetUniform( "uGravity", 50.f );
handle.SetUniform( "uMagnification", 1.f );
handle.SetUniform( "uDynamicScale", 1.f );
"\n"
"void main()\n"
"{\n"
- " vec4 world = uModelView * vec4(aPosition,1.0);\n"
- " vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
- " float a = length(d);\n"
- " float cs = cos(radians(a));\n"
+ " mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+ " mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
+ " mediump float a = length(d);\n"
+ " mediump float cs = cos(radians(a));\n"
" world.z -= cs * uRadius;\n"
" gl_Position = uProjection * world;\n"
" \n"
"void main()\n"
"{\n"
- " vec4 col = texture2D(sTexture, vTexCoord);\n"
+ " vec4 col = texture2D(sTexture, vTexCoord);\n"
// calc lighting
" float intensity = dot(uLightDirection, uFixedNormal);"
" vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
}
}
-
Dali::ShaderEffect shaderEffectCustom;
if( useHighPrecision )
{
- shaderEffectCustom = Dali::ShaderEffect::New( vertexShader, prefixHighPrecision + fragmentShader,
+ shaderEffectCustom = Dali::ShaderEffect::New( prefixHighPrecision+vertexShader, prefixHighPrecision + fragmentShader,
GeometryType( GEOMETRY_TYPE_IMAGE),
ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
}
else
{
- shaderEffectCustom = Dali::ShaderEffect::New( vertexShader, prefixMediumPrecision + fragmentShader,
+ shaderEffectCustom = Dali::ShaderEffect::New( prefixMediumPrecision+vertexShader, prefixMediumPrecision + fragmentShader,
GeometryType( GEOMETRY_TYPE_IMAGE),
ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
}
}
DissolveLocalEffect::DissolveLocalEffect()
+: mNumberOfDimples( 1 )
{
}
//Call the Parent copy constructor to add reference to the implementation for this object
DissolveLocalEffect::DissolveLocalEffect( ShaderEffect handle )
-: ShaderEffect( handle )
+: ShaderEffect( handle ),
+ mNumberOfDimples( 1 )
{
}
std::ostringstream vertexShaderStringStream;
vertexShaderStringStream << "#define NUMBER_OF_DIMPLE "<< numberOfDimples << "\n";
std::string vertexShader(
+ "precision highp float;\n"
"uniform vec2 uCenter[ NUMBER_OF_DIMPLE ];\n"
"uniform float uRadius[ NUMBER_OF_DIMPLE ]; \n"
"uniform float uPercentage[ NUMBER_OF_DIMPLE ]; \n"
"\n"
" else // (uDoShadow > 0.0)\n"
" {\n"
- " float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
+ " mediump float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
" mediump float inText = alphaFactor;\n"
" mediump float inShadow = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, shadowDistance);\n"
"\n"
// append the default version
std::string vertexShader(
"uniform mediump vec2 uCenter;\n"
- "varying vec2 vRelativePosition;\n"
+ "varying mediump vec2 vRelativePosition;\n"
"\n"
"void main()\n"
"{\n"
- " vec4 world = uModelView * vec4(aPosition,1.0);\n"
+ " mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
" gl_Position = uProjection * world;\n"
" \n"
" vTexCoord = aTexCoord;\n"
"}\n");
std::string fragmentShader(
- "uniform float uRadius; \n"
- "uniform float uBlendFactor; \n"
- "varying vec2 vRelativePosition; \n"
+ "uniform mediump float uRadius; \n"
+ "uniform mediump float uBlendFactor; \n"
+ "varying mediump vec2 vRelativePosition; \n"
"void main() \n"
"{ \n"
- " float delta = (length(vRelativePosition) - uRadius); \n"
+ " mediump float delta = (length(vRelativePosition) - uRadius); \n"
" delta = clamp(0.0 - delta * uBlendFactor, 0.0, 1.0); \n"
" gl_FragColor = texture2D(sTexture, vTexCoord) * uColor; \n"
" gl_FragColor.a *= delta; \n"
}
}
-
MirrorEffect MirrorEffect::New()
{
- std::string vertextShader(
- "precision mediump float; \n"
+ std::string vertexShader(
"void main() \n"
"{ \n"
- " vec3 pos = aPosition; \n"
+ " mediump vec3 pos = aPosition; \n"
" pos.y = pos.y * 3.0; \n"
- " vec4 world = uModelView * vec4(pos,1.0); \n"
+ " mediump vec4 world = uModelView * vec4(pos,1.0); \n"
" gl_Position = uProjection * world; \n"
" vTexCoord = aTexCoord; \n"
"} \n" );
std::string fragmentShader(
- "uniform float uDepth; \n"
- "uniform float uAlpha; \n"
+ "uniform mediump float uDepth; \n"
+ "uniform mediump float uAlpha; \n"
"void main() \n"
"{ \n"
" if(vTexCoord.y < 1.0 / 3.0) \n"
" } \n"
" else \n"
" { \n"
- " float darkness = 3.0 - vTexCoord.y * 3.0; \n"
+ " highp float darkness = 3.0 - vTexCoord.y * 3.0; \n"
" darkness = (1.0 - 1.0 / uDepth + darkness * 1.0/ uDepth) * 0.65; \n"
- " vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor; \n"
+ " highp vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor; \n"
" color.a *= uAlpha; \n"
" gl_FragColor = color * vec4(darkness, darkness, darkness, darkness); \n"
" } \n"
// Create the implementation, temporarily owned on stack,
Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New(
- vertextShader,
+ vertexShader,
fragmentShader,
GeometryType( GEOMETRY_TYPE_IMAGE ),
ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
// varying vec2 vTexCoord;
std::string vertexSource;
vertexSource =
+ "precision mediump float;\n"
"uniform mat4 uModelLastFrame;\n"
"uniform float uTimeDelta;\n"
std::string fragmentSource;
fragmentSource =
"precision mediump float;\n"
-
"uniform vec2 uObjectFadeStart;\n"
"uniform vec2 uObjectFadeEnd;\n"
"uniform float uAlphaScale;\n"
"}\n";
// NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
- ShaderEffect shader = ShaderEffect::New( vertexSource,
- fragmentSource,
+ ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource,
GEOMETRY_TYPE_IMAGE,
ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) );
}
}
-
// varying vec2 vTexCoord;
std::string vertexSource;
vertexSource =
+ "precision mediump float;\n"
"uniform mat4 uModelLastFrame;\n"
"uniform float uTimeDelta;\n"
"}";
// NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
- ShaderEffect shader = ShaderEffect::New( vertexSource,
- fragmentSource,
- GeometryType( GEOMETRY_TYPE_IMAGE ),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
+ ShaderEffect shader = ShaderEffect::New(
+ vertexSource, fragmentSource, GeometryType( GEOMETRY_TYPE_IMAGE ),
+ ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
}
}
-
static void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder )
{
const char* ALPHA_MASK_VERTEX_SHADER_SOURCE =
+ "precision mediump float;\n"
"uniform vec2 uImageSize; \n"
"uniform vec2 uMaskSize; \n"
"varying vec2 vMaskTexCoord; \n"
"} \n";
const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
- "varying vec2 vMaskTexCoord; \n"
+ "varying mediump vec2 vMaskTexCoord; \n"
" \n"
"void main() \n"
"{ \n"
" gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
"} \n";
- ShaderEffect maskEffect = ShaderEffect::New( ALPHA_MASK_VERTEX_SHADER_SOURCE,
- ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
- GeometryType( GEOMETRY_TYPE_IMAGE ),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+ ShaderEffect maskEffect = ShaderEffect::New(
+ ALPHA_MASK_VERTEX_SHADER_SOURCE,
+ ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
+ GeometryType( GEOMETRY_TYPE_IMAGE ),
+ ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
maskEffect.SetEffectImage( Image::New( maskImage ) );
PageTurnBookSpineEffect PageTurnBookSpineEffect::New()
{
std::string vertexSource(
+ "precision mediump float;\n"
"uniform float uShadowWidth;\n"
" void main()\n"
" {\n"
// the simplified version of the fragment shader of page turn effect
std::string fragmentSource(
+ "precision mediump float;\n"
"uniform float uIsBackImageVisible;\n"
"uniform float uPageWidth;\n"
"uniform vec2 uSpineShadowParameter;\n"
" }" );
ShaderEffect shader;
- shader = ShaderEffect::New( vertexSource,fragmentSource );
+ shader = ShaderEffect::New( vertexSource, fragmentSource );
PageTurnBookSpineEffect handle( shader );
handle.SetUniform( IS_BACK_IMAGE_VISIBLE_PROPERTY_NAME, -1.f );
handle.SetUniform( SHADOW_WIDTH_PROPERTY_NAME, DEFAULT_SHADOW_WIDTH );
{
// append the default version
std::string fragmentShader(
+ "precision mediump float;\n"
"uniform float uAmplitude;\n"
"uniform float uTime;\n"
"void main()\n"
// Create the implementation, temporarily owned on stack
Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New(
- "",
- fragmentShader,
- Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
+ "", fragmentShader,
+ Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
+ ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
/* Pass ownership to Ripple2DEffect through overloaded constructor, So that it now has access to the
Dali::ShaderEffect implementation */
"\n"
"void main()\n"
"{\n"
- " vec4 world = vec4(aPosition, 1.0);\n"
+ " mediump vec4 world = vec4(aPosition, 1.0);\n"
" \n"
- " vec2 d = vec2(world.xy - uCenter);\n"
- " float dist = length(d);\n"
+ " mediump vec2 d = vec2(world.xy - uCenter);\n"
+ " mediump float dist = length(d);\n"
" \n"
- " float range = (uRadius - dist) / (uRadius);\n"
+ " mediump float range = (uRadius - dist) / (uRadius);\n"
" vRange = max(0.1, range);\n"
" \n"
" gl_Position = uMvpMatrix * world;\n"
{
// variable "uStep" range scope : [0.0, 1.0]
std::string fragmentShader(
- "uniform vec2 texSize; \n"
- "uniform float uStep; \n"
- "uniform float uRows; \n"
- "uniform float uColumns; \n"
- "void main() \n"
- "{ \n"
- " vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns); \n"
- " vec2 intXY = vec2(vTexCoord.x * texSize.x, vTexCoord.y * texSize.y); \n"
- " vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
- " vec2 UVMosaic = vec2(XYMosaic.x /texSize.x, XYMosaic.y / texSize.y); \n"
- " vec4 noiseVec = texture2D(sEffect, UVMosaic); \n"
- " float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0; \n"
+ "uniform mediump vec2 texSize;\n"
+ "uniform mediump float uStep;\n"
+ "uniform mediump float uRows;\n"
+ "uniform mediump float uColumns;\n"
+ "void main()\n"
+ "{\n"
+ " mediump vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns); \n"
+ " mediump vec2 intXY = vec2(vTexCoord.x * texSize.x, vTexCoord.y * texSize.y); \n"
+ " mediump vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
+ " mediump vec2 UVMosaic = vec2(XYMosaic.x /texSize.x, XYMosaic.y / texSize.y); \n"
+ " mediump vec4 noiseVec = texture2D(sEffect, UVMosaic); \n"
+ " mediump float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0; \n"
" if(intensity < uStep) \n"
" gl_FragColor = vec4(0.1, 0.1, 0.1, 1.0); \n"
" else \n"
{
// append the default version
std::string fragmentShader(
- "uniform vec2 uTextureSize;\n"
- "uniform float uRadius;\n"
- "uniform float uAngle;\n"
- "uniform vec2 uCenter;\n"
+ "uniform mediump vec2 uTextureSize;\n"
+ "uniform highp float uRadius;\n"
+ "uniform highp float uAngle;\n"
+ "uniform mediump vec2 uCenter;\n"
"void main()\n"
"{\n"
- " vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
+ " highp vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
" textureCenter = vTexCoord.st - textureCenter;\n"
- " float distance = length(textureCenter);\n"
+ " highp float distance = length(textureCenter);\n"
" if (distance >= uRadius)\n"
" discard;\n"
- " float percent = (uRadius - distance) / uRadius;\n"
- " float theta = percent * percent * uAngle * 4.0;\n"
- " float sinTheta = sin(theta);\n"
- " float cosTheta = cos(theta);\n" );
+ " highp float percent = (uRadius - distance) / uRadius;\n"
+ " highp float theta = percent * percent * uAngle * 4.0;\n"
+ " highp float sinTheta = sin(theta);\n"
+ " highp float cosTheta = cos(theta);\n" );
// if warp, loose the sign from sin
if( warp )
{
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.0.16
+Version: 1.0.17
Release: 1
Group: System/Libraries
License: Apache-2.0