define('application/widgets/onboarding/carousel', [
'rofl/widgets/image',
'rofl/widgets/label',
'rofl/widgets/carousel',
'antie/widgets/carousel/binder',
'antie/widgets/carousel/keyhandlers/alignfirsthandler'
], function (
Image,
Label,
Carousel,
Binder,
AlignFirstHandler
) {
'use strict';
return Carousel.extend({
/**
* Associate a data item with this widget.
*
* @param {Object} dataItem - The carousel's params.
* @param {Object} dataItem.carousel - The carousel widget.
* @param {Object} dataItem.aligner - The carousel's aligner.
* @param {Object} dataItem.data - The carousel's data to populate.
*/
setOnboardingDataItem: function setDataItem (dataItem) {
var carousel = dataItem.carousel,
aligner = dataItem.aligner,
formatter = dataItem.formatter,
items = dataItem.data,
binder = new Binder(new formatter(), items),
handler = new AlignFirstHandler();
handler.setAnimationOptions({
duration: 250,
easing: 'easeInOut',
skipAnim: false,
fps: 60
});
carousel.setAligner(aligner);
carousel.setContinuousListener(true);
handler.attach(carousel);
binder.appendAllTo(carousel);
carousel.setAlignPoint(0);
carousel.setNormalisedWidgetAlignPoint(0);
carousel.setActiveChildIndex(0);
},
/**
* Returns true if carousel is focusable.
*
* @returns {boolean} - True if bullets are focusable.
*/
isFocusable: function () {
return false;
}
});
});