- /*\r
- * context を明示しない場合、User が context になる!\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
- 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
- root.xnodeInteractiveLayer[ 'listen' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay );\r
- };\r
- };\r
- };\r
- \r
- arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
- if( !f.kind ){\r
- return X_EventDispatcher_listen.call( this, type, this.User, f );\r
- } else\r
- if( f.kind === X_CLOSURE_FUNC_ONLY ){\r
- return X_EventDispatcher_listen.call( this, type, this.User, f.func, f.supplement );\r
- };\r
- return X_EventDispatcher_listen.apply( this, arguments );\r
- },\r
- unlisten : function( type, arg1, arg2, arg3 ){\r
- var root, events, i, ev, counter, f;\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 ){\r
- events.split( i, 1 );\r
- return this;\r
- };\r
- }; \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
- if( !counter[ type ] ) return this;\r
- --counter[ type ];\r
- if( counter[ type ] === 0 ){\r
- root.xnodeInteractiveLayer[ 'unlisten' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay );\r
- delete counter[ type ];\r
- };\r
- };\r
- };\r
- arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
- if( !f.kind ){\r
- return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f ] );\r
- } else\r
- if( f.kind === X_CLOSURE_FUNC_ONLY ){\r
- return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f.func, f.supplement ] );\r
- };\r
- return X_EventDispatcher_unlisten.apply( this, arguments );\r
- },\r