-\r
+/*\r
+ * scroll 要素は常にひとつ\r
+ * ScrollManager\r
+ * indicatorX, Y は再利用\r
+ */\r
\r
\r
var X_UI_ScrollBox_SUPPORT_ATTRS = {\r
directionLocked : '',\r
startTime : 0,\r
endTime : 0,\r
- isAnimating : false,\r
isInTransition : false,\r
\r
hasHScroll : false,\r
_containerNode : null,\r
xnodeSlider : null,\r
\r
+ xnodeIndicatorX : null,\r
+ xnodeIndicatorY : null,\r
+ \r
Constructor : function( user, layout, args ){\r
this[ 'Super' ]( user, layout, args );\r
this._containerNode = X_Pair_get( this.containerNode );\r
function X_UI_ScrollBox_onLayoutBefore( e ){\r
if( e[ 'cancelable' ] && this.isInTransition && X_Node_Anime_translateZ ){\r
this[ 'listenOnce' ]( XUI_Event.SCROLL_END, X_UI_rootData, X_UI_rootData.calculate );\r
- return X_Callback_PREVENT_DEFAULT;\r
+ return X_CALLBACK_PREVENT_DEFAULT;\r
};\r
this.scrollXRatio = this.scrollX ? this.scrollXMax / this.scrollX : 0;\r
this.scrollYRatio = this.scrollY ? this.scrollYMax / this.scrollY : 0;\r
- this.xnodeSlider.stop();\r
+ this.xnodeSlider[ 'stop' ]();\r
this.isInTransition = false;\r
- return X_Callback_NONE;\r
+ return X_CALLBACK_NONE;\r
};\r
\r
function X_UI_ScrollBox_onLayoutComplete( e ){\r
// scroll の停止、GPU の解除\r
- var font = this.fontSize = this.xnodeSlider.call( 'fontSize' );\r
+ var font = this.fontSize = this.xnodeSlider[ 'call' ]( 'fontSize' );\r
\r
this.scrollXMax = ( this.boxWidth - this._containerNode.boxWidth ) * font | 0;\r
this.scrollYMax = ( this.boxHeight - this._containerNode.boxHeight ) * font | 0;\r
if( this.scrolling ){\r
// scroller 削除\r
this[ 'unlisten' ]( XUI_Event._POINTER_DOWN, this, X_UI_ScrollBox_onStart );\r
- X_UI_rootData[ 'unlisten' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore );\r
+ X_UI_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
opt_easing = opt_easing === '' ? '' : opt_easing || 'circular';\r
opt_release = 0 <= opt_release ? opt_release : 300;\r
\r
- that.xnodeSlider.animate(\r
+ that.xnodeSlider[ 'animate' ](\r
{\r
x : that.scrollX,\r
y : that.scrollY\r
};\r
\r
function X_UI_ScrollBox_onStart( e ){\r
- var ret = X_Callback_NONE;\r
+ var ret = X_CALLBACK_NONE;\r
\r
// React to left mouse button only\r
if( e.pointerType === 'mouse' && e.button !== 0 ){\r
this.startTime = X_Timer_now();\r
\r
// スクロール中の停止\r
- if( this.isInTransition || this.isAnimating ){\r
- this.isInTransition = this.isAnimating = false;\r
+ if( this.isInTransition ){\r
+ this.isInTransition = false;\r
this[ 'dispatch' ]( XUI_Event.SCROLL_END );\r
- this.xnodeSlider.stop();\r
+ // TODO current位置\r
+ this.xnodeSlider[ 'stop' ]();\r
}; \r
\r
this.startX = this.scrollX;\r
this[ 'listen' ]( XUI_Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove );\r
this[ 'listen' ]( [ XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd );\r
\r
- return ret | X_Callback_PREVENT_DEFAULT;\r
+ return ret | X_CALLBACK_PREVENT_DEFAULT;\r
};\r
\r
function X_UI_ScrollBox_onMove( e ){\r
- var ret = X_Callback_NONE,\r
+ var ret = X_CALLBACK_NONE,\r
deltaX, deltaY, timestamp,\r
newX, newY,\r
absDistX, absDistY;\r
// 規定以上の move でスクロール開始\r
\r
-console.log( 'scrollmove ' + e.buttons + ' ' + e.button );\r
+//console.log( 'scrollmove ' + e.buttons + ' ' + e.button );\r
\r
if( !this.scrollEnabled || e.pointerType !== this.initiated ){\r
return ret;\r
this.startY = this.scrollY;\r
};\r
// イベントの拘束\r
- return ret | X_Callback_PREVENT_DEFAULT | X_Callback_CAPTURE_POINTER;\r
+ return ret | X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_CAPTURE_POINTER;\r
};\r
\r
function X_UI_ScrollBox_onEnd( e ){\r
- var ret = X_Callback_NONE,\r
+ var ret = X_CALLBACK_NONE,\r
time = 0,\r
easing = '',\r
newX, newY,\r
return false;\r
};\r
\r
- //console.log( 'バウンド!' );\r
- //console.log( 'rese x:' + x + ' y:' + y );\r
+ console.log( ' ===> resetPosition - バウンド!' );\r
+ console.log( ' x:' + x + ' y:' + y );\r
that.scrollTo( x, y, time, that.bounceEasing, 1000 );\r
\r
return true;\r
\r
function X_UI_ScrollBox_onAnimeEnd( e ){\r
if( e.target !== this.xnodeSlider || !this.isInTransition ){\r
- return X_Callback_NONE;\r
+ return X_CALLBACK_NONE;\r
};\r
if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){\r
this.isInTransition = false;\r
this[ 'dispatch' ]( XUI_Event.SCROLL_END );\r
};\r
- return X_Callback_NONE;\r
+ return X_CALLBACK_NONE;\r
};\r
\r
function X_UI_ScrollBox_momentum( current, start, time, lowerMargin, wrapperSize, deceleration ){\r
};\r
};\r
\r
-// TODO Box の継承に!\r
X.UI.ScrollBox = X.UI.ChromeBox.inherits(\r
'ScrollBox',\r
X_Class.NONE,\r
if( XUI_ScrollBox.prototype.usableAttrs === XUI_ChromeBox.prototype.usableAttrs ){\r
XUI_ScrollBox.prototype.usableAttrs = supports = XUI_Attr_createAttrDef( XUI_Attr_Support, X_UI_ScrollBox_SUPPORT_ATTRS );\r
\r
- XUI_ScrollBox.prototype.attrClass = XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, { width : '100%', height : '100%', bgColor : 0x111111 } );\r
+ XUI_ScrollBox.prototype.attrClass = XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, { width : '100%', height : '100%', bgColor : 0x111111 } );\r
};\r
\r
var args = [\r
\r
}\r
}\r
-);
\ No newline at end of file
+);\r
+\r