X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F20_PageRoot.js;h=915ec07dc2e6dcd155f2e0aeeb063c051bfd418d;hb=a130cabd01fde8865990a59d849f5d5d08ed2119;hp=fd84be3460640a173ca7fa55500e07de7980744e;hpb=9e30a8480de03f0b36d2411a0ecb7f1d0f47b61f;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/20_PageRoot.js b/0.6.x/js/20_ui/20_PageRoot.js index fd84be3..915ec07 100644 --- a/0.6.x/js/20_ui/20_PageRoot.js +++ b/0.6.x/js/20_ui/20_PageRoot.js @@ -1,35 +1,37 @@ +var X_UI_rootData = null, + X_UI_eventBusy = false; -X.UI._eventRellay = function( e ){ +function X_UI_eventRellay( e ){ var font = X.ViewPort.getBaseFontSize(), x = e.clientX / font, y = e.clientY / font, type = X.UI.Event.NameToID[ e.type ], i = 0, - data = X.UI.currentRootData, + data = X_UI_rootData, sysOnly = false, ret = X.Callback.NONE, list, parent, _ret; // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止 - if( !data || data._eventBusy ) return ret; + if( !data || X_UI_eventBusy ) return ret; data._eventBusy = true; - if( type !== '' + X.UI.Event._POINTER_MOVE && type !== '' + X.UI.Event._TOUCH_MOVE && type !== '' + X.UI.Event._MOUSE_MOVE ){ + if( type !== '' + X.UI.Event._POINTER_MOVE ){ //console.log( e.type + ' ' + type + ' x:' + x + ', y:' + y ); }; e.type = type; if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Callback.MONOPOLY ){ - delete X.UI.currentRootData._eventBusy; + X_UI_eventBusy = false; return ret | X.Callback.PREVENT_DEFAULT; }; - list = X.UI.currentRootData.hoverList; - ( X.UI.currentRootData.targetNodeData = X.UI.currentRootData ).capcher( x, y ); - data = X.UI.currentRootData.targetNodeData; + list = X_UI_rootData.hoverList; + ( X_UI_rootData.targetNodeData = X_UI_rootData ).capcher( x, y ); + data = X_UI_rootData.targetNodeData; - //data !== X.UI.currentRootData && console.log( data.xnode.text() ); + //data !== X_UI_rootData && console.log( data.xnode.text() ); while( data ){ _ret = data.dispatch( e, sysOnly ); @@ -43,7 +45,7 @@ X.UI._eventRellay = function( e ){ while( parent.parentData && parent === parent.parentData.hitChildData ){ parent = parent.parentData; }; - if( parent !== X.UI.currentRootData ){ + if( parent !== X_UI_rootData ){ data.hoverClassName && data.xnode.removeClass( data.hoverClassName ); data._listeners && data._listeners[ X.UI.Event.POINTER_OUT ] && data.dispatch( e, X.UI.Event.POINTER_OUT, false ); // new Event delete data.hovering; @@ -56,7 +58,7 @@ X.UI._eventRellay = function( e ){ data.hovering = true; }; }; - delete X.UI.currentRootData._eventBusy; + X_UI_eventBusy = false; return ret | X.Callback.PREVENT_DEFAULT; }; @@ -80,21 +82,19 @@ X.UI._PageRoot = X.UI._Box.inherits( eventCounter : null, cursorStyle : null, - _eventBusy : false, - Constructor : function( layout, args ){ this.Super( layout, args ); - if( X_ViewPort_readyState === X.Event.XDOM_READY ){ + if( X_ViewPort_readyState === X_Event.XDOM_READY ){ X.Timer.once( 0, this, this.start ); } else { - X.ViewPort.listenOnce( X.Event.XDOM_READY, this, this.start ); + X.ViewPort.listenOnce( X_Event.XDOM_READY, this, this.start ); }; this.hoverList = []; this.eventCounter = {}; - X.UI.currentRootData = this; + X_UI_rootData = this; }, start : function(){ @@ -114,22 +114,13 @@ X.UI._PageRoot = X.UI._Box.inherits( } ); // hover や rollover rollout のための move イベントの追加 - // mouseout, mouseover - //if( X_UA_HID.POINTER ){ - this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], X.UI._eventRellay ); - if( counter[ X.UI.Event._POINTER_MOVE ] ){ - ++counter[ X.UI.Event._POINTER_MOVE ]; - } else { - counter[ X.UI.Event._POINTER_MOVE ] = 1; - }; - /*} else { - this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._MOUSE_MOVE ], X.UI._eventRellay ); - if( counter[ X.UI.Event._MOUSE_MOVE ] ){ - ++counter[ X.UI.Event._MOUSE_MOVE ]; - } else { - counter[ X.UI.Event._MOUSE_MOVE ] = 1; - }; - };*/ + this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], X_UI_eventRellay ); + if( counter[ X.UI.Event._POINTER_MOVE ] ){ + ++counter[ X.UI.Event._POINTER_MOVE ]; + } else { + counter[ X.UI.Event._POINTER_MOVE ] = 1; + }; + X.Timer.once( 0, this, this.afterAddToView ); }, afterAddToView : function(){ @@ -143,8 +134,8 @@ X.UI._PageRoot = X.UI._Box.inherits( this.calculate(); this.phase = 4; X.ViewPort - .listen( X.Event.VIEW_RESIZED, this, this.calculate ) - .listen( X.Event.BASE_FONT_RESIZED, this, this.calculate ); + .listen( X_Event.VIEW_RESIZED, this, this.calculate ) + .listen( X_Event.BASE_FONT_RESIZED, this, this.calculate ); }, reserveCalc : function(){