OSDN Git Service

Version 0.6.57, fixed NS of X.UI & X.Class for __proto__.
[pettanr/clientJs.git] / 0.6.x / js / ui / 20_PageRoot.js
index d9167ad..11fe1df 100644 (file)
@@ -1,5 +1,5 @@
 
-function eventRellay( e ){
+X.UI._eventRellay = function( e ){
        var x       = e.clientX / X.Dom.baseFontSize,
                y       = e.clientY / X.Dom.baseFontSize,
                type    = X.UI.Event.NameToID[ e.type ],
@@ -8,15 +8,21 @@ function eventRellay( e ){
                sysOnly = false,
                ret     = X.Callback.NONE,
                list, parent, _ret;
-       //if( type !== '' + X.UI.Event._POINTER_MOVE && type !== '' + X.UI.Event._TOUCH_MOVE && type !== '' + X.UI.Event._MOUSE_MOVE ){
-               //console.log( e.type + ' ' + type + ' x:' + x + ', y:' + y );
-       //};
+
+       // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止
+       if( !data || data._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 ){
+       //      console.log( e.type + ' ' + type + ' x:' + x + ', y:' + y );
+       };
        
        e.type = type;
 
-       if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Callback.MONOPOLY ) return ret;
-       
-       if( X.UI.currentRootData === null ) return ret;
+       if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Callback.MONOPOLY ){
+               delete X.UI.currentRootData._eventBusy;
+               return ret;
+       };
        
        list = X.UI.currentRootData.hoverList;
        ( X.UI.currentRootData.targetNodeData = X.UI.currentRootData ).capcher( x, y );
@@ -49,6 +55,7 @@ function eventRellay( e ){
                        data.hovering = true;
                };
        };
+       delete X.UI.currentRootData._eventBusy;
        return ret;
 };
 
@@ -57,7 +64,7 @@ function eventRellay( e ){
  * 背景画像を読み終える onload で活動開始
  */
 
-var _PageRoot = _Box.inherits(
+X.UI._PageRoot = X.UI._Box.inherits(
        '_PageRoot',
        X.Class.FINAL | X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,
        {
@@ -72,6 +79,8 @@ var _PageRoot = _Box.inherits(
                eventCounter          : null,
                cursorStyle           : null,
                
+               _eventBusy            : false,
+               
                Constructor : function( layout, args ){
                        this.SuperConstructor( layout, args );
                        
@@ -96,9 +105,9 @@ var _PageRoot = _Box.inherits(
                        
                        // this.xnodeInteractiveLayer の前に追加する!
 
-                       this.addToParent( X.Dom.Node.root );
+                       this.addToParent( X.Dom.Node._body );
                        
-                       this.xnodeInteractiveLayer = X.Dom.Node.root.create( 'div', {
+                       this.xnodeInteractiveLayer = X.Dom.Node._body.create( 'div', {
                                'class'      : 'mouse-operation-catcher',
                                unselectable : 'on'
                        } );
@@ -106,15 +115,15 @@ var _PageRoot = _Box.inherits(
                        // hover や rollover rollout のための move イベントの追加
                        // X.Dom.Event.activate, X.Dom.Event.deactivate ?
                        // mouseout, mouseover
-                       if( navigator.msPointerEnabled || navigator.pointerEnabled ){
-                               this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], eventRellay );
+                       if( X.Dom.EVENT_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 ], eventRellay );
+                               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 {
@@ -170,9 +179,10 @@ var _PageRoot = _Box.inherits(
        }
 );
 
-var PageRoot = Box.presets(
+X.UI.PageRoot = X.UI.Box.presets(
        'PageRoot',
-       _PageRoot, {
+       X.UI._PageRoot,
+       {
                width  : '100%',
                height : '100%'
        }