OSDN Git Service

Version 0.6.195, add opacity-fix for IE8.
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 06_AbstractUINode.js
index 16f8234..025aac3 100644 (file)
@@ -10,7 +10,6 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                \r
                root              : null,\r
                rootData          : null,\r
-               hoverList         : null,\r
                parent            : null,\r
                parentData        : null,\r
                xnode             : null,\r
@@ -22,11 +21,18 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                \r
                role              : 1,\r
                pointerDisabled   : false,\r
-               hoverClassName    : null,\r
                hovering          : false,\r
                \r
                reserveEvents     : null,\r
-               gesture           : null,\r
+               gestureOptions       : null,\r
+               gestureActivated     : null,\r
+               gestureTypes         : null,\r
+               gestureTriggered     : null,\r
+               gestureCanceled      : null,\r
+               gestureCurrentName   : '',\r
+               gestureStartEvent    : null,\r
+               gestureLastEvent     : null,\r
+               gestureLastMoveEvent : null,\r
 \r
                absoluteX         : 0,\r
                absoluteY         : 0,\r
@@ -336,13 +342,12 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                case 2:\r
                                        \r
                                case 1:\r
-                                       this.xnode[ 'kill' ]();\r
+                                       this.xnode[ 'remove' ]();\r
                                \r
                                        delete this.root;\r
                                        delete this.rootData;\r
                                        delete this.parent;\r
                                        delete this.parentData;\r
-                                       delete this.xnode;\r
                                        \r
                                        delete this.phase;\r
                        };\r
@@ -703,115 +708,16 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        y -= this.boxY;\r
 \r
                        if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){\r
-                               !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this );\r
-                               this.rootData.targetNodeData = this;\r
+                               !this.hovering && ( XUI_UINODES_HOVER[ XUI_UINODES_HOVER.length ] = this );\r
+                               XUI_uinodeTarget = this;\r
                                //console.log( 'hit ' + this.xnode.className() )\r
                                return true;\r
                        };\r
                },\r
                \r
-               /*\r
-                * TODO context を明示しない場合、User が context になる! の処理は User 側へ\r
-                */\r
-               listen : function( type, arg1, arg2, arg3 ){\r
-                       var root, events, counter, f;\r
-                       \r
-                       if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){\r
-                               if( this.phase < 3 ){\r
-                                       if( !( events = this.reserveEvents ) ) this.reserveEvents = events = [];\r
-                                       events[ events.length ] = [ type, arg1, arg2, arg3 ];\r
-                                       return this;\r
-                               };\r
-                               \r
-                               if( this[ 'listening' ]( type, arg1, arg2, arg3 ) ){\r
-                                       console.log( '. listening' )\r
-                                       return this;\r
-                               };\r
-                               \r
-                               if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){\r
-                                       if( !this.gesture ){\r
-                                               this.gesture = new Hammer( this.rootData, this, type );\r
-                                       } else {\r
-                                               this.gesture[ 'listen' ]( type );\r
-                                       };\r
-                               } else {\r
-                                       //console.log( type );\r
-                                       root    = this.rootData;\r
-                                       counter = root.eventCounter;\r
-                                       if( counter[ type ] ){\r
-                                               ++counter[ type ];\r
-                                       } else {\r
-                                               counter[ type ] = 1;                            \r
-                                               XUI_xnodeIneraction[ 'listen' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay );\r
-                                       };\r
-                                       if( type === XUI_Event._POINTER_UP ) console.log( '...    addEvent ' + counter[ type ] );\r
-                               };\r
-                       };\r
-                       \r
-                       return X_EventDispatcher_listen.apply( this, arguments );\r
-               },\r
-               unlisten : function( type, arg1, arg2, arg3 ){\r
-                       var root, events, i, ev, counter;\r
-                       \r
-                       if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){\r
-                               if( this.phase < 3 ){\r
-                                       if( !( events = this.reserveEvents ) ) return this;\r
-                                       for( i = events.length; i; ){\r
-                                               ev = events[ --i ];\r
-                                               if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 && ev[ 3 ] === arg3 ){\r
-                                                       events.split( i, 1 );\r
-                                                       return this;\r
-                                               };\r
-                                       }; \r
-                                       return this;\r
-                               };\r
-\r
-                               if( !this[ 'listening' ]( type, arg1, arg2, arg3 ) ){\r
-                                       return this;\r
-                               };\r
-                               \r
-                               if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){\r
-                                       this.gesture && this.gesture[ 'unlisten' ]( type );\r
-                               } else {\r
-                                       root    = this.rootData;\r
-                                       counter = root.eventCounter;\r
-                                       \r
-                                       if( !counter[ type ] ){\r
-                                               console.log( '... no event ... ' + counter[ type ] );\r
-                                       };\r
-                                       \r
-                                       if( type === XUI_Event._POINTER_UP ) console.log( '... removeEvent ' + counter[ type ] );\r
-                                       \r
-                                       if( counter[ type ] === 1 ){\r
-                                               XUI_xnodeIneraction[ 'unlisten' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay );\r
-                                               counter[ type ] = 0;\r
-                                       } else\r
-                                       if( counter[ type ] ){\r
-                                               --counter[ type ];\r
-                                       };\r
-                               };\r
-                       };\r
-\r
-                       return X_EventDispatcher_unlisten.apply( this, arguments );\r
-               },\r
+               listen : XUI_$UINodeBase_listen,\r
                \r
-               /*\r
-               dispatch : function( e ){\r
-                       //console.log( e.type + ' ' + ( this[ '_listeners' ] && this[ '_listeners' ][ e.type ] ) );\r
-                       var ret  = X_EventDispatcher_dispatch.call( this, e ),\r
-                               type = e.type || e;\r
-                       \r
-                       // TODO captureEvent PointerEvent\r
-                       if( ret & X_CALLBACK_CAPTURE_POINTER ){\r
-                               this.rootData.monopolyNodeData = this;\r
-                               return ret;\r
-                       };\r
-                       if( this.rootData.monopolyNodeData === this ) this.rootData.monopolyNodeData = null;\r
-                       if( XUI_Event._START_BUBLEUP < type && this.parentData && !( ret & X_CALLBACK_STOP_PROPAGATION ) ){\r
-                               return this.parentData[ 'dispatch' ]( e );\r
-                       };\r
-                       return ret;\r
-               }, */\r
+               unlisten : XUI_$UINodeBase_unlisten,\r
                \r
                setItemData : function( itemData ){\r
                        if( this.itemData === itemData ) return;\r
@@ -1103,23 +1009,15 @@ X.UI.AbstractUINode = X_Class_create(
                                                f = list[ i ];\r
                                                switch( f.cbKind ){\r
                                                        case X_CLOSURE_THIS_FUNC :\r
-                                                               if( f.lock ){\r
-                                                                       X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.func, f.supplement );\r
-                                                               } else {\r
-                                                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.func, f.supplement );\r
-                                                               };\r
+                                                               newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.func, f.supplement );\r
                                                                break;\r
                                                        case X_CLOSURE_HANDLEEVENT :\r
-                                                               if( f.lock ){\r
-                                                                       X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.supplement );\r
-                                                               } else {\r
-                                                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.supplement );\r
-                                                               };\r
+                                                               newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.supplement );\r
                                                                break;\r
                                                        /*\r
                                                        case X_CLOSURE_FUNC_ONLY :\r
                                                                if( f.lock ){\r
-                                                                       X_EventDispatcher_systemListen( newNode, type, f.func, f.supplement );\r
+                                                                       newNode[ 'listen' ]( type, f.func, f.supplement );\r
                                                                } else {\r
                                                                        newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.func, f.supplement );\r
                                                                };\r