OSDN Git Service

Version 0.6.140, fix size detection @IE.
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 15_ScrollBox.js
index 0191bb0..81c1958 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
@@ -238,14 +234,14 @@ function X_UI_ScrollBox_onLayoutComplete( e ){
                                        y : that.scrollY\r
                                },\r
                                {\r
-                                       x : x | 0,\r
-                                       y : y | 0\r
+                                       x : x,\r
+                                       y : y\r
                                },\r
                                opt_time, opt_easing, opt_release\r
                        );\r
                        \r
-                       that.scrollX = x | 0;\r
-                       that.scrollY = y | 0;\r
+                       that.scrollX = x;\r
+                       that.scrollY = y;\r
                        \r
                        if( that.indicators ){\r
                                for( i = that.indicators.length; i--; ){\r
@@ -304,6 +300,10 @@ function X_UI_ScrollBox_onMove( e ){
        if( !this.scrollEnabled || e.pointerType !== this.initiated ){\r
                return ret;\r
        };\r
+       \r
+       if( e.buttons !== 1 ){\r
+               return X_UI_ScrollBox_onEnd.call( this, e );\r
+       };\r
 \r
        // gpu の用意\r
        if( !this._containerXNode[ '_anime' ] ){\r
@@ -395,7 +395,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 +422,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 +448,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 +482,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 +497,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