OSDN Git Service

Version 0.6.139, fix Node.animate when no.
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 15_ScrollBox.js
index 0191bb0..cd5e4f4 100644 (file)
@@ -140,10 +140,6 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits(
                                        X_UI_rootData[ 'listenOnce' ]( X.UI.Event.LAYOUT_COMPLETE, this, X_UI_ScrollBox_onLayoutComplete );\r
                                };\r
                },\r
-               \r
-               scrollBy : function( x, y, opt_time, opt_easing ){\r
-                       this.scrollTo( this.scrollX + x, this.scrollY + y, opt_time, opt_easing );\r
-               },\r
        \r
                scrollTo : function( x, y, opt_time, opt_easing, opt_release ){\r
                        //if( this.scrollX === x && this.scrollY === y ) return;\r
@@ -175,8 +171,8 @@ function X_UI_ScrollBox_onLayoutComplete( e ){
        // scroll の停止、GPU の解除\r
        var font = this.fontSize = this._containerXNode.call( 'fontSize' );\r
        \r
-       this.maxScrollX = ( this.boxWidth  - this._containerNode.boxWidth ) * font;\r
-       this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font;\r
+       this.maxScrollX = ( this.boxWidth  - this._containerNode.boxWidth ) * font | 0;\r
+       this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font | 0;\r
 \r
        this.hasHScroll = this.scrollXEnabled && this.maxScrollX < 0;\r
        this.hasVScroll = this.scrollYEnabled && this.maxScrollY < 0;\r
@@ -395,7 +391,7 @@ function X_UI_ScrollBox_onEnd( e ){
                easing = '',\r
                newX, newY,\r
                momentumX, momentumY,\r
-               duration, distanceX, distanceY, font;\r
+               duration, distanceX, distanceY;\r
                                                \r
        this[ 'unlisten' ]( X.UI.Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove );\r
        this[ 'unlisten' ]( [ X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd );\r
@@ -422,24 +418,24 @@ function X_UI_ScrollBox_onEnd( e ){
        // we scrolled less than 10 pixels\r
        if( !this.moved ){\r
                // this[ 'dispatch' ]( X_EVENT_CANCELED );\r
+               console.log( 'we scrolled less than 10 pixels' );\r
                return ret;\r
        };\r
 \r
        // start momentum animation if needed\r
        if( this.momentumEnabled && duration < 300 ){\r
-               font = this.fontSize;\r
                momentumX = this.hasHScroll ?\r
-                                               X_UI_ScrollBox_momentum( this.scrollX, this.startX, duration, this.maxScrollX, this.bounceEnabled ? this.boxWidth  * font : 0, this.deceleration ) :\r
+                                               X_UI_ScrollBox_momentum( this.scrollX, this.startX, duration, this.maxScrollX, this.bounceEnabled ? this.boxWidth  * this.fontSize : 0, this.deceleration ) :\r
                                                { destination: newX, duration: 0 };\r
                momentumY = this.hasVScroll   ?\r
-                                               X_UI_ScrollBox_momentum( this.scrollY, this.startY, duration, this.maxScrollY, this.bounceEnabled ? this.boxHeight * font : 0, this.deceleration ) :\r
+                                               X_UI_ScrollBox_momentum( this.scrollY, this.startY, duration, this.maxScrollY, this.bounceEnabled ? this.boxHeight * this.fontSize : 0, this.deceleration ) :\r
                                                { destination: newY, duration: 0 };\r
                newX = momentumX.destination;\r
                newY = momentumY.destination;\r
                time = Math.max( momentumX.duration, momentumY.duration ) | 0;\r
                this.isInTransition = true;\r
        } else {\r
-               //console.log( '慣性無し' );\r
+               console.log( '慣性無し' );\r
        };\r
 \r
        if( newX != this.scrollX || newY != this.scrollY ){\r
@@ -448,12 +444,12 @@ function X_UI_ScrollBox_onEnd( e ){
                        easing = 'quadratic';\r
                };\r
 \r
-               //console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time );\r
+               console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time );\r
                this.scrollTo( newX, newY, time, easing, 1000 );\r
                return ret;\r
        };\r
 \r
-       //console.log( 'end1 x:' + newX + ' y:' + newY );\r
+       console.log( 'end1 x:' + newX + ' y:' + newY );\r
        this.scrollTo( newX, newY, 0, '', 1000 );       // ensures that the last position is rounded\r
 \r
        this[ 'dispatch' ]( X.UI.Event.SCROLL_END );\r
@@ -482,7 +478,7 @@ function X_UI_ScrollBox_resetPosition( that, time ){
        };\r
 \r
        if( x === that.scrollX && y === that.scrollY ){\r
-               //console.log( 'no バウンド y:' + y + ' max:' + that.maxScrollY );\r
+               console.log( 'no バウンド y:' + y + ' max:' + that.maxScrollY );\r
                return false;\r
        };\r
 \r
@@ -497,7 +493,6 @@ function X_UI_ScrollBox_onAnimeEnd( e ){
        if( e.target !== this._containerXNode || !this.isInTransition ){\r
                return X_Callback_NONE;\r
        };\r
-       //this.xnodeScroller.stop();\r
        if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){\r
                this.isInTransition = false;\r
                this.dispatch( X.UI.Event.SCROLL_END );\r