var SCROLL_DEACCEL_RATE=.95,SCROLL_DEACCEL_DIST=1,BOUNCE_DURATION=.15,INSET_RATIO=.2,MOVE_INCH=7/160,BOUNCE_BACK_FACTOR=.35;cc.convertDistanceFromPointToInch=function(t){var e=cc.view;return t*((e.getScaleX()+e.getScaleY())/2)/160},cc.ScrollView=cc.Layer.extend({_dragging:!1,_container:null,_touchMoved:!1,_maxInset:null,_minInset:null,_bounceable:!1,_clippingToBounds:!1,_scrollDistance:null,_touchPoint:null,_viewSize:null,_parentScissorRect:null,_scissorRestored:!1,_tmpViewRect:null,_touchListener:null,_className:"ScrollView",ctor:function(t,e){cc.Layer.prototype.ctor.call(this),this._maxInset=cc.p(0,0),this._minInset=cc.p(0,0),this._scrollDistance=cc.p(0,0),this._touchPoint=cc.p(0,0),this._viewSize=cc.size(0,0),this._parentScissorRect=new cc.Rect(0,0,0,0),this._tmpViewRect=new cc.Rect(0,0,0,0),cc._renderType===cc._RENDER_TYPE_CANVAS&&(this.startCmd=new cc.CustomRenderCmdCanvas(this,function(t,e,i){(t=t||cc.context).save(),t.save(),this.transform();var n=this._transformWorld;t.transform(n.a,n.b,n.c,n.d,n.tx*e,-n.ty*i),cc.ScrollView.prototype._beforeDraw.call(this)}),this.endCmd=new cc.CustomRenderCmdCanvas(this,function(t){(t=t||cc.context).restore()})),void 0!=e?this.initWithViewSize(t,e):this.initWithViewSize(cc.size(200,200),null)},_initRendererCmd:function(){},init:function(){return this.initWithViewSize(cc.size(200,200),null)},initWithViewSize:function(t,e){var i=cc.p(0,0);return!!cc.Layer.prototype.init.call(this)&&(this._container=e,this._container||(this._container=new cc.Layer,this._container.ignoreAnchorPointForPosition(!1),this._container.setAnchorPoint(i)),this.setViewSize(t),this.setTouchEnabled(!0),this._bounceable=!0,this._clippingToBounds=!0,this._container.setPosition(i),this.addChild(this._container),!0)},setContentOffset:function(t,e){if(e)this.setContentOffsetInDuration(t,BOUNCE_DURATION);else{if(!this._bounceable){var i=this.minContainerOffset(),n=this.maxContainerOffset();t.x=Math.max(i.x,Math.min(n.x,t.x)),t.y=Math.max(i.y,Math.min(n.y,t.y))}this._container.setPosition(t)}},getContentOffset:function(){var t=this._container.getPosition();return cc.p(t.x,t.y)},setContentOffsetInDuration:function(t,e){var i=cc.moveTo(e,t),n=cc.callFunc(this._stoppedAnimatedScroll,this);this._container.runAction(cc.sequence(i,n)),this.schedule(this._performedAnimatedScroll)},minContainerOffset:function(){return cc.p(0,0)},maxContainerOffset:function(){var t=this._container.getContentSize(),e=this._viewSize;return cc.p(e.width-t.width,t.height-e.height)},isNodeVisible:function(t){var e=this.getContentOffset(),i=this.getViewSize(),n=this.getZoomScale(),s=cc.rect(-e.x/n,-e.y/n,i.width/n,i.height/n);return cc.rectIntersectsRect(s,t.getBoundingBox())},pause:function(t){this._container.pause();for(var e=this._container.getChildren(),i=0;i0){for(n=o.length,this.sortAllChildren(),e=0;ee.y||ce.x||oe.height){var n=i.height-e.height+t,s=this._container.getPosition();this._container.setPosition(s.x,n)}},scrollContent:function(t,e){var i=this._viewSize,n=this._container.getContentSize();if(n.height>i.height){var s=n.height-this._viewSize.height,o=this._container.getPosition();o.y+=t,o.y<0?o.y=0:o.y>s&&(o.y=s),this.setContentOffsetInDuration(o,e)}}});var _p=cc.ScrollView.prototype;_p.minOffset,cc.defineGetterSetter(_p,"minOffset",_p.minContainerOffset),_p.maxOffset,cc.defineGetterSetter(_p,"maxOffset",_p.maxContainerOffset),_p.bounceable,cc.defineGetterSetter(_p,"bounceable",_p.isBounceable,_p.setBounceable),_p.viewSize,cc.defineGetterSetter(_p,"viewSize",_p.getViewSize,_p.setViewSize),_p.container,cc.defineGetterSetter(_p,"container",_p.getContainer,_p.setContainer),_p.direction,cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection),_p.delegate,cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate),_p.clippingToBounds,cc.defineGetterSetter(_p,"clippingToBounds",_p.isClippingToBounds,_p.setClippingToBounds),_p=null;