define(["Ti/_/declare","Ti/_/UI/KineticScrollView","Ti/_/style","Ti/_/lang","Ti/UI"],function(t,n,i,e,r){var a=e.isDef,o=.001;return t("Ti.UI.ScrollView",n,{constructor:function(){var t;this._initKineticScrollView(t=r.createView({width:r.SIZE,height:r.SIZE,_minWidth:"100%",_minHeight:"100%",left:0,top:0}),"both","both",1)},_handleMouseWheel:function(){this._isScrollBarActive&&this.fireEvent("scroll",{x:-this._currentTranslationX,y:-this._currentTranslationY,dragging:!1,decelerating:!1})},_handleDragStart:function(){this.fireEvent("dragStart")},_handleDrag:function(){this.fireEvent("scroll",{x:-this._currentTranslationX,y:-this._currentTranslationY,dragging:!0,decelerating:!1})},_handleDragEnd:function(t,n,i){if(a(n)){var e=this,s=Math.sqrt(n*n+i*i),l=s*s/(1.724*o),c=s/o,h=Math.atan(Math.abs(i/n)),u=l*Math.cos(h)*(0>n?-1:1),_=l*Math.sin(h)*(0>i?-1:1),f=Math.min(0,Math.max(e._minTranslationX,e._currentTranslationX+u)),d=Math.min(0,Math.max(e._minTranslationY,e._currentTranslationY+_));e.fireEvent("dragEnd",{decelerate:!0}),e._animateToPosition(f,d,c,r.ANIMATION_CURVE_EASE_OUT,function(){e._setTranslation(f,d),e._endScrollBars(),e.fireEvent("scrollEnd")})}},scrollTo:function(t,n){this._setTranslation(null!==t?-t:this._currentTranslationX,null!==n?-n:this._currentTranslationX)},_defaultWidth:r.FILL,_defaultHeight:r.FILL,_getContentOffset:function(){return this.contentOffset},_preLayout:function(){var t=this._contentContainer.layout===this.layout;return this._contentContainer.layout=this.layout,t},add:function(t){this._contentContainer._add(t),this._publish(t)},remove:function(t){this._contentContainer.remove(t),this._unpublish(t)},properties:{contentHeight:{get:function(){return this._contentContainer.height},set:function(t){return this._contentContainer.height=t,t}},contentOffset:{get:function(){return{x:-this._currentTranslationX,y:-this._currentTranslationY}},set:function(t){return this._setTranslation(a(t.x)?-t.x:this._currentTranslationX,a(t.y)?-t.y:this._currentTranslationY),t}},contentWidth:{get:function(){return this._contentContainer.width},set:function(t){return this._contentContainer.width=t,t}},disableBounce:!1,horizontalBounce:{set:function(t){return this._horizontalElastic=t},value:!0},layout:{set:function(t){return this._contentContainer.layout=t},value:"composite"},showHorizontalScrollIndicator:{set:function(t,n){return t!==n&&(t?this._createHorizontalScrollBar():this._destroyHorizontalScrollBar()),t},value:!0},showVerticalScrollIndicator:{set:function(t,n){return t!==n&&(t?this._createVerticalScrollBar():this._destroyVerticalScrollBar()),t},value:!0},verticalBounce:{set:function(t){return this._verticalElastic=t},value:!0}}})});