-var XUI_rootData = null,
- XUI_xnodeIneraction = null,
- XUI_UINODES_HOVER = [],
- XUI_EVENT_COUNTER = {},
- XUI_uinodeTarget = null,
+var XUI_rootData = null,
+ XUI_xnodeIneraction = null,
+ XUI_mousemoveFix = X_UA[ 'WinPhone' ] && X_UA[ 'IE9' ],
+ XUI_mousemoveFixOn = 0,
+ XUI_mousemoveFixX = 0,
+ XUI_mousemoveFixY = 0,
+ XUI_mousemoveFixLast = null,
+ XUI_UINODES_HOVER = [],
+ XUI_EVENT_COUNTER = {},
+ XUI_uinodeTarget = null,
XUI_xnodeInteractionOverlay,
- XUI_interactionBusy = false;
+ XUI_interactionBusy = false;
+
+function XUI_mousemoveFixResetScroll(){
+ var raw = XUI_xnodeInteractionOverlay[ '_rawObject' ];
+
+ if( XUI_mousemoveFix ){
+ XUI_mousemoveFixX = raw.scrollLeft = raw.offsetWidth;
+ XUI_mousemoveFixY = raw.scrollTop = raw.offsetHeight;
+ };
+};
+
+function XUI_mousemoveFixScrollEnd(){
+ var raw = XUI_xnodeInteractionOverlay[ '_rawObject' ];
+
+ XUI_mousemoveFixOn = 0;
+ XUI_mousemoveFixLast.type = 'pointerup';
+ X_UI_eventRellay( XUI_mousemoveFixLast );
+
+ raw.scrollLeft = XUI_mousemoveFixX;
+ raw.scrollTop = XUI_mousemoveFixY;
+};
function X_UI_eventRellay( e ){
var font = X_ViewPort_baseFontSize,
- x = e.pageX / font, // clientX は iOS4- で通らない?
- y = e.pageY / font,
+ x = e.pageX, // clientX は iOS4- で通らない?
+ y = e.pageY,
type = XUI_Event.NameToID[ e.type ],
i = 0,
data = XUI_rootData,
sysOnly = false,
ret = X_CALLBACK_NONE,
- list, parent, _ret, eventIn, eventOut;
+ list = XUI_UINODES_HOVER,
+ raw, parent, _ret, eventIn, eventOut;
- // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止
- if( !data || XUI_interactionBusy ) return ret;
+ // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止
+ if( XUI_interactionBusy ) return ret;
XUI_interactionBusy = true;
+ if( XUI_mousemoveFix ){
+ if( e.type === 'scroll' ){
+ raw = XUI_xnodeInteractionOverlay[ '_rawObject' ];
+ type = XUI_mousemoveFixOn ? XUI_Event._POINTER_MOVE : XUI_Event._POINTER_DOWN;
+ x = XUI_mousemoveFixX - raw.scrollLeft;
+ y = XUI_mousemoveFixY - raw.scrollTop;
+ e.pageX = x;
+ e.pageY = y;
+ e[ 'button' ] = 0;
+ e[ 'timestamp' ] = e[ 'timeStamp' ];
+ e[ 'pointerId' ] = 1;
+ e[ 'pointerType' ] = 'mouse';
+
+ XUI_mousemoveFixOn && X_Timer_remove( XUI_mousemoveFixOn );
+ XUI_mousemoveFixOn = X_Timer_once( 250, XUI_mousemoveFixScrollEnd );
+ XUI_mousemoveFixLast = X_Object_copy( e );
+ };
+ };
+
e = X_Object_copy( e );
e.type = type;
- // TODO capture は pointer 毎に!
- list = XUI_UINODES_HOVER;
- ( XUI_uinodeTarget = XUI_rootData ).capcher( x, y );
- data = XUI_uinodeTarget;
+ // capture は pointer 毎に!
+ data.capcher( x / font, y / font );
+ data = XUI_uinodeTarget || data;
while( data ){
- _ret = data[ 'dispatch' ]( e, sysOnly );
+ _ret = data[ 'dispatch' ]( e, sysOnly ) || X_CALLBACK_NONE;
ret |= _ret;
if( type < XUI_Event._START_BUBLEUP || ret & X_CALLBACK_STOP_PROPAGATION ){
break;
},
start : function(){
-
-
this.initialize( this.User, this, null, null );
X_Timer_once( 0, this, this.addToView );
},
addToView : function(){
// XUI_xnodeInteractionOverlay の前に追加する!
this.addToParent( X_Node_body );
-
+
XUI_xnodeInteractionOverlay = X_Node_body.create( 'div', {
- 'class' : 'mouse-operation-catcher',
+ 'class' : XUI_mousemoveFix ? 'mouse-operation-catcher-scrollFix' : 'mouse-operation-catcher',
unselectable : 'on'
} );
// hover や rollover rollout のための move イベントの追加
// TODO この切り替えを ViewPort へ
XUI_xnodeIneraction = ( X_UA[ 'IE' ] < 9 ? X_ViewPort_document : X_UA[ 'Opera' ] < 8 ? X_Node_body : X_ViewPort );
- XUI_xnodeIneraction[ 'listen' ]( 'pointermove', X_UI_eventRellay );
+
+ if( XUI_mousemoveFix ){
+ XUI_xnodeInteractionOverlay[ 'listen' ]( [ 'scroll', 'mouseup' ], X_UI_eventRellay )[ 'create' ]( 'div' );
+ } else {
+ XUI_xnodeIneraction[ 'listen' ]( 'pointermove', X_UI_eventRellay );
+ };
if( XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ] ){
++XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ];
},
reserveCalc : function(){
- if( this.calcReserved === false ){
+ if( !this.calcReserved ){
this.calcReserved = true;
X_Timer_once( 0, this, this.calculate );
};
size, font, w, h;
if( ( this[ 'dispatch' ]( { type : XUI_Event.LAYOUT_BEFORE, 'cancelable' : cancelable } ) & X_CALLBACK_PREVENT_DEFAULT ) && cancelable ){
+ console.log( 'Layout のキャンセル' );
return X_CALLBACK_NONE;
};
+ console.log( 'レイアウト開始' );
+
+ XUI_mousemoveFix && XUI_mousemoveFixResetScroll();
+
size = X[ 'ViewPort' ][ 'getSize' ]();
font = X[ 'ViewPort' ][ 'getBaseFontSize' ]();
this.layout.calculate( this, false, 0, 0, size[ 0 ] / font, size[ 1 ] / font );
this.updateLayout();
this.calcReserved = false;
-
- X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, XUI_Root_onViewUpdate );
-
+
+ // size を測りながらレイアウトする結果、アップデートがない場合がある
+ if( X_Node_updateTimerID ){
+ X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, XUI_Root_onViewUpdate );
+ } else {
+ this[ 'asyncDispatch' ]( XUI_Event.LAYOUT_COMPLETE );
+ };
+
return X_CALLBACK_NONE;
},
updateCoursor : function( cursor ){
- },
-
- _remove : function(){
- X_EventDispatcher_unlistenAll( XUI_xnodeInteractionOverlay );
- _Box.prototype._remove.call( this );
}
}
);
};
function XUI_Root_onViewUpdate( e ){
+ console.log( 'レイアウト完了' );
this[ 'dispatch' ]( XUI_Event.LAYOUT_COMPLETE );
};