'<(DALI_JS_DIR)/controls/control-wrapper.cpp',
'<(DALI_JS_DIR)/controls/item-factory-wrapper.cpp',
'<(DALI_JS_DIR)/controls/item-view-api.cpp',
+ '<(DALI_JS_DIR)/controls/scroll-view-api.cpp',
'<(DALI_JS_DIR)/animation/animation-api.cpp',
'<(DALI_JS_DIR)/animation/animation-wrapper.cpp',
'<(DALI_JS_DIR)/animation/constrainer-api.cpp',
${PLUGING_SRC_DIR}/controls/control-wrapper.cpp
${PLUGING_SRC_DIR}/controls/item-factory-wrapper.cpp
${PLUGING_SRC_DIR}/controls/item-view-api.cpp
+ ${PLUGING_SRC_DIR}/controls/scroll-view-api.cpp
${PLUGING_SRC_DIR}/constants/constants-wrapper.cpp
${PLUGING_SRC_DIR}/animation/animation-api.cpp
${PLUGING_SRC_DIR}/animation/animation-wrapper.cpp
--- /dev/null
+ var window= {
+ x:0,
+ y:0,
+ width:1920,
+ height:1080,
+ transparent: false,
+ name:'scrollview-example'
+ };
+
+ var viewMode={
+ 'stereoscopic-mode':'mono', // stereo-horizontal, stereo-vertical, stereo-interlaced,
+ 'stereoBase': 65 // Distance in millimeters between left/right cameras typically between (50-70mm)
+ };
+
+ var options= {
+ 'window': window,
+ 'viewMode': viewMode,
+ }
+
+//desktop
+//var dali = require('../build/Release/dali')( options );
+
+//target
+var dali = require('dali')( options );
+
+var stageSize;
+var scrollView;
+var scrollBar;
+
+var imageDir = "./images/";
+
+var daliApp = {};
+
+daliApp.createScrollView = function() {
+
+ // Create a scroll view
+ scrollView = new dali.Control("ScrollView");
+ stageSize = dali.stage.getSize();
+ scrollView.size = [stageSize.x, stageSize.y, 0.0];
+ scrollView.parentOrigin = dali.CENTER;
+ scrollView.anchorPoint = dali.CENTER;
+
+ dali.stage.add( scrollView );
+
+ // Add actors to a scroll view with 4 pages
+ var pageRows = 1;
+ var pageColumns = 3;
+ for(var pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(var pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+ {
+ var pageActor = new dali.Control();
+ pageActor.widthResizePolicy = "FILL_TO_PARENT";
+ pageActor.heightResizePolicy = "FILL_TO_PARENT";
+ pageActor.parentOrigin = dali.CENTER;
+ pageActor.anchorPoint = dali.CENTER;
+ pageActor.position = [pageColumn * stageSize.x, pageRow * stageSize.y, 0.0];
+ pageActor.name = "pageActor" + pageColumn;
+
+ // Add images in a 5x4 grid layout for each page
+ var imageRows = 4;
+ var imageColumns = 5;
+ var margin = 10.0;
+ var imageSize = [(stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0];
+
+ for(var row = 0; row < imageRows; row++)
+ {
+ for(var column = 0; column < imageColumns;column++)
+ {
+ var imageView = new dali.Control("ImageView");
+ var imageId = (row * imageColumns + column) % 2 + 1;
+ imageView.image = imageDir + "image-" + imageId + ".jpg";
+ imageView.parentOrigin = dali.CENTER;
+ imageView.anchorPoint = dali.CENTER;
+ imageView.size = imageSize;
+ imageView.position = [ margin * 0.5 + (imageSize[0] + margin) * column - stageSize.x * 0.5 + imageSize[0] * 0.5,
+ margin * 0.5 + (imageSize[1] + margin) * row - stageSize.y * 0.5 + imageSize[1] * 0.5,
+ 0.0 ];
+ pageActor.add(imageView);
+ var position = imageView.position;
+ }
+ }
+
+ scrollView.add( pageActor );
+ }
+ }
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ var scrollMode = {
+ xAxisScrollEnabled : true,
+ xAxisSnapToInterval : stageSize.x, // Define the snap points
+ xAxisScrollBoundary : stageSize.x * pageColumns, // i.e. Define 3 pages
+ yAxisScrollEnabled : false
+ }
+
+ scrollView.setScrollMode(scrollMode);
+
+ // Create a horizontal scroll bar in the bottom of scroll view (optional)
+ scrollBar = new dali.Control("ScrollBar");
+ scrollBar.parentOrigin = dali.BOTTOM_LEFT;
+ scrollBar.anchorPoint = dali.TOP_LEFT;
+ scrollBar.widthResizePolicy = "FIT_TO_CHILDREN";
+ scrollBar.heightResizePolicy = "FILL_TO_PARENT";
+ scrollBar.orientation = [0, 0, 270];
+ scrollBar.scrollDirection = "Horizontal";
+ scrollView.add(scrollBar);
+
+ // Connect to the onRelayout signal
+ scrollView.on("onRelayout", daliApp.onScrollViewRelayout);
+}
+
+daliApp.onScrollViewRelayout = function( button ) {
+
+ // Set the correct scroll bar size after size negotiation of scroll view is done
+ scrollBar.size = [0.0, scrollView.getRelayoutSize(dali.DIMENSION_WIDTH), 0.0 ];
+}
+
+function startup()
+{
+ daliApp.init();
+}
+
+daliApp.init = function()
+{
+ daliApp.createScrollView();
+}
+
+startup();
+
var anim = new dali.Animation(1); // default duration is increased if length of all animations is greater than it.
var animOptions = {
- alpha: "linear",
+ alpha: dali.ALPHA_FUNCTION_LINEAR,
delay: 0.5, // used to delay the start of the animation
duration: 3, // duration of the animation
};
// rotate back to correct orientation
var endRotation = new dali.Rotation(0,0,0);
- animOptions.alpha = "easeInOutSine";
+ animOptions.alpha = dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE;
anim.animateTo(myActor1, "orientation", endRotation, animOptions);
// Delay the myActor2 by a second
animOptions.delay = 0.0;
- animOptions.alpha = "linear";
+ animOptions.alpha = dali.ALPHA_FUNCTION_LINEAR;
anim.animateTo(myActor2, "positionZ", 0, animOptions);
// rotate back to correct orientation
- animOptions.alpha = "easeInOutSine";
+ animOptions.alpha = dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE;
anim.animateTo(myActor2, "orientation", endRotation, animOptions);
return anim;
var shaderAnim = new dali.Animation(duration+delay);
var animOptions = {
- alpha: "doubleEaseInOutSine60",
+ alpha: dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE,
delay: delay,
duration: duration,
};
// also rotate the imageView 90 degrees at the same time.
var rotation = new dali.Rotation(90,0,0,1);
-shaderAnim.animateTo(imageView, "orientation", rotation, { alpha:"linear", duration:duration, delay:delay });
+shaderAnim.animateTo(imageView, "orientation", rotation, { alpha:dali.ALPHA_FUNCTION_LINEAR, duration:duration, delay:delay });
shaderAnim.play();
### Animation alpha functions
-| Name | Description |
-|--------------------|--------------|
-|default |Linear |
-|linear |Linear |
-|square |Square (x^2) |
-|reverse |Reverse linear |
-|easeIn |Speeds up and comes to a sudden stop |
-|easeOut |Sudden start and slows to a gradual stop|
-|easeInOut |Speeds up and slows to a gradual stop|
-|easeInSine |Speeds up and comes to a sudden stop|
-|easeOutSine |Sudden start and slows to a gradual stop|
-|easeInOutSine |Speeds up and slows to a gradual stop |
-|easeInSine33 |Speeds up and comes to a sudden stop |
-|easeOutSine33 |Sudden start and slows to a gradual stop |
-|easeInOutSine33 |Speeds up and slows to a gradual stop |
-|easeInOutSine50 |Speeds up and slows to a gradual stop |
-|easeInOutSine60 |Speeds up and slows to a gradual stop |
-|easeInOutSine70 |Speeds up and slows to a gradual stop |
-|easeInOutSine80 |Speeds up and slows to a gradual stop |
-|easeInOutSine90 |Speeds up and slows to a gradual stop |
-|doubleEaseInOutSine6|Speeds up and slows to a gradual stop, then speeds up again and slows to a gradual stop |
-|easeOutQuint50 |Sudden start and slows to a gradual stop |
-|easeOutQuint80 |Sudden start and slows to a gradual stop |
-|bounce |Sudden start, loses momentum and ** Returns to start position ** |
-|bounceBack |Sudden start, loses momentum and returns to exceed start position ** Returns to start position ** |
-|easeInBack |Slow start, exceed start position and quickly reach destination |
-|easeOutBack |Sudden start, exceed end position and return to a gradual stop|
-|easeInOutBack |Slow start, exceed start position, fast middle, exceed end position and return to a gradual stop|
-|sin |full 360 revolution ** Returns to start position ** |
-|sin2x |full 720 revolution ** Returns to start position ** |
+| Name | Description |
+|----------------------------------|----------------|
+|ALPHA_FUNCTION_DEFAULT |Linear |
+|ALPHA_FUNCTION_LINEAR |Linear |
+|ALPHA_FUNCTION_REVERSE |Reverse linear |
+|ALPHA_FUNCTION_EASE_IN_SQUARE |Speeds up and comes to a sudden stop (Square) |
+|ALPHA_FUNCTION_EASE_OUT_SQUARE |Sudden start and slows to a gradual stop (Square) |
+|ALPHA_FUNCTION_EASE_IN |Speeds up and comes to a sudden stop |
+|ALPHA_FUNCTION_EASE_OUT |Sudden start and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_OUT |Speeds up and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_SINE |Speeds up and comes to a sudden stop|
+|ALPHA_FUNCTION_EASE_OUT_SINE |Sudden start and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_OUT_SINE |Speeds up and slows to a gradual stop |
+|ALPHA_FUNCTION_BOUNCE |Sudden start, loses momentum and ** Returns to start position ** |
+|ALPHA_FUNCTION_SIN |full 360 revolution ** Returns to start position ** |
+|ALPHA_FUNCTION_EASE_OUT_BACK |Sudden start, exceed end position and return to a gradual stop|
|PROPERTY_READ_WRITE | integer value |
|PROPERTY_ANIMATABLE | integer value |
+|**Layout dimensions ** | |
+|DIMENSION_WIDTH | integer value |
+|DIMENSION_HEIGHT | integer value |
+
|**Item layout type ** | |
|ITEM_LAYOUT_LIST | integer value |
|ITEM_LAYOUT_GRID | integer value |
+|**Scroll direction bias ** | |
+|DIRECTION_BIAS_NONE | integer value |
+|DIRECTION_BIAS_LEFT | integer value |
+|DIRECTION_BIAS_RIGHT | integer value |
+
+|**Animation alpha function ** | |
+|ALPHA_FUNCTION_DEFAULT | integer value |
+|ALPHA_FUNCTION_LINEAR | integer value |
+|ALPHA_FUNCTION_REVERSE | integer value |
+|ALPHA_FUNCTION_EASE_IN_SQUARE | integer value |
+|ALPHA_FUNCTION_EASE_OUT_SQUARE | integer value |
+|ALPHA_FUNCTION_EASE_IN | integer value |
+|ALPHA_FUNCTION_EASE_OUT | integer value |
+|ALPHA_FUNCTION_EASE_IN_OUT | integer value |
+|ALPHA_FUNCTION_EASE_IN_SINE | integer value |
+|ALPHA_FUNCTION_EASE_OUT_SINE | integer value |
+|ALPHA_FUNCTION_EASE_IN_OUT_SINE | integer value |
+|ALPHA_FUNCTION_BOUNCE | integer value |
+|ALPHA_FUNCTION_SIN | integer value |
+|ALPHA_FUNCTION_EASE_OUT_BACK | integer value |
+
* @class Constants
*/
* "title_text" : "Item 1" }
* ];
*
- * itemFactory.data = itemViewData; // ItemFactory will look for the template from this JSON file
+ * itemFactory.data = itemViewData; // ItemFactory will create items from this data
*
* @type Array
* @property data
dali.stage.add( imageView );
var animation = new dali.Animation(2.0);
- var animOptions = { alpha:"easeInOutSine", delay:0.5, duration:1.5 };
+ var animOptions = { alpha:dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE, delay:0.5, duration:1.5 };
var forward = new dali.Vector3(1,0,0);
animation.animate( imageView, myPath, forward, animOptions );
--- /dev/null
+/**
+ *
+## ScrollView API
+
+ScrollView is a container where the actors inside it can be scrolled manually
+(via touch or pan gesture) or automatically.
+
+By default, ScrollView can scroll to any position both horizontally and
+vertically and no snapping is enabled.
+
+Scroll mode can be specified to define how ScrollView should handle scrolling
+in X and Y axes respectively (i.e. whether scrolling is enabled horizontally
+or vertically, how scrolling is snapped, and the boundary to prevent ScrollView
+to scroll beyond a certain position in the axes).
+
+![ ](../assets/img/scroll-view/scroll-view.png)
+
+### Example of creating a ScrollView
+
+```
+ // Create a scroll view
+ var scrollView = new dali.Control("ScrollView");
+ var stageSize = dali.stage.getSize();
+ scrollView.size = [stageSize.x, stageSize.y, 0.0];
+ scrollView.parentOrigin = dali.CENTER;
+ scrollView.anchorPoint = dali.CENTER;
+
+ dali.stage.add( scrollView );
+
+ // Add actors to a scroll view with 3 pages
+ var pageRows = 1;
+ var pageColumns = 3;
+ for(var pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(var pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+ {
+ var pageActor = new dali.Control();
+ pageActor.widthResizePolicy = "FILL_TO_PARENT";
+ pageActor.heightResizePolicy = "FILL_TO_PARENT";
+ pageActor.parentOrigin = dali.CENTER;
+ pageActor.anchorPoint = dali.CENTER;
+ pageActor.position = [pageColumn * stageSize.x, pageRow * stageSize.y, 0.0];
+ pageActor.name = "pageActor" + pageColumn;
+
+ // Add images in a 3x4 grid layout for each page
+ var imageRows = 4;
+ var imageColumns = 3;
+ var margin = 10.0;
+ var imageSize = [(stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0];
+
+ for(var row = 0; row < imageRows; row++)
+ {
+ for(var column = 0; column < imageColumns;column++)
+ {
+ var imageView = new dali.Control("ImageView");
+ var imageId = row * imageColumns + column;
+ imageView.image = "./image-" + imageId + ".jpg";
+ imageView.parentOrigin = dali.CENTER;
+ imageView.anchorPoint = dali.CENTER;
+ imageView.size = imageSize;
+ imageView.position = [ margin * 0.5 + (imageSize[0] + margin) * column - stageSize.x * 0.5 + imageSize[0] * 0.5,
+ margin * 0.5 + (imageSize[1] + margin) * row - stageSize.y * 0.5 + imageSize[1] * 0.5,
+ 0.0 ];
+ pageActor.add(imageView);
+ var position = imageView.position;
+ }
+ }
+
+ scrollView.add( pageActor );
+ }
+ }
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ var scrollMode = {
+ xAxisScrollEnabled : true,
+ xAxisSnapToInterval : stageSize.x, // Define the snap points
+ xAxisScrollBoundary : stageSize.x * pageColumns, // i.e. Define 3 pages
+ yAxisScrollEnabled : false
+ }
+
+ scrollView.setScrollMode(scrollMode);
+
+```
+
+ @class ScrollView
+ @extends Actor
+
+*/
$(v8_plugin_dir)/controls/control-wrapper.cpp \
$(v8_plugin_dir)/controls/item-factory-wrapper.cpp \
$(v8_plugin_dir)/controls/item-view-api.cpp \
+ $(v8_plugin_dir)/controls/scroll-view-api.cpp \
$(v8_plugin_dir)/constants/constants-wrapper.cpp \
$(v8_plugin_dir)/animation/animation-api.cpp \
$(v8_plugin_dir)/animation/animation-wrapper.cpp \
}
/**
+ * Return the value of negotiated dimension for the given dimension
+ *
+ * @for Actor
+ * @method getRelayoutSize
+ * @param {Integer} dimension The dimension of layout to retrieve (either dali.DIMENSION_WIDTH or dali.DIMENSION_HEIGHT)
+ * @return {Number} The value of the negotiated dimension
+ */
+void ActorApi::GetRelayoutSize( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+ Actor actor = GetActor( isolate, args );
+
+ bool found;
+ int dimension = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "missing dimension parameter");
+ return;
+ }
+
+ args.GetReturnValue().Set( v8::Number::New( isolate, actor.GetRelayoutSize( static_cast<Dimension::Type>(dimension) ) ) );
+}
+
+/**
* Calculate the width of the actor given a height
*
* The natural size is used for default calculation.
void SetKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
void IsKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
void GetNaturalSize( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void GetRelayoutSize( const v8::FunctionCallbackInfo< v8::Value >& args );
void GetWidthForHeight( const v8::FunctionCallbackInfo<v8::Value>& args );
void GetHeightForWidth( const v8::FunctionCallbackInfo<v8::Value>& args );
void TranslateBy( const v8::FunctionCallbackInfo< v8::Value >& args );
// ignore. SetSize() use Actor.size
// ignore. GetCurrentSize() use Actor.size
{ "GetNaturalSize", ActorApi::GetNaturalSize, ACTOR_API },
+ { "GetRelayoutSize", ActorApi::GetRelayoutSize, ACTOR_API },
{ "GetWidthForHeight",ActorApi::GetWidthForHeight, ACTOR_API },
{ "GetHeightForWidth",ActorApi::GetHeightForWidth, ACTOR_API },
// ignore. SetPosition(....) use Actor.position
#include "path-wrapper.h"
// EXTERNAL INCLUDES
-#include <cstring> // for strcmp
#include <dali/integration-api/debug.h>
namespace // un named namespace
{
-// @todo think about alternative ways of passing around
-struct AlphaFuncStruct
-{
- const char* const name;
- AlphaFunction alphaFunc;
-};
-/**
- * Contains a list of alpha functions that can be used.
- */
-const AlphaFuncStruct AlphaFunctionTable[]=
-{
-
- {"default" , AlphaFunction::DEFAULT },
- {"linear" , AlphaFunction::LINEAR },
- {"reverse" , AlphaFunction::REVERSE },
-
- {"easeInSquare" , AlphaFunction::EASE_IN_SQUARE },
- {"easeOutSquare" , AlphaFunction::EASE_OUT_SQUARE },
-
- {"easeIn" , AlphaFunction::EASE_IN },
- {"easeOut" , AlphaFunction::EASE_OUT },
- {"easeInOut" , AlphaFunction::EASE_IN_OUT },
-
- {"easeInSine" , AlphaFunction::EASE_IN_SINE },
- {"easeOutSine" , AlphaFunction::EASE_OUT_SINE },
- {"easeInOutSine" , AlphaFunction::EASE_IN_OUT_SINE },
-
- {"bounce" , AlphaFunction::BOUNCE },
- {"sin" , AlphaFunction::SIN },
- {"easeOutBack" , AlphaFunction::EASE_OUT_BACK },
-
-};
-const unsigned int AlphaFunctionTableCount = sizeof(AlphaFunctionTable)/sizeof(AlphaFunctionTable[0]);
-const char* const DEFAULT_ALPHA_NAME = "default";
-static AlphaFunction DEFAULT_ALPHA_FUNCTION = AlphaFunction::DEFAULT;
-
-
-
-AlphaFunction GetAlphaFunction( const std::string& alphaFuncName )
-{
- // This will normally get called just a few times during the application, so no point in doing anything clever
- for( unsigned int i = 0; i < AlphaFunctionTableCount; i++)
- {
- const AlphaFuncStruct& alphaStruct( AlphaFunctionTable[i] );
-
- if( std::strcmp( alphaStruct.name , alphaFuncName.c_str() ) == 0 )
- {
- return alphaStruct.alphaFunc;
- }
- }
-
- DALI_LOG_ERROR("Failed to find alpha func |%s| \n", alphaFuncName.c_str() );
- return DEFAULT_ALPHA_FUNCTION;
-}
-
-const char* const GetAlphaFunctionName( AlphaFunction alphaFunc )
-{
- // This may get called 3 times during the application, so no point
- // in doing anything clever
-
- for( unsigned int i = 0; i < AlphaFunctionTableCount; i++)
- {
- const AlphaFuncStruct& alphaStruct( AlphaFunctionTable[i] );
-
-
- if( alphaStruct.alphaFunc.GetBuiltinFunction() == alphaFunc.GetBuiltinFunction() )
- {
- return alphaStruct.name;
- }
- }
- return "default";
-}
-
-
struct AnimationParameters
{
AnimationParameters( const Animation& anim)
: propertyIndex( Property::INVALID_INDEX ),
- alphaFunction( DEFAULT_ALPHA_FUNCTION),
+ alphaFunction( AlphaFunction::DEFAULT),
delay( 0.f ),
duration(anim.GetDuration()),
optionsFound( false )
{
v8::Local<v8::Object> obj = options->ToObject();
v8::Local<v8::Value> alphaValue = obj->Get( v8::String::NewFromUtf8( isolate, "alpha" ) );
- if( alphaValue->IsString() )
+ if( alphaValue->IsUint32() )
{
animParams.optionsFound = true;
- std::string alphaName = V8Utils::v8StringToStdString( alphaValue );
- animParams.alphaFunction = GetAlphaFunction( alphaName );
+ animParams.alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alphaValue->ToUint32()->Value());
}
v8::Local<v8::Value> delayValue = obj->Get( v8::String::NewFromUtf8( isolate, "delay" ) );
// get keyframe.alpha
v8::Handle<v8::Value> alphaValue = keyFrameObject->Get(v8::String::NewFromUtf8( isolate, "alpha"));
- if( alphaValue->IsString() )
+ if( alphaValue->IsUint32() )
{
- std::string alphaName = V8Utils::v8StringToStdString( alphaValue );
- AlphaFunction alphaFunction = GetAlphaFunction( alphaName );
+ AlphaFunction alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alphaValue->ToUint32()->Value());
keyframes.Add( progress->NumberValue(), value, alphaFunction );
}
else
* Set the default alpha function for an animation.
* @method setDefaultAlphaFunction
* @for Animation
- * @param {string} alpha function
+ * @param {Integer} alpha function
*/
void AnimationApi::SetDefaultAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args )
{
Animation anim = GetAnimation( isolate, args );
bool found( false );
- std::string alphaFunc = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
+ int alphaFunc = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
if( !found )
{
DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
}
else
{
- AlphaFunction func = GetAlphaFunction( alphaFunc );
+ AlphaFunction func = static_cast<AlphaFunction::BuiltinFunction>(alphaFunc);
anim.SetDefaultAlphaFunction( func );
}
-
}
/**
* Get the default alpha function for an animation.
* @method getDefaultAlphaFunction
* @for Animation
- * @return {string} alpha function
+ * @return {Integer} alpha function
*/
void AnimationApi::GetDefaultAlphaFunction( const v8::FunctionCallbackInfo<v8::Value>& args )
{
Animation anim = GetAnimation( isolate, args );
- std::string alphaName = GetAlphaFunctionName( anim.GetDefaultAlphaFunction() );
+ AlphaFunction alphaFunc = anim.GetDefaultAlphaFunction();
- args.GetReturnValue().Set( v8::String::NewFromUtf8( isolate, alphaName.c_str() ) );
+ args.GetReturnValue().Set( v8::Integer::New( isolate, alphaFunc.GetBuiltinFunction() ) );
}
/**
targetPropertyIndex = targetActor.GetPropertyIndex( propertyName );
if( targetPropertyIndex == Property::INVALID_INDEX )
{
- targetPropertyIndex = targetActor.GetPropertyIndex( propertyName );
-
- if( targetPropertyIndex == Property::INVALID_INDEX )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Target property not found" );
- return false;
- }
+ DALI_SCRIPT_EXCEPTION( isolate, "Target property not found" );
+ return false;
}
}
else
sourcePropertyIndex = targetActor.GetPropertyIndex( propertyName );
if( sourcePropertyIndex == Property::INVALID_INDEX )
{
- sourcePropertyIndex = targetActor.GetPropertyIndex( propertyName );
-
- if( sourcePropertyIndex == Property::INVALID_INDEX )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Source property not found" );
- return false;
+ DALI_SCRIPT_EXCEPTION( isolate, "Source property not found" );
+ return false;
}
- }
}
else
{
#include <dali/devel-api/rendering/material.h>
#include <dali/devel-api/rendering/geometry.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
namespace Dali
{
{ "PROPERTY_READ_WRITE", Property::READ_WRITE },
{ "PROPERTY_ANIMATABLE", Property::ANIMATABLE },
+ { "DIMENSION_WIDTH", Dimension::WIDTH },
+ { "DIMENSION_HEIGHT", Dimension::HEIGHT },
+
{ "ITEM_LAYOUT_LIST", Toolkit::DefaultItemLayout::LIST },
{ "ITEM_LAYOUT_GRID", Toolkit::DefaultItemLayout::GRID },
+ { "DIRECTION_BIAS_NONE", Toolkit::DirectionBiasNone },
+ { "DIRECTION_BIAS_LEFT", Toolkit::DirectionBiasLeft },
+ { "DIRECTION_BIAS_RIGHT", Toolkit::DirectionBiasRight },
+
+ { "ALPHA_FUNCTION_DEFAULT", AlphaFunction::DEFAULT },
+ { "ALPHA_FUNCTION_LINEAR", AlphaFunction::LINEAR },
+ { "ALPHA_FUNCTION_REVERSE", AlphaFunction::REVERSE },
+ { "ALPHA_FUNCTION_EASE_IN_SQUARE", AlphaFunction::EASE_IN_SQUARE },
+ { "ALPHA_FUNCTION_EASE_OUT_SQUARE", AlphaFunction::EASE_OUT_SQUARE },
+ { "ALPHA_FUNCTION_EASE_IN", AlphaFunction::EASE_IN },
+ { "ALPHA_FUNCTION_EASE_OUT", AlphaFunction::EASE_OUT },
+ { "ALPHA_FUNCTION_EASE_IN_OUT", AlphaFunction::EASE_IN_OUT },
+ { "ALPHA_FUNCTION_EASE_IN_SINE", AlphaFunction::EASE_IN_SINE },
+ { "ALPHA_FUNCTION_EASE_OUT_SINE", AlphaFunction::EASE_OUT_SINE },
+ { "ALPHA_FUNCTION_EASE_IN_OUT_SINE", AlphaFunction::EASE_IN_OUT_SINE },
+ { "ALPHA_FUNCTION_BOUNCE", AlphaFunction::BOUNCE },
+ { "ALPHA_FUNCTION_SIN", AlphaFunction::SIN },
+ { "ALPHA_FUNCTION_EASE_OUT_BACK", AlphaFunction::EASE_OUT_BACK },
+
};
const unsigned int EnumTableCount = sizeof(EnumTable)/sizeof(EnumTable[0]);
// INTERNAL INCLUDES
#include <controls/item-view-api.h>
+#include <controls/scroll-view-api.h>
#include <v8-utils.h>
#include <dali-wrapper.h>
v8::Persistent<v8::ObjectTemplate> ControlWrapper::mControlTemplate;
v8::Persistent<v8::ObjectTemplate> ControlWrapper::mItemViewTemplate;
+v8::Persistent<v8::ObjectTemplate> ControlWrapper::mScrollViewTemplate;
Vector< void* > ControlWrapper::mControlGarbageContainer;
const ControlTemplate ControlTemplateLookup[]=
{
{ &ControlWrapper::mControlTemplate }, // CONTROL
- { &ControlWrapper::mItemViewTemplate } // ITEMVIEW
+ { &ControlWrapper::mItemViewTemplate }, // ITEMVIEW
+ { &ControlWrapper::mScrollViewTemplate } // SCROLLVIEW
};
/**
enum ControlApiBitMask
{
CONTROL_API = 1 << 0,
- ITEMVIEW_API = 1 << 1
+ ITEMVIEW_API = 1 << 1,
+ SCROLLVIEW_API = 1 << 2
};
/**
{
{"Control", ControlWrapper::CONTROL, NULL, CONTROL_API },
{"ItemView", ControlWrapper::ITEMVIEW, ItemViewApi::New, CONTROL_API | ITEMVIEW_API },
+ {"ScrollView", ControlWrapper::SCROLLVIEW, ScrollViewApi::New, CONTROL_API | SCROLLVIEW_API }
};
const unsigned int ControlApiLookupCount = sizeof(ControlApiLookup)/sizeof(ControlApiLookup[0]);
{ "GetItemId", ItemViewApi::GetItemId, ITEMVIEW_API },
{ "GetItemsRange", ItemViewApi::GetItemsRange, ITEMVIEW_API },
+ /**************************************
+ * ScrollView API
+ **************************************/
+ { "SetScrollMode", ScrollViewApi::SetScrollMode, SCROLLVIEW_API },
+ { "GetCurrentPage", ScrollViewApi::GetCurrentPage, SCROLLVIEW_API },
+ { "ScrollToPosition", ScrollViewApi::ScrollToPosition, SCROLLVIEW_API },
+ { "ScrollToPage", ScrollViewApi::ScrollToPage, SCROLLVIEW_API },
+ { "ScrollToActor", ScrollViewApi::ScrollToActor, SCROLLVIEW_API },
+ { "ScrollToSnapInterval", ScrollViewApi::ScrollToSnapInterval, SCROLLVIEW_API },
+ { "SetScrollFlickAlphaFunction", ScrollViewApi::SetScrollFlickAlphaFunction, SCROLLVIEW_API },
+ { "SetScrollSnapAlphaFunction", ScrollViewApi::SetScrollSnapAlphaFunction, SCROLLVIEW_API },
+ { "SetSnapOvershootAlphaFunction", ScrollViewApi::SetSnapOvershootAlphaFunction, SCROLLVIEW_API },
+
};
const unsigned int ControlFunctionTableCount = sizeof(ControlFunctionTable)/sizeof(ControlFunctionTable[0]);
{
UNKNOWN_CONTROL = -1,
CONTROL = 0,
- ITEMVIEW = 1
+ ITEMVIEW = 1,
+ SCROLLVIEW = 2
};
/**
--- /dev/null
+/*
+ * Copyright (c) 2015 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 "scroll-view-api.h"
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <v8-utils.h>
+#include <actors/actor-wrapper.h>
+#include <controls/control-wrapper.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+namespace // unanmed namespace
+{
+
+Toolkit::ScrollView GetScrollView( v8::Isolate* isolate, const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+ HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
+ return Toolkit::ScrollView::DownCast( handleWrapper->mHandle );
+}
+
+} //unanmed namespace
+
+/***************************************
+ * SCROLLVIEW API FUNCTIONS
+ ***************************************/
+
+/**
+ * Constructor
+ *
+ * @for ScrollView
+ * @constructor
+ * @method ScrollView
+ * @return {Object} scrollView
+ */
+Toolkit::Control ScrollViewApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = Toolkit::ScrollView::New();
+ return scrollView;
+}
+
+/**
+ * Set the scroll mode of ScrollView.
+ *
+ * This defines whether scrolling is enabled horizontally or vertically, how
+ * scrolling is snapped, and the boundary in which the scroll view can pan.
+ *
+ * When no specific scroll mode is set, scroll view can scroll to any position
+ * both horizontally and vertically and no snapping is enabled.
+ *
+ * Example of setting the scroll boundary of scroll view in the X axis to
+ * three pages (page size equals to the width of scroll view) and allowing
+ * snapping between pages, and disabling scrolling in the Y axis.
+ *
+ * ```
+ * var scrollMode = {
+ * xAxisScrollEnabled : true,
+ * xAxisSnapToInterval : scrollView.sizeWidth,
+ * xAxisScrollBoundary : scrollView.sizeWidth * 3,
+ * yAxisScrollEnabled : false
+ * }
+ *
+ * scrollView.setScrollMode(scrollMode);
+ * ```
+ *
+ * @for ScrollView
+ * @method setScrollMode
+ * @param {Object} scrollMode
+ * @param {Boolean} scrollMode.xAxisScrollEnabled True if the content can be scrolled in X axis or false if not.
+ * @param {Float} [scrollMode.xAxisSnapToInterval] When set, causes scroll view to snap to multiples of the value of the interval in the X axis while flicking. (by default no snapping)
+ * @param {Float} [scrollMode.xAxisScrollBoundary] When set, causes scroll view unable to scroll beyond the value of the boundary in the X axis (by default no boundary)
+ * @param {Boolean} scrollMode.yAxisScrollEnabled True if the content can be scrolled in Y axis or false if not.
+ * @param {Float} [scrollMode.yAxisSnapToInterval] When set, causes scroll view to snap to multiples of the value of the interval in the Y axis while flicking. (by default no snapping)
+ * @param {Float} [scrollMode.yAxisScrollBoundary] When set, causes scroll view unable to scroll beyond the value of the boundary in the Y axis (by default no boundary)
+ */
+void ScrollViewApi::SetScrollMode( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ v8::Local<v8::Value> scrollMode( args[0] );
+ if( !scrollMode->IsObject() )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid scroll mode parameter" );
+ return;
+ }
+
+ v8::Local<v8::Object> scrollModeObj = scrollMode->ToObject();
+
+ Toolkit::RulerPtr rulerX, rulerY;
+
+ // Check the scroll mode in the X axis
+ bool xAxisScrollEnabled = true;
+ v8::Local<v8::Value> xAxisScrollEnabledValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisScrollEnabled" ) );
+ if( xAxisScrollEnabledValue->IsBoolean() )
+ {
+ xAxisScrollEnabled = xAxisScrollEnabledValue->ToBoolean()->Value();
+ }
+ else
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "Missing xAxisScrollEnabled");
+ return;
+ }
+
+ if(!xAxisScrollEnabled)
+ {
+ // Default ruler and disabled
+ rulerX = new Toolkit::DefaultRuler();
+ rulerX->Disable();
+ }
+ else
+ {
+ v8::Local<v8::Value> xAxisSnapToIntervalValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisSnapToInterval" ) );
+ if( xAxisSnapToIntervalValue->IsNumber() )
+ {
+ // Fixed ruler and enabled
+ float xAxisSnapToInterval = xAxisSnapToIntervalValue->ToNumber()->Value();
+ rulerX = new Toolkit::FixedRuler(xAxisSnapToInterval);
+ }
+ else
+ {
+ // Default ruler and enabled
+ rulerX = new Toolkit::DefaultRuler();
+ }
+
+ v8::Local<v8::Value> xAxisScrollBoundaryValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisScrollBoundary" ) );
+ if( xAxisScrollBoundaryValue->IsNumber() )
+ {
+ // By default ruler domain is disabled unless set
+ float xAxisScrollBoundary = xAxisScrollBoundaryValue->ToNumber()->Value();
+ rulerX->SetDomain( Toolkit::RulerDomain( 0, xAxisScrollBoundary, true ) );
+ }
+ }
+
+ // Check the scroll mode in the Y axis
+ bool yAxisScrollEnabled = true;
+ v8::Local<v8::Value> yAxisScrollEnabledValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisScrollEnabled" ) );
+ if( yAxisScrollEnabledValue->IsBoolean() )
+ {
+ yAxisScrollEnabled = yAxisScrollEnabledValue->ToBoolean()->Value();
+ }
+ else
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "Missing yAxisScrollEnabled");
+ return;
+ }
+
+ if(!yAxisScrollEnabled)
+ {
+ // Default ruler and disabled
+ rulerY = new Toolkit::DefaultRuler();
+ rulerY->Disable();
+ }
+ else
+ {
+ v8::Local<v8::Value> yAxisSnapToIntervalValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisSnapToInterval" ) );
+ if( yAxisSnapToIntervalValue->IsNumber() )
+ {
+ // Fixed ruler and enabled
+ float yAxisSnapToInterval = yAxisSnapToIntervalValue->ToNumber()->Value();
+ rulerY = new Toolkit::FixedRuler(yAxisSnapToInterval);
+ }
+ else
+ {
+ // Default ruler and enabled
+ rulerY = new Toolkit::DefaultRuler();
+ }
+
+ v8::Local<v8::Value> yAxisScrollBoundaryValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisScrollBoundary" ) );
+ if( yAxisScrollBoundaryValue->IsNumber() )
+ {
+ // By default ruler domain is disabled unless set
+ float yAxisScrollBoundary = yAxisScrollBoundaryValue->ToNumber()->Value();
+ rulerY->SetDomain( Toolkit::RulerDomain( 0, yAxisScrollBoundary, true ) );
+ }
+ }
+
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+}
+
+/**
+ * Retrieves current scroll page based on the defined snap interval being the
+ * size of one page, and all pages laid out in a grid fashion, increasing from
+ * left to right until the end of the scroll boundary. Pages start from 0 as the
+ * first page.
+ *
+ * If no snap interval is defined, this API will return undefined value.
+ *
+ * @for ScrollView
+ * @method getCurrentPage
+ * @return {Integer} The index of current page in scroll view
+ */
+void ScrollViewApi::GetCurrentPage( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+ args.GetReturnValue().Set( v8::Integer::New( isolate, scrollView.GetCurrentPage() ) );
+}
+
+/**
+ * Scrolls the contents to the given position.
+ *
+ * Position 0,0 is the origin. Increasing X scrolls contents left, while
+ * increasing Y scrolls contents up. If Rulers have been applied to the axes,
+ * then the contents will scroll until reaching the scroll boundary.
+ * Contents will not snap.
+ *
+ * The biasing parameters are provided such that in scenarios with 2 or 2x2 pages
+ * in wrap mode, the application developer can decide whether to scroll left or
+ * right to get to the target page.
+ *
+ * @for ScrollView
+ * @method scrollToPosition
+ * @param {Array} position The position to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @param {Integer} [alphaFunction] The alpha function to use.
+ * @param {Integer} [horizontalBias] Whether to bias scrolling to left or right (by default no bias).
+ * @param {Integer} [verticalBias] Whether to bias scrolling to top or bottom (by default no bias).
+ * @example
+ * // scroll direction bias is one of the following
+ * dali.DIRECTION_BIAS_NONE // Don't bias scroll snap
+ * dali.DIRECTION_BIAS_LEFT // Bias scroll snap to Left
+ * dali.DIRECTION_BIAS_RIGHT // Bias scroll snap to Right
+ *
+ * scrollView.scrollToPosition( [150.0, 100.0], 0.5, dali.ALPHA_FUNCTION_EASE_IN_OUT, dali.DIRECTION_BIAS_LEFT, dali.DIRECTION_BIAS_NONE );
+ */
+void ScrollViewApi::ScrollToPosition( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ Vector2 position = V8Utils::GetVector2Parameter( PARAMETER_0, found, isolate, args );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "bad position parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+
+ AlphaFunction alphaFunction = scrollView.GetScrollSnapAlphaFunction();
+
+ found = false;
+ int alpha = V8Utils::GetIntegerParameter( PARAMETER_2, found, isolate, args, 0 );
+ if(found)
+ {
+ alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alpha);
+ }
+
+ Toolkit::DirectionBias horizontalBias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_3, found, isolate, args, Toolkit::DirectionBiasNone ) );
+ Toolkit::DirectionBias verticalBias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_4, found, isolate, args, Toolkit::DirectionBiasNone ) );
+
+ scrollView.ScrollTo( position, durationSeconds, alphaFunction, horizontalBias, verticalBias );
+}
+
+/**
+ * Scrolls the contents to the page with the given index.
+ *
+ * This is based on assumption that the page index starts from 0 and the
+ * position of each page is: [pageIndex * snapToInterval, 0].
+ *
+ * If no snap interval is defined, calling this API will cause unexpected
+ * behaviour.
+ *
+ * The biasing parameter is provided such that in scenarios with 2 pages
+ * in wrap mode, the application developer can decide whether to scroll
+ * left or right to get to the target page.
+ *
+ * @for ScrollView
+ * @method scrollToPage
+ * @param {Integer} pageIndex The index of the page to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @param {Integer} [bias] Whether to bias scrolling to left or right (by default no bias).
+ * @example
+ * // scroll direction bias is one of the following
+ * dali.DIRECTION_BIAS_NONE // Don't bias scroll snap
+ * dali.DIRECTION_BIAS_LEFT // Bias scroll snap to Left
+ * dali.DIRECTION_BIAS_RIGHT // Bias scroll snap to Right
+ *
+ * scrollView.scrollToPage( 1, 0.5, dali.DIRECTION_BIAS_RIGHT );
+ */
+void ScrollViewApi::ScrollToPage( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int pageIndex = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "bad page index parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+ Toolkit::DirectionBias bias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_2, found, isolate, args, Toolkit::DirectionBiasNone ) );
+
+ scrollView.ScrollTo( pageIndex, durationSeconds, bias );
+}
+
+/**
+ * Scrolls the contents such that the given actor appears in the center of
+ * the scroll view.
+ *
+ * The actor must be a direct child of scroll view.
+ *
+ * @for ScrollView
+ * @method scrollToActor
+ * @param {Object} actor The actor to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @example
+ * scrollView.scrollToActor( childActor, 0.5 );
+ */
+void ScrollViewApi::ScrollToActor( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ Actor actor = V8Utils::GetActorParameter( 0, found, isolate, args );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid actor parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+
+ scrollView.ScrollTo( actor, durationSeconds );
+}
+
+/**
+ * Scrolls the content to the nearest snap point as specified by the snap interval.
+ * If already at snap points, it will not scroll.
+ *
+ * @for ScrollView
+ * @method scrollToSnapInterval
+ * @return {Boolean} True if snapping is needed or false if already at snap points
+ * @example
+ * var success = scrollView.scrollToSnapInterval();
+ */
+void ScrollViewApi::ScrollToSnapInterval( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ args.GetReturnValue().Set( v8::Boolean::New( isolate, scrollView.ScrollToSnapPoint() ) );
+}
+
+/**
+ * Set the alpha function of flick animation.
+ *
+ * @for ScrollView
+ * @method setScrollFlickAlphaFunction
+ * @param {Integer} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setScrollFlickAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetScrollFlickAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetScrollFlickAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+/**
+ * Set the alpha function of snap animation.
+ *
+ * @for ScrollView
+ * @method setScrollSnapAlphaFunction
+ * @param {String} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setScrollSnapAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetScrollSnapAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetScrollSnapAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+/**
+ * Set the alpha function of overshoot snap animation.
+ *
+ * @for ScrollView
+ * @method setSnapOvershootAlphaFunction
+ * @param {String} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setSnapOvershootAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetSnapOvershootAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetSnapOvershootAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+} // namespace V8Plugin
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
+#define __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
+
+/*
+ * Copyright (c) 2015 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 <v8.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+namespace ScrollViewApi
+{
+
+ /**
+ * constructor
+ */
+ Toolkit::Control New( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+ /**
+ * ScrollView API. See scroll-view.h for description of functions
+ */
+ void SetScrollMode( const v8::FunctionCallbackInfo< v8::Value >& args);
+ void GetCurrentPage( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToPosition( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToPage( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToActor( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToSnapInterval( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetScrollFlickAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetScrollSnapAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetSnapOvershootAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+}; // namespace ScrollViewApi
+
+} // namespace V8Plugin
+
+} // namespace Dali
+
+#endif // header __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
ACTOR_PROPERTY,
ITEMVIEW,
ITEMFACTORY,
+ SCROLLVIEW,
RENDER_TASK,
RENDER_TASK_LIST,
TIMER,