OSDN Git Service

Version 0.6.54, fix for X.UI.Event.
authoritozyun <itozyun@user.sourceforge.jp>
Thu, 10 Jul 2014 12:27:22 +0000 (21:27 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Thu, 10 Jul 2014 12:27:22 +0000 (21:27 +0900)
0.6.x/js/dom/13_XDomBoxModel.js
0.6.x/js/ui/06_AbstractUINode.js
0.6.x/js/ui/08_Box.js
0.6.x/js/ui/20_PageRoot.js

index 542c324..2fc367a 100644 (file)
@@ -38,6 +38,10 @@ X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){
 \r
        X.Dom.BoxModel.vScrollbarSize = w;\r
        X.Dom.BoxModel.hScrollbarSize = h;\r
+       if( h < 0 ){\r
+               console.log( 'invalid hScrollbarSize: ' + h );\r
+               X.Dom.BoxModel.hScrollbarSize = w;\r
+       };\r
        //\r
        \r
        node.cssText( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' );\r
@@ -55,17 +59,10 @@ X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){
        // border\r
        // margin\r
        // top\r
-       \r
-       node\r
-               //.cssText( 'width:90px;height:90px;overflow:auto;' )\r
-               .html( '<div style="width:100px;height:100px;"></div>' );\r
-               //._startUpdate();\r
-       /*\r
-       X.Dom.BoxModel.vScrollbarSize = 90 - node._rawNode.clientWidth;\r
-       X.Dom.BoxModel.hScrollbarSize = 90 - node._rawNode.clientHeight;*/\r
 \r
        X.Dom.BoxModel.absoluteOffset =\r
                node.cssText( 'position:absolute;top:0;left:0;margin:1px;border:2px solid #000;padding:4px;' )\r
+                       .append( '<div></div>' )\r
                        .firstChild().cssText( 'position:absolute;top:8px;left:8px;margin:16px;border:32px solid #666;padding:64px;' )\r
                        .y();\r
 \r
index 0897a62..20acbe1 100644 (file)
@@ -25,13 +25,6 @@ var _AbstractUINode = X.EventDispatcher.inherits(
                reserveEvents     : null,\r
                gesture           : null,\r
 \r
-               x                 : 0,\r
-               y                 : 0,\r
-               \r
-               t                 : 0, // top\r
-               l                 : 0, // left\r
-               b                 : 0, // bottom\r
-               r                 : 0, // right\r
                absoluteX         : 0,\r
                absoluteY         : 0,\r
                \r
@@ -74,7 +67,6 @@ var _AbstractUINode = X.EventDispatcher.inherits(
                        \r
                        this.root       = root;\r
                        this.rootData   = rootData;\r
-                       this.hoverList  = rootData.hoverList;\r
                        this.parent     = parent;\r
                        this.parentData = parentData;\r
                        //this.xnode      = X.Dom.Node.create( 'div' );\r
@@ -749,11 +741,11 @@ var _AbstractUINode = X.EventDispatcher.inherits(
                capcher : function( x, y ){\r
                        if( this.pointerDisabled ) return false;\r
                        \r
-                       x -= this.x;\r
-                       y -= this.y;\r
+                       x -= this.boxX;\r
+                       y -= this.boxY;\r
 \r
                        if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){\r
-                               !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
+                               !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this );\r
                                this.rootData.targetNodeData = this;\r
                                return true;\r
                        };\r
@@ -951,11 +943,11 @@ var AbstractUINode = X.Class.create(
                },\r
                getX : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X.Class._getPrivate( this ).x;\r
+                       return X.Class._getPrivate( this ).boxX;\r
                },\r
                getY : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X.Class._getPrivate( this ).y;\r
+                       return X.Class._getPrivate( this ).boxY;\r
                },\r
                getAbsoluteX : function(){\r
                        // dirty の場合、rootData.calculate\r
index d85c23f..3ccf225 100644 (file)
@@ -109,7 +109,6 @@ var _Box = _AbstractUINode.inherits(
                                i       = uinodes && uinodes.length;\r
                        this.root       = root;\r
                        this.rootData   = rootData;\r
-                       this.hoverList  = rootData.hoverList;\r
                        this.parent     = parent;\r
                        this.parentData = parentData;\r
                        //this.xnode      = X.Dom.Node.create( 'div' );\r
@@ -164,25 +163,26 @@ var _Box = _AbstractUINode.inherits(
                        var uinodes, child, _x, _y, hit, i;\r
                        if( this.pointerDisabled ) return false;\r
                        delete this.hitChildData;\r
-                       x -= this.x;\r
-                       y -= this.y;\r
-                       if( this.pointerChildren && ( uinodes = this.uinodes ) ){\r
+                       x -= this.boxX;\r
+                       y -= this.boxY;\r
+                       if( this.pointerChildren && ( uinodes = this.uinodes ) && ( i = uinodes.length ) ){\r
                                _x = x - this.scrollingX;\r
                                _y = y - this.scrollingY;\r
-                               for( i = uinodes.length; i; ){\r
+                               for( ; i; ){\r
                                        child = uinodes[ --i ];\r
-                                       if( !child.pointerDisabled && child.l <= _x && _x < child.r && child.t <= _y && _y < child.b && child.capcher( _x, _y ) ){\r
-                                               this.hitChildData = child;\r
+                                       if( !child.pointerDisabled && child.boxX <= _x && _x < child.boxX + child.boxWidth && child.boxY <= _y && _y < child.boxY + child.boxHeight ){\r
+                                               !child.hovering && ( child.rootData.hoverList[ child.rootData.hoverList.length ] = child );\r
+                                               this.hitChildData = child.rootData.targetNodeData = child;\r
                                                break;\r
                                        };\r
                                };\r
                        };\r
                        if( this.through ){\r
-                               this.hitChildData && !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
+                               this.hitChildData && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this );\r
                                return !!this.hitChildData;\r
                        };\r
                        hit = 0 <= x && x < this.w && 0 <= y && y < this.h;\r
-                       ( this.hitChildData || hit ) && !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
+                       ( this.hitChildData || hit ) && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this );\r
                        if( hit && this.hitChildData === null ) this.rootData.targetNodeData = this;\r
                        return hit || !!this.hitChildData;\r
                },\r
index ad23050..90b799e 100644 (file)
@@ -6,7 +6,8 @@ function eventRellay( e ){
                i       = 0,
                data    = X.UI.currentRootData,
                sysOnly = false,
-               list, ret, parent;
+               ret     = X.Callback.NONE,
+               list, parent, _ret;
        if( type !== X.UI.Event._POINTER_MOVE && type !== X.UI.Event._MOUSE_MOVE ){
                //console.log( type + ' x:' + x + ', y:' + y )
        };
@@ -14,16 +15,18 @@ function eventRellay( e ){
        e.type = type;
 
        if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Callback.MONOPOLY ) return ret;
-       if( X.UI.currentRootData === null ) return;
+       
+       if( X.UI.currentRootData === null ) return ret;
+       
        list = X.UI.currentRootData.hoverList;
        data = X.UI.currentRootData.targetNodeData = X.UI.currentRootData;
        data.capcher( x, y );
        data = X.UI.currentRootData.targetNodeData;
-       //console.log( 'absX: ' + data.absoluteX + ', absY:' + data.absoluteY )
-       // data.apiuser.updateCoursor( data.targetNodeData._cursor );
+
        while( data ){
-               ret = data.dispatch( e, sysOnly );
-               if( ret & X.Callback.MONOPOLY || ret & X.Callback.STOP_PROPAGATION || ret & X.Callback.STOP_NOW ) break; // sysOnly = true;
+               _ret = data.dispatch( e, sysOnly );
+               ret |= _ret;
+               if( _ret & X.Callback.MONOPOLY || _ret & X.Callback.STOP_PROPAGATION || _ret & X.Callback.STOP_NOW ) break; // sysOnly = true;
                data = data.parentData;
        };
        
@@ -45,7 +48,7 @@ function eventRellay( e ){
                        data.hovering = true;
                };
        };
-       return false;
+       return ret;
 };
 
 /*