+ if( !this.hasVScroll ){\r
+ this.scrollYMax = 0;\r
+ };\r
+\r
+ delete this.endTime;\r
+ delete this.directionX;\r
+ delete this.directionY;\r
+\r
+ X_UI_ScrollBox_resetPosition( this, 0 );\r
+\r
+ if( this.hasHScroll || this.hasVScroll ){\r
+ // scroll が必要。\r
+ if( this.scrolling ){\r
+ X_UI_ScrollBox_translate( this, this.scrollXMax * this.scrollXRatio, this.scrollYMax * this.scrollYRatio, 100, '', 300 );\r
+ } else {\r
+ // scroller 作る\r
+ this[ 'listen' ]( XUI_Event._POINTER_DOWN, X_UI_ScrollBox_onStart )\r
+ [ 'listen' ]( XUI_Event.DRAG, X_UI_ScrollBox_onMove )\r
+ [ 'listen' ]( XUI_Event.DRAG_END, X_UI_ScrollBox_onEnd );\r
+ XUI_rootData[ 'listen' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore );\r
+ \r
+ X_UI_ScrollBox_translate( this, this.scrollXMax * this.scrollXRatio, this.scrollYMax * this.scrollYRatio, 100, '', 300 );\r
+ this.scrolling = true;\r
+ };\r
+ } else\r
+ // scroll 不要\r
+ if( this.scrolling ){\r
+ // scroller 削除\r
+ this[ 'unlisten' ]( XUI_Event._POINTER_DOWN, X_UI_ScrollBox_onStart )\r
+ [ 'unlisten' ]( XUI_Event.DRAG, X_UI_ScrollBox_onMove )\r
+ [ 'unlisten' ]( XUI_Event.DRAG_END, X_UI_ScrollBox_onEnd );\r
+ XUI_rootData[ 'unlisten' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore );\r
+ \r
+ ( this.scrollX !== 0 || this.scrollY !== 0 ) && X_UI_ScrollBox_translate( this, 0, 0, 100, '', 300 );\r
+ \r
+ delete this.scrolling;\r
+ delete this.scrollXRatio;\r
+ delete this.scrollYRatio;\r
+ };\r
+};\r
+\r
+// TODO use scrollLeft, scrollTop\r
+function X_UI_ScrollBox_translate( that, x, y, opt_time, opt_easing, opt_release ){\r
+ var scrollBoxH = that.fontSize * that.boxHeight,\r
+ scrollBoxW = that.fontSize * that.boxWidth,\r
+ indicatorH, indicatorW;\r
+ \r
+ opt_time = 0 <= opt_time ? opt_time : 0;\r
+ opt_easing = opt_easing === '' ? '' : opt_easing || 'circular';\r
+ opt_release = 0 <= opt_release ? opt_release : 300;\r
+ \r
+ console.log( 'scr ' + y );\r
+ \r
+ if( !XUI_ScrollBox_useCSSP ){\r
+ that.xnode[ 'animate' ]({\r
+ 'from' : {\r
+ scrollX : -that.scrollX,\r
+ scrollY : -that.scrollY\r
+ },\r
+ 'to' : {\r
+ scrollX : -x,\r
+ scrollY : -y\r
+ },\r
+ 'duration' : opt_time,\r
+ 'easing' : opt_easing\r
+ }); \r
+ } else {\r
+ that.xnodeSlider[ 'animate' ]({\r
+ 'from' : {\r
+ x : that.scrollX,\r
+ y : that.scrollY\r
+ },\r
+ 'to' : {\r
+ x : x,\r
+ y : y\r
+ },\r
+ 'duration' : opt_time,\r
+ 'easing' : opt_easing,\r
+ 'lazyRelease' : opt_release\r
+ }); \r
+ };\r
+\r
+ if( X_UA[ 'IE' ] < 6 ){\r
+ XUI_ScrollBox_indicatorV && XUI_ScrollBox_indicatorV[ 'css' ]( 'left', ( scrollBoxW - that.fontSize * 0.6 | 0 ) + 'px' );\r
+ XUI_ScrollBox_indicatorH && XUI_ScrollBox_indicatorH[ 'css' ]( 'top' , ( scrollBoxH - that.fontSize * 0.6 | 0 ) + 'px' );\r
+ };\r
+\r
+ if( that.hasVScroll && XUI_ScrollBox_indicatorV && XUI_ScrollBox_indicatorV.parent === that.xnode ){\r
+ indicatorH = scrollBoxH * scrollBoxH / ( - that.scrollYMax + scrollBoxH );\r
+ scrollBoxH -= indicatorH;\r
+\r
+ XUI_ScrollBox_indicatorV\r
+ [ 'css' ]({\r
+ height : ( indicatorH | 0 ) + 'px'\r
+ })\r
+ [ 'animate' ]({\r
+ 'from' : {\r
+ y : scrollBoxH * that.scrollY / that.scrollYMax },\r
+ 'to' : {\r
+ y : scrollBoxH * y / that.scrollYMax,\r
+ opacity : 0.5\r
+ },\r
+ 'duration' : opt_time,\r
+ 'easing' : opt_easing,\r
+ 'lazyRelease' : opt_release\r
+ });\r
+ };\r
+ if( that.hasHScroll && XUI_ScrollBox_indicatorH && XUI_ScrollBox_indicatorH.parent === that.xnode ){\r
+ indicatorW = scrollBoxW * scrollBoxW / ( - that.scrollXMax + scrollBoxW );\r
+ scrollBoxW -= indicatorW;\r
+ XUI_ScrollBox_indicatorH\r
+ [ 'css' ]({\r
+ width : ( indicatorW | 0 ) + 'px'\r
+ })\r
+ [ 'animate' ]({\r
+ 'from' : {\r
+ x : scrollBoxW * that.scrollX / that.scrollXMax },\r
+ 'to' : {\r
+ x : scrollBoxW * x / that.scrollXMax,\r
+ opacity : 0.5\r
+ },\r
+ 'duration' : opt_time,\r
+ 'easing' : opt_easing,\r
+ 'lazyRelease' : opt_release\r
+ });\r
+ };\r
+ \r
+ that.scrollX = x;\r
+ that.scrollXEm = x / that.fontSize;\r
+ that.scrollY = y;\r
+ that.scrollYEm = y / that.fontSize;\r
+};\r
+\r
+function X_UI_ScrollBox_onStart( e ){\r
+ var ret = X_CALLBACK_NONE;\r
+ \r
+ if( !this.scrollEnabled || ( this.initiated && e.pointerType !== this.initiated ) ){\r