From: itozyun Date: Wed, 11 Nov 2015 03:11:02 +0000 (+0900) Subject: bug fixes superCall, merge X.UI.Gesture to X.UI.AbstructUINode. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=54eba266c29baf743f6ac67942a2788cd697b12d bug fixes superCall, merge X.UI.Gesture to X.UI.AbstructUINode. --- diff --git a/0.6.x/js/01_core/13_XClass.js b/0.6.x/js/01_core/13_XClass.js index dc1166b..072bc2c 100644 --- a/0.6.x/js/01_core/13_XClass.js +++ b/0.6.x/js/01_core/13_XClass.js @@ -20,8 +20,6 @@ var X_Class_CLASS_LIST = [], X_Class_DEF_LIST = [], - X_Class_CALLING_SUPER = [], - X_Class_CALL_SUPER_STACK = [], X_Class_SUPER_CALLER = [], X_Class_SUPER_STACKS = [], X_Class_traits = null, @@ -133,35 +131,45 @@ X_Class_CommonMethods = 'Super' : function( var_args ){ var me = this, sClass = me, - i = X_Class_CALLING_SUPER.indexOf( me ), - l, sList, def, sConst, ret; + i = X_Class_SUPER_CALLER.indexOf( me ), + stack, t, def, ret; if( i === -1 ){ - X_Class_CALLING_SUPER[ l = X_Class_CALLING_SUPER.length ] = me; - X_Class_CALL_SUPER_STACK[ l ] = sList = []; - def = X_Class_getClassDef( me ); - if( !def.Constructor ) sClass = def.SuperClass;// 現在のクラスがコンストラクタを持たない場合 SuperConstructor を new で呼んでいるため再び呼ばないようにする + X_Class_SUPER_CALLER[ i = X_Class_SUPER_CALLER.length ] = me; + X_Class_SUPER_STACKS[ i ] = stack = 0; } else { - sList = X_Class_CALL_SUPER_STACK[ i ]; + stack = X_Class_SUPER_STACKS[ i ]; }; + t = stack; + + while( t ){ + sClass = X_Class_getClassDef( sClass ).SuperClass; + --t; + }; + while( sClass ){ + ++t; + sClass = X_Class_getClassDef( sClass ).SuperClass; + if( !sClass ) break; def = X_Class_getClassDef( sClass ); - sClass = def.SuperClass; - sConst = def.SuperConstructor; - if( !sConst ) break; - if( sList.indexOf( sConst ) === -1 ){ - sList[ sList.length ] = sConst; - ret = sConst.apply( me, arguments ); - --sList.length; - if( !sList.length ){ - X_Class_CALLING_SUPER.splice( i, 1 ); - X_Class_CALL_SUPER_STACK.splice( i, 1 ); - }; - return ret || me; + + if( def.Constructor ){ + X_Class_SUPER_STACKS[ i ] += t; + ret = def.Constructor.apply( me, arguments ); + break; }; }; - console.log( 'スーパークラスのコンストラクタが見つかりません' ); + + if( X_Class_SUPER_STACKS[ i ] === stack ) console.log( 'スーパークラス、またはスーパークラスのコンストラクタは存在しません' ); + + if( stack === 0 ){ + X_Class_SUPER_CALLER.splice( i, 1 ); + X_Class_SUPER_STACKS.splice( i, 1 ); + } else { + X_Class_SUPER_STACKS[ i ] = stack; + }; + return ret || me; }, /** @@ -193,7 +201,7 @@ X_Class_CommonMethods = i = X_Class_SUPER_CALLER.indexOf( me ), l, d, ret, args = arguments, - name, p, sFunc, hit; + name, p, sFunc; if( X_Type_isFunction( myFunc ) ){ for( p in proto ){ @@ -208,67 +216,61 @@ X_Class_CommonMethods = }; if( i === -1 ){ - X_Class_SUPER_CALLER[ l = X_Class_SUPER_CALLER.length ] = me; - X_Class_SUPER_STACKS[ l ] = d = {}; + X_Class_SUPER_CALLER[ i = X_Class_SUPER_CALLER.length ] = me; + X_Class_SUPER_STACKS[ i ] = stack = 0; } else { - d = X_Class_SUPER_STACKS[ i ]; - }; - - if( stack = d[ name ] ){ - myFunc = stack[ stack.length - 1 ]; - } else { - stack = d[ name ] = []; + stack = X_Class_SUPER_STACKS[ i ]; }; - /* + t = stack; + while( t ){ sClass = X_Class_getClassDef( sClass ).SuperClass; --t; }; - mysFunc = sClass.prototype[ name ]; */ - - - // TODO - while( sClass ){ - sFunc = sClass.prototype[ name ]; - - if( !hit && sFunc === myFunc ){ - hit = true; // 現在の関数にヒット, さらにスーパークラスを辿って同名のプロパティの関数が現れたらそれが目指すもの - } else - if( hit && sFunc !== myFunc /* X_Object_own( name, sClass.prototype ) */ ){ - // this の関数と異なり、値が設定されていたら、今は手を抜いて undef か?見ている、正しくは hasOwnProperty - if( X_Type_isFunction( sFunc ) ){ - stack[ stack.length ] = sFunc; - switch( args.length ){ - case 0 : - ret = sFunc.call( me ); - break; - case 1 : - ret = sFunc.call( me, args[ 0 ] ); - break; - case 2 : - ret = sFunc.call( me, args[ 0 ], args[ 1 ] ); - break; - case 3 : - ret = sFunc.call( me, args[ 0 ], args[ 1 ], args[ 2 ] ); - break; - default : - args = X_Array_copy( args ); - args.shift(); - ret = sFunc.apply( me, args ); - break; + + if( sClass ){ + myFunc = sClass.prototype[ name ]; + + while( sClass ){ + ++t; + sClass = X_Class_getClassDef( sClass ).SuperClass; + sFunc = sClass.prototype[ name ]; + + if( sFunc !== myFunc /* X_Object_own( name, sClass.prototype ) */ ){ + // this の関数と異なり、値が設定されていたら、今は手を抜いて undef か?見ている、正しくは hasOwnProperty + if( X_Type_isFunction( sFunc ) ){ + X_Class_SUPER_STACKS[ i ] += t; + switch( args.length ){ + case 0 : + ret = sFunc.call( me ); + break; + case 1 : + ret = sFunc.call( me, args[ 0 ] ); + break; + case 2 : + ret = sFunc.call( me, args[ 0 ], args[ 1 ] ); + break; + case 3 : + ret = sFunc.call( me, args[ 0 ], args[ 1 ], args[ 2 ] ); + break; + default : + args = X_Array_copy( args ); + args.shift(); + ret = sFunc.apply( me, args ); + break; + }; }; - --stack.length; + break; }; - break; }; - sClass = X_Class_getClassDef( sClass ).SuperClass; }; - - if( !stack.length ) delete d[ name ]; - if( X_Object_isEmpty( d ) ){ - X_Class_SUPER_CALLER.splice( l, 1 ); - X_Class_SUPER_STACKS.splice( l, 1 ); + + if( stack === 0 ){ + X_Class_SUPER_CALLER.splice( i, 1 ); + X_Class_SUPER_STACKS.splice( i, 1 ); + } else { + X_Class_SUPER_STACKS[ i ] = stack; }; return ret; }, @@ -610,8 +612,8 @@ function X_Class_inherits( /* displayName, classSetting, props */ ){ def = X_Class_getClassDef( klass ); // 継承用プロパティを控える def.SuperClass = Super; - def.SuperProto = Super.prototype; - def.SuperConstructor = superDef.Constructor || superDef.SuperConstructor; + //def.SuperProto = Super.prototype; + //def.SuperConstructor = superDef.Constructor || superDef.SuperConstructor; return klass; }; @@ -645,8 +647,7 @@ function X_Class_actualConstructor( f, args ){ obj = def.Constructor ? def.Constructor.apply( instance, args ) : - def.SuperConstructor && - def.SuperConstructor.apply( instance, args ); + instance[ 'Super' ].apply( instance, args ); if( obj !== instance && ( X_Type_isObject( obj ) || X_Type_isFunction( obj ) ) ){ // Class instance[ 'kill' ](); diff --git a/0.6.x/js/07_audio/01_XWebAudio.js b/0.6.x/js/07_audio/01_XWebAudio.js index fb43240..292b6b4 100644 --- a/0.6.x/js/07_audio/01_XWebAudio.js +++ b/0.6.x/js/07_audio/01_XWebAudio.js @@ -88,7 +88,7 @@ var X_WebAudio_context = // 4s 以下ではない iPad 2G または iPad mi //!X_UA[ 'Blink' ] && // Firefox40.0.5 + Windows8 で音声が途中から鳴らなくなる // Firefox41.0.1 + Windows8 で音声が途中から鳴らなくなる - !( 40 <= X_UA[ 'Gecko' ] && X_UA[ 'Gecko' ] < 42 && X_UA[ 'Windows' ] ) && + !( 40 <= X_UA[ 'Gecko' ] && X_UA[ 'Gecko' ] < 43 && X_UA[ 'Windows' ] ) && ( window[ 'AudioContext' ] || window[ 'webkitAudioContext' ] ), X_WebAudio_BUFFER_LIST = [], X_WebAudio_need1stTouch = X_UA[ 'iOS' ], diff --git a/0.6.x/js/20_ui/05_XUI_Gesture.js b/0.6.x/js/20_ui/05_XUI_Gesture.js index f8b9535..f22672f 100644 --- a/0.6.x/js/20_ui/05_XUI_Gesture.js +++ b/0.6.x/js/20_ui/05_XUI_Gesture.js @@ -132,86 +132,122 @@ var XUI_Gesture_POINTERS = {}, XUI_Gesture_CAPTURED = {}, XUI_Gesture_DEFAULTS = {}; -// AbstractUINode に移動 -var XUI_Gesture = Hammer = X_Class_create( - 'X.UI.Gesture', - X_Class.NONE, - { - uinodeRoot : null, - uinode : null, - options : null, - - activated : null, - types : null, - - triggered : null, - canceled : null, - - currentName : '', - startEvent : null, - lastEvent : null, - lastMoveEvent : null, - - 'Constructor' : function( uinodeRoot, uinode, type, opt_options ){ - this.uinodeRoot = uinodeRoot; - this.uinode = uinode; - this.options = X_Object_override( X_Object_copy( XUI_Gesture_DEFAULTS ), opt_options ); - - this.triggered = {}; - this.canceled = {}; +function XUI_Gesture_trigger( uinode, type, hammerEvent ){ + if( !uinode.gestureTypes[ type ] ) return X_CALLBACK_NONE; + hammerEvent = X_Object_copy( hammerEvent ); + hammerEvent.type = type; + return uinode[ 'dispatch' ]( hammerEvent ) || X_CALLBACK_NONE; +}; - uinode[ 'listen' ]( XUI_Event._POINTER_DOWN, this, XUI_Gesture_handleEvent ); - - this[ 'listen' ]( type ); - }, +function XUI_$UINodeBase_listen( type, arg1, arg2, arg3 ){ + var events, gestures, i, g; + + if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){ + if( this.phase < 3 ){ + if( !( events = this.reserveEvents ) ) this.reserveEvents = events = []; + events[ events.length ] = [ type, arg1, arg2, arg3 ]; + return this; + }; - trigger : function( type, gesture ){ - var e; - - if( !this.types[ type ] ) return X_CALLBACK_NONE; - e = X_Object_copy( gesture ); - e.type = type; - return this.uinode[ 'dispatch' ]( e ) || X_CALLBACK_NONE; - }, + if( this[ 'listening' ]( type, arg1, arg2, arg3 ) ){ + return this; + }; - listen : function( type ){ - var gestures = XUI_Gesture_LIST, - i = gestures.length, g; - - for( ; i; ){ + if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){ + gestures = XUI_Gesture_LIST; + for( i = gestures.length; i; ){ g = gestures[ --i ]; if( g.startID <= type && type <= g.endID ){ - if( !this.activated ) this.activated = {}; - if( !this.types ) this.types = {}; - this.activated[ g.name ] = this.types[ type ] = 1; + if( !this.gestureActivated ){ + this.gestureOptions = XUI_Gesture_DEFAULTS; //X_Object_override( X_Object_copy( XUI_Gesture_DEFAULTS ), opt_options ); + this.gestureActivated = {}; + this.gestureTypes = {}; + this.gestureTriggered = {}; + this.gestureCanceled = {}; + }; + if( X_Object_isEmpty( this.gestureActivated ) ){ + this[ 'listen' ]( XUI_Event._POINTER_DOWN, this, XUI_Gesture_handleEvent ); + }; + this.gestureActivated[ g.name ] = this.gestureTypes[ type ] = true; break; }; }; - }, - - unlisten : function( type ){ - var gestures = XUI_Gesture_LIST, - i = gestures.length, - active = this.activated, g; + } else + if( XUI_EVENT_COUNTER[ type ] ){ + ++XUI_EVENT_COUNTER[ type ]; + } else { + XUI_EVENT_COUNTER[ type ] = 1; + XUI_xnodeIneraction[ 'listen' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay ); + }; + }; + + return X_EventDispatcher_listen.apply( this, arguments ); +}; - if( !active ) return; - for( ; i; ){ - g = gestures[ --i ]; - if( g.startID <= type && type <= g.endID ){ - if( active[ g.name ] ){ - if( this.types[ type ] ) delete this.types[ type ]; - for( i = g.startID; i <= g.endID; ++i ){ - if( this.types[ i ] ) return; +function XUI_$UINodeBase_unlisten( type, arg1, arg2, arg3 ){ + var events, i, ev, gestures, active, g, f; + + if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){ + if( this.phase < 3 ){ + if( !( events = this.reserveEvents ) ) return this; + for( i = events.length; i; ){ + ev = events[ --i ]; + if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 && ev[ 3 ] === arg3 ){ + events.split( i, 1 ); + return this; + }; + }; + return this; + }; + + if( !this[ 'listening' ]( type, arg1, arg2, arg3 ) ){ + return this; + }; + + if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){ + if( active = this.gestureActivated ){ + gestures = XUI_Gesture_LIST; + for( i = gestures.length ; i; ){ + g = gestures[ --i ]; + if( g.startID <= type && type <= g.endID ){ + if( active[ g.name ] ){ + if( this.gestureTypes[ type ] ) delete this.gestureTypes[ type ]; + for( i = g.startID; i <= g.endID; ++i ){ + if( this.gestureTypes[ i ] ){ + f = true; + break; + }; + }; + if( !f ){ + delete active[ g.name ]; + + if( X_Object_isEmpty( active ) ){ + this[ 'unlisten' ]( XUI_Event._POINTER_DOWN, this, XUI_Gesture_handleEvent ); + //delete this.gestureTriggered; + //delete this.gestureCanceled; + //delete this.gestureTypes; + //delete this.gestureActivated; + }; + }; }; - delete active[ g.name ]; + break; }; - break; - }; + }; }; - } - } -); + } else { + if( XUI_EVENT_COUNTER[ type ] === 1 ){ + XUI_xnodeIneraction[ 'unlisten' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay ); + XUI_EVENT_COUNTER[ type ] = 0; + } else + if( XUI_EVENT_COUNTER[ type ] ){ + --XUI_EVENT_COUNTER[ type ]; + }; + }; + }; + + return X_EventDispatcher_unlisten.apply( this, arguments ); +}; function XUI_Gesture_handleEvent( e ){ var gestures = XUI_Gesture_LIST, @@ -226,9 +262,9 @@ function XUI_Gesture_handleEvent( e ){ i, p, l, j, captured, ret, activated, gesture, startEv, deltaTime, deltaX, deltaY, velocity, center, startCenter; - if( !isStart && !hammer.startEvent ) return; + if( !isStart && !hammer.gestureStartEvent ) return; -if( type === XUI_Event.POINTER_OUT ) console.log( 'canceled ...' + e.button ) +if( type === XUI_Event.POINTER_OUT ) console.log( 'gestureCanceled ...' + e.button ) if( isEnd ){ if( XUI_Gesture_POINTERS[ uid ] ){ @@ -263,19 +299,19 @@ if( type === XUI_Event.POINTER_OUT ) console.log( 'canceled ...' + e.button ) // because touchend has no touches, and we often want to use these in our gestures, // we send the last move event as our eventData in touchend - ( isEnd && hammer.lastMoveEvent ) ? ( e = hammer.lastMoveEvent ) : ( hammer.lastMoveEvent = e ); // store the last move event + ( isEnd && hammer.gestureLastMoveEvent ) ? ( e = hammer.gestureLastMoveEvent ) : ( hammer.gestureLastMoveEvent = e ); // store the last move event hammerEvent = X_Object_copy( e ); hammerEvent.touches = touches; - if( isStart && !hammer.startEvent ){ + if( isStart && !hammer.gestureStartEvent ){ console.log( '=- add -=' ); // already busy with a Hammer.gesture detection on an element - hammer.startEvent = hammerEvent; - hammer.uinodeRoot[ 'listen' ]( [ XUI_Event._POINTER_MOVE, XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL, XUI_Event.POINTER_OUT ], hammer, XUI_Gesture_handleEvent ); + hammer.gestureStartEvent = hammerEvent; + XUI_rootData[ 'listen' ]( [ XUI_Event._POINTER_MOVE, XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL, XUI_Event.POINTER_OUT ], hammer, XUI_Gesture_handleEvent ); }; - startEv = hammer.startEvent; + startEv = hammer.gestureStartEvent; // if the touches change, set the new touches over the startEvent touches @@ -317,18 +353,18 @@ if( type === XUI_Event.POINTER_OUT ) console.log( 'canceled ...' + e.button ) scale : XUI_GestureUtils.getScale( startEv.touches, touches ), rotation : XUI_GestureUtils.getRotation( startEv.touches, touches ), - startEvent : startEv + gestureStartEvent : startEv }); // store as previous event event - hammer.lastEvent = hammerEvent; - activated = hammer.activated; + hammer.gestureLastEvent = hammerEvent; + activated = hammer.gestureActivated; console.log( '... ' ); // call Hammer.gesture handlers for( i = 0, l = gestures.length; i < l; ++i ){ gesture = gestures[ i ]; - if( activated[ gesture.name ] && !hammer.canceled[ gesture.name ] ){ + if( activated[ gesture.name ] && !hammer.gestureCanceled[ gesture.name ] ){ ( console.log( '... ' + i + ' ' + gesture.name ) ); // if a handler returns false, we stop with the detection ( ret |= ( gesture.handler( hammerEvent, hammer ) || X_CALLBACK_NONE ) ); @@ -363,22 +399,22 @@ if( type === XUI_Event.POINTER_OUT ) console.log( 'canceled ...' + e.button ) if( isEnd ){ console.log( '=- clear -=' ); - hammer.uinodeRoot[ 'unlisten' ]( [ XUI_Event._POINTER_MOVE, XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL, XUI_Event.POINTER_OUT ], hammer, XUI_Gesture_handleEvent ); + XUI_rootData[ 'unlisten' ]( [ XUI_Event._POINTER_MOVE, XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL, XUI_Event.POINTER_OUT ], hammer, XUI_Gesture_handleEvent ); hammer.previous = { - currentName : hammer.currentName, - startEvent : hammer.startEvent, - lastEvent : hammer.lastEvent, - lastMoveEvent : hammer.lastMoveEvent + gestureCurrentName : hammer.gestureCurrentName, + gestureStartEvent : hammer.gestureStartEvent, + gestureLastEvent : hammer.gestureLastEvent, + gestureLastMoveEvent : hammer.gestureLastMoveEvent }; - X_Object_clear( hammer.triggered ); - X_Object_clear( hammer.canceled ); + X_Object_clear( hammer.gestureTriggered ); + X_Object_clear( hammer.gestureCanceled ); - delete hammer.currentName; - delete hammer.startEvent; - delete hammer.lastEvent; - delete hammer.lastMoveEvent; + delete hammer.gestureCurrentName; + delete hammer.gestureStartEvent; + delete hammer.gestureLastEvent; + delete hammer.gestureLastMoveEvent; ret |= X_CALLBACK_RELEASE_POINTER; }; @@ -409,13 +445,13 @@ var XUI_Gesture_LIST = [ prevent_mouseevents : false }, handler : function( e, hammer ){ - if( hammer.options.prevent_mouseevents && e[ 'pointerType' ] === 'mouse' ){ + if( hammer.gestureOptions.prevent_mouseevents && e[ 'pointerType' ] === 'mouse' ){ return X_CALLBACK_STOP_NOW; }; - //hammer.options.prevent_default && e.preventDefault(); + //hammer.gestureOptions.prevent_default && e.preventDefault(); - return e.type === XUI_Event._POINTER_DOWN && hammer.trigger( XUI_Event.TOUCH, e ); + return e.type === XUI_Event._POINTER_DOWN && XUI_Gesture_trigger( hammer, XUI_Event.TOUCH, e ); } }, @@ -445,9 +481,9 @@ var XUI_Gesture_LIST = [ // current gesture isnt drag, but dragged is true // this means an other gesture is busy. now call dragend - if( hammer.currentName !== transform.name && hammer.triggered[ transform.name ] ){ - ret = hammer.trigger( XUI_Event.TRANSFORM_END, e ); - delete hammer.triggered[ transform.name ]; + if( hammer.gestureCurrentName !== transform.name && hammer.gestureTriggered[ transform.name ] ){ + ret = XUI_Gesture_trigger( hammer, XUI_Event.TRANSFORM_END, e ); + delete hammer.gestureTriggered[ transform.name ]; return ret; }; @@ -455,11 +491,11 @@ var XUI_Gesture_LIST = [ if( e.touches.length < 2 ) return; // prevent default when two fingers are on the screen - //hammer.options.transform_always_block && e.preventDefault(); + //hammer.gestureOptions.transform_always_block && e.preventDefault(); switch( e.type ){ case XUI_Event._POINTER_DOWN : - //hammer.triggered[ transform.name ] = false; + //hammer.gestureTriggered[ transform.name ] = false; break; case XUI_Event._POINTER_MOVE: @@ -468,34 +504,34 @@ var XUI_Gesture_LIST = [ // when the distance we moved is too small we skip this gesture // or we can be already in dragging - if( scale_threshold < hammer.options.transform_min_scale && rotation_threshold < hammer.options.transform_min_rotation ) return; + if( scale_threshold < hammer.gestureOptions.transform_min_scale && rotation_threshold < hammer.gestureOptions.transform_min_rotation ) return; // we are transforming! - hammer.currentName = transform.name; + hammer.gestureCurrentName = transform.name; // first time, trigger dragstart event - if( !hammer.triggered[ transform.name ] ){ - ret = hammer.trigger( XUI_Event.TRANSFORM_START, e ); + if( !hammer.gestureTriggered[ transform.name ] ){ + ret = XUI_Gesture_trigger( hammer, XUI_Event.TRANSFORM_START, e ); if( ret & X_CALLBACK_PREVENT_DEFAULT ){ - hammer.canceled[ transform.name ] = true; + hammer.gestureCanceled[ transform.name ] = true; break; }; - hammer.triggered[ transform.name ] = true; + hammer.gestureTriggered[ transform.name ] = true; break; }; - ret |= hammer.trigger( XUI_Event.TRANSFORM, e ); + ret |= XUI_Gesture_trigger( hammer, XUI_Event.TRANSFORM, e ); // basic transform event // trigger rotate event - if( hammer.options.transform_min_rotation < rotation_threshold ){ - ret |= hammer.trigger( XUI_Event.ROTATE, e ); + if( hammer.gestureOptions.transform_min_rotation < rotation_threshold ){ + ret |= XUI_Gesture_trigger( hammer, XUI_Event.ROTATE, e ); }; // trigger pinch event - if( scale_threshold > hammer.options.transform_min_scale ){ - ret |= hammer.trigger( XUI_Event.PINCH, e ); - ret |= hammer.trigger( e.scale < 1 ? XUI_Event.PINCH_IN : XUI_Event.PINCH_OUT, e ); + if( scale_threshold > hammer.gestureOptions.transform_min_scale ){ + ret |= XUI_Gesture_trigger( hammer, XUI_Event.PINCH, e ); + ret |= XUI_Gesture_trigger( hammer, e.scale < 1 ? XUI_Event.PINCH_IN : XUI_Event.PINCH_OUT, e ); }; break; @@ -503,8 +539,8 @@ var XUI_Gesture_LIST = [ case XUI_Event._POINTER_CANCEL : case XUI_Event._POINTER_UP : // trigger dragend - ret = hammer.triggered[ transform.name ] && hammer.trigger( XUI_Event.TRANSFORM_END, e ); - hammer.triggered[ transform.name ] = false; + ret = hammer.gestureTriggered[ transform.name ] && XUI_Gesture_trigger( hammer, XUI_Event.TRANSFORM_END, e ); + hammer.gestureTriggered[ transform.name ] = false; break; }; return ret; @@ -546,33 +582,33 @@ var XUI_Gesture_LIST = [ // current gesture isnt drag, but dragged is true // this means an other gesture is busy. now call dragend - if( hammer.currentName !== drag.name && hammer.triggered[ drag.name ] ){ - ret = hammer.trigger( XUI_Event.DRAG_END, e ); - hammer.triggered[ drag.name ] = false; + if( hammer.gestureCurrentName !== drag.name && hammer.gestureTriggered[ drag.name ] ){ + ret = XUI_Gesture_trigger( hammer, XUI_Event.DRAG_END, e ); + hammer.gestureTriggered[ drag.name ] = false; return ret; }; // max touches - if( 0 < hammer.options.drag_max_touches && hammer.options.drag_max_touches < e.touches.length ) return; + if( 0 < hammer.gestureOptions.drag_max_touches && hammer.gestureOptions.drag_max_touches < e.touches.length ) return; switch( e.type ){ case XUI_Event._POINTER_DOWN : - hammer.triggered[ drag.name ] = false; + hammer.gestureTriggered[ drag.name ] = false; break; case XUI_Event._POINTER_MOVE : // when the distance we moved is too small we skip this gesture // or we can be already in dragging - if( e.distance < hammer.options.drag_min_distance && hammer.currentName !== drag.name ) return; + if( e.distance < hammer.gestureOptions.drag_min_distance && hammer.gestureCurrentName !== drag.name ) return; // we are dragging! - hammer.currentName = drag.name; + hammer.gestureCurrentName = drag.name; // lock drag to axis? - if( hammer.lastEvent.drag_locked_to_axis || ( hammer.options.drag_lock_to_axis && hammer.options.drag_lock_min_distance <= e.distance ) ){ + if( hammer.gestureLastEvent.drag_locked_to_axis || ( hammer.gestureOptions.drag_lock_to_axis && hammer.gestureOptions.drag_lock_min_distance <= e.distance ) ){ e.drag_locked_to_axis = true; }; - last_direction = hammer.lastEvent.direction; + last_direction = hammer.gestureLastEvent.direction; if( e.drag_locked_to_axis && last_direction !== e.direction ){ // keep direction on the axis that the drag gesture started on e.direction = XUI_GestureUtils.isVertical( last_direction ) ? @@ -583,24 +619,24 @@ var XUI_Gesture_LIST = [ ret = X_CALLBACK_NONE; // first time, trigger dragstart event - if( !hammer.triggered[ drag.name ] ){ - ret = hammer.trigger( XUI_Event.DRAG_START, e ); + if( !hammer.gestureTriggered[ drag.name ] ){ + ret = XUI_Gesture_trigger( hammer, XUI_Event.DRAG_START, e ); //if( ret & X_CALLBACK_PREVENT_DEFAULT ){ - // hammer.canceled[ drag.name ] = true; + // hammer.gestureCanceled[ drag.name ] = true; // break; //}; ret |= X_CALLBACK_CAPTURE_POINTER; console.log( '----- drag start ....' + e.type ); - hammer.triggered[ drag.name ] = true; + hammer.gestureTriggered[ drag.name ] = true; break; }; //console.log( '----- drag ....' + e.type ); // trigger normal event - ret = hammer.trigger( XUI_Event.DRAG, e ) | X_CALLBACK_CAPTURE_POINTER; + ret = XUI_Gesture_trigger( hammer, XUI_Event.DRAG, e ) | X_CALLBACK_CAPTURE_POINTER; // direction event, like dragdown - ret |= hammer.trigger( + ret |= XUI_Gesture_trigger( hammer, e.direction === 'up' ? XUI_Event.DRAG_UP : e.direction === 'down' ? @@ -613,8 +649,8 @@ var XUI_Gesture_LIST = [ // block the browser events /* ( - ( hammer.options.drag_block_vertical && XUI_GestureUtils.isVertical( e.direction ) ) || - ( hammer.options.drag_block_horizontal && !XUI_GestureUtils.isVertical( e.direction ) ) + ( hammer.gestureOptions.drag_block_vertical && XUI_GestureUtils.isVertical( e.direction ) ) || + ( hammer.gestureOptions.drag_block_horizontal && !XUI_GestureUtils.isVertical( e.direction ) ) ) && e.preventDefault(); */ break; @@ -623,10 +659,10 @@ var XUI_Gesture_LIST = [ case XUI_Event._POINTER_CANCEL : case XUI_Event._POINTER_UP: // trigger dragend - if( hammer.triggered[ drag.name ] ){ - ret = hammer.trigger( XUI_Event.DRAG_END, e ) | X_CALLBACK_CAPTURE_POINTER; + if( hammer.gestureTriggered[ drag.name ] ){ + ret = XUI_Gesture_trigger( hammer, XUI_Event.DRAG_END, e ) | X_CALLBACK_CAPTURE_POINTER; console.log( '----- drag end ....' + e.type ); - hammer.triggered[ drag.name ] = false; + hammer.gestureTriggered[ drag.name ] = false; }; break; }; @@ -655,23 +691,23 @@ var XUI_Gesture_LIST = [ // previous gesture, for the double tap since these are two different gesture detections var prev = hammer.previous; - if( e.type === XUI_Event._POINTER_MOVE && hammer.options.tap_max_distance < e.distance ){ - hammer.canceled[ 'tap' ] = true; + if( e.type === XUI_Event._POINTER_MOVE && hammer.gestureOptions.tap_max_distance < e.distance ){ + hammer.gestureCanceled[ 'tap' ] = true; }; if( e.type === XUI_Event._POINTER_UP ){ // when the touchtime is higher then the max touch time // or when the moving distance is too much - if( hammer.options.tap_max_touchtime < e.deltaTime || hammer.options.tap_max_distance < e.distance ) return; + if( hammer.gestureOptions.tap_max_touchtime < e.deltaTime || hammer.gestureOptions.tap_max_distance < e.distance ) return; // check if double tap - if( prev && prev.currentName === 'tap' && ( e.timestamp - prev.lastEvent.timestamp ) < hammer.options.doubletap_interval && e.distance < hammer.options.doubletap_distance ){ - return hammer.trigger( XUI_Event.DOUBLE_TAP, e ); + if( prev && prev.gestureCurrentName === 'tap' && ( e.timestamp - prev.gestureLastEvent.timestamp ) < hammer.gestureOptions.doubletap_interval && e.distance < hammer.gestureOptions.doubletap_distance ){ + return XUI_Gesture_trigger( hammer, XUI_Event.DOUBLE_TAP, e ); } else // do a single tap - if( hammer.options.tap_always ){ - //hammer.currentName = 'tap'; + if( hammer.gestureOptions.tap_always ){ + hammer.gestureCurrentName = 'tap'; console.log( 'tap! ' + e.deltaTime + 'ms ' + e.type ); - return hammer.trigger( XUI_Event.TAP, e ); + return XUI_Gesture_trigger( hammer, XUI_Event.TAP, e ); }; }; } diff --git a/0.6.x/js/20_ui/06_AbstractUINode.js b/0.6.x/js/20_ui/06_AbstractUINode.js index 16f8234..3bd4cf3 100644 --- a/0.6.x/js/20_ui/06_AbstractUINode.js +++ b/0.6.x/js/20_ui/06_AbstractUINode.js @@ -10,7 +10,6 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( root : null, rootData : null, - hoverList : null, parent : null, parentData : null, xnode : null, @@ -22,11 +21,18 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( role : 1, pointerDisabled : false, - hoverClassName : null, hovering : false, reserveEvents : null, - gesture : null, + gestureOptions : null, + gestureActivated : null, + gestureTypes : null, + gestureTriggered : null, + gestureCanceled : null, + gestureCurrentName : '', + gestureStartEvent : null, + gestureLastEvent : null, + gestureLastMoveEvent : null, absoluteX : 0, absoluteY : 0, @@ -703,115 +709,16 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( y -= this.boxY; if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){ - !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this ); - this.rootData.targetNodeData = this; + !this.hovering && ( XUI_UINODES_HOVER[ XUI_UINODES_HOVER.length ] = this ); + XUI_uinodeTarget = this; //console.log( 'hit ' + this.xnode.className() ) return true; }; }, - /* - * TODO context を明示しない場合、User が context になる! の処理は User 側へ - */ - listen : function( type, arg1, arg2, arg3 ){ - var root, events, counter, f; - - if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){ - if( this.phase < 3 ){ - if( !( events = this.reserveEvents ) ) this.reserveEvents = events = []; - events[ events.length ] = [ type, arg1, arg2, arg3 ]; - return this; - }; - - if( this[ 'listening' ]( type, arg1, arg2, arg3 ) ){ - console.log( '. listening' ) - return this; - }; - - if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){ - if( !this.gesture ){ - this.gesture = new Hammer( this.rootData, this, type ); - } else { - this.gesture[ 'listen' ]( type ); - }; - } else { - //console.log( type ); - root = this.rootData; - counter = root.eventCounter; - if( counter[ type ] ){ - ++counter[ type ]; - } else { - counter[ type ] = 1; - XUI_xnodeIneraction[ 'listen' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay ); - }; - if( type === XUI_Event._POINTER_UP ) console.log( '... addEvent ' + counter[ type ] ); - }; - }; - - return X_EventDispatcher_listen.apply( this, arguments ); - }, - unlisten : function( type, arg1, arg2, arg3 ){ - var root, events, i, ev, counter; - - if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){ - if( this.phase < 3 ){ - if( !( events = this.reserveEvents ) ) return this; - for( i = events.length; i; ){ - ev = events[ --i ]; - if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 && ev[ 3 ] === arg3 ){ - events.split( i, 1 ); - return this; - }; - }; - return this; - }; - - if( !this[ 'listening' ]( type, arg1, arg2, arg3 ) ){ - return this; - }; - - if( XUI_Event._START_XUI_EVENT < type && type < XUI_Event._END_XUI_EVENT ){ - this.gesture && this.gesture[ 'unlisten' ]( type ); - } else { - root = this.rootData; - counter = root.eventCounter; - - if( !counter[ type ] ){ - console.log( '... no event ... ' + counter[ type ] ); - }; - - if( type === XUI_Event._POINTER_UP ) console.log( '... removeEvent ' + counter[ type ] ); - - if( counter[ type ] === 1 ){ - XUI_xnodeIneraction[ 'unlisten' ]( XUI_Event.IdToName[ type ], X_UI_eventRellay ); - counter[ type ] = 0; - } else - if( counter[ type ] ){ - --counter[ type ]; - }; - }; - }; - - return X_EventDispatcher_unlisten.apply( this, arguments ); - }, + listen : XUI_$UINodeBase_listen, - /* - dispatch : function( e ){ - //console.log( e.type + ' ' + ( this[ '_listeners' ] && this[ '_listeners' ][ e.type ] ) ); - var ret = X_EventDispatcher_dispatch.call( this, e ), - type = e.type || e; - - // TODO captureEvent PointerEvent - if( ret & X_CALLBACK_CAPTURE_POINTER ){ - this.rootData.monopolyNodeData = this; - return ret; - }; - if( this.rootData.monopolyNodeData === this ) this.rootData.monopolyNodeData = null; - if( XUI_Event._START_BUBLEUP < type && this.parentData && !( ret & X_CALLBACK_STOP_PROPAGATION ) ){ - return this.parentData[ 'dispatch' ]( e ); - }; - return ret; - }, */ + unlisten : XUI_$UINodeBase_unlisten, setItemData : function( itemData ){ if( this.itemData === itemData ) return; diff --git a/0.6.x/js/20_ui/08_Box.js b/0.6.x/js/20_ui/08_Box.js index 73e6067..0aa8008 100644 --- a/0.6.x/js/20_ui/08_Box.js +++ b/0.6.x/js/20_ui/08_Box.js @@ -195,13 +195,13 @@ var XUI_Box = XUI_AbstractUINode.inherits( }; }; if( this.through ){ - this.hitChildData && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this ); + this.hitChildData && !this.hovering && ( XUI_UINODES_HOVER[ XUI_UINODES_HOVER.length ] = this ); return !!this.hitChildData; }; hit = 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight; - ( this.hitChildData || hit ) && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this ); + ( this.hitChildData || hit ) && !this.hovering && ( XUI_UINODES_HOVER[ XUI_UINODES_HOVER.length ] = this ); if( hit && this.hitChildData === null ){ - this.rootData.targetNodeData = this; + XUI_uinodeTarget = this; }; return hit || !!this.hitChildData; }, diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 323b95b..7574493 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -156,7 +156,7 @@ var XUI_ScrollBox = XUI_ChromeBox.inherits( this.lastBoxWidth !== this.boxWidth || this.lastBoxHeight !== this.boxHeight ){ console.log( 'scroll - calc' ); - X_UI_rootData[ 'listenOnce' ]( XUI_Event.LAYOUT_COMPLETE, this, X_UI_ScrollBox_onLayoutComplete ); + XUI_rootData[ 'listenOnce' ]( XUI_Event.LAYOUT_COMPLETE, this, X_UI_ScrollBox_onLayoutComplete ); }; }, @@ -184,7 +184,7 @@ var XUI_ScrollBox = XUI_ChromeBox.inherits( function X_UI_ScrollBox_onLayoutBefore( e ){ if( e[ 'cancelable' ] && this.isInTransition && X_Node_Anime_translateZ ){ - this[ 'listenOnce' ]( XUI_Event.SCROLL_END, X_UI_rootData, X_UI_rootData.calculate ); + this[ 'listenOnce' ]( XUI_Event.SCROLL_END, XUI_rootData, XUI_rootData.calculate ); return X_CALLBACK_PREVENT_DEFAULT; }; this.scrollXRatio = this.scrollX / this.scrollXMax; @@ -229,7 +229,7 @@ function X_UI_ScrollBox_onLayoutComplete( e ){ this[ 'listen' ]( XUI_Event._POINTER_DOWN, this, X_UI_ScrollBox_onStart ) [ 'listen' ]( XUI_Event.DRAG, this, X_UI_ScrollBox_onMove ); this[ 'listen' ]( XUI_Event.DRAG_END, this, X_UI_ScrollBox_onEnd ); - X_UI_rootData[ 'listen' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore ); + XUI_rootData[ 'listen' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore ); X_UI_ScrollBox_translate( this, this.scrollXMax * this.scrollXRatio, this.scrollYMax * this.scrollYRatio, 100, '', 300 ); this.scrolling = true; @@ -241,7 +241,7 @@ function X_UI_ScrollBox_onLayoutComplete( e ){ this[ 'unlisten' ]( XUI_Event._POINTER_DOWN, this, X_UI_ScrollBox_onStart ) [ 'unlisten' ]( XUI_Event.DRAG, this, X_UI_ScrollBox_onMove ); this[ 'unlisten' ]( XUI_Event.DRAG_END, this, X_UI_ScrollBox_onEnd ); - X_UI_rootData[ 'unlisten' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore ); + XUI_rootData[ 'unlisten' ]( XUI_Event.LAYOUT_BEFORE, this, X_UI_ScrollBox_onLayoutBefore ); ( this.scrollX !== 0 || this.scrollY !== 0 ) && X_UI_ScrollBox_translate( this, 0, 0, 100, '', 300 ); diff --git a/0.6.x/js/20_ui/20_Root.js b/0.6.x/js/20_ui/20_Root.js index 237af6a..6339c63 100644 --- a/0.6.x/js/20_ui/20_Root.js +++ b/0.6.x/js/20_ui/20_Root.js @@ -1,5 +1,9 @@ -var X_UI_rootData = null, +var XUI_rootData = null, XUI_xnodeIneraction = null, + XUI_UINODES_HOVER = [], + XUI_EVENT_COUNTER = {}, + XUI_uinodeTarget = null, + XUI_xnodeInteractionOverlay, XUI_interactionBusy = false; function X_UI_eventRellay( e ){ @@ -8,74 +12,57 @@ function X_UI_eventRellay( e ){ y = e.pageY / font, type = XUI_Event.NameToID[ e.type ], i = 0, - data = X_UI_rootData, + data = XUI_rootData, sysOnly = false, ret = X_CALLBACK_NONE, list, parent, _ret, eventIn, eventOut; // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止 if( !data || XUI_interactionBusy ) return ret; - XUI_interactionBusy = true; - - if( type !== XUI_Event._POINTER_MOVE ){ - console.log( data.xnode.className() + '>' + e.type + ' ' + type + ' x:' + x + ', y:' + y ); - //console.dir( data ) - //data !== X_UI_rootData && console.log( ( data.xnode[ 'className' ]() + data.xnode[ 'text' ]() ).substr( 0, 15 ) ); - }; + XUI_interactionBusy = true; + + e = X_Object_copy( e ); e.type = type; // TODO capture は pointer 毎に! + list = XUI_UINODES_HOVER; + ( XUI_uinodeTarget = XUI_rootData ).capcher( x, y ); + data = XUI_uinodeTarget; - - list = X_UI_rootData.hoverList; - ( X_UI_rootData.targetNodeData = X_UI_rootData ).capcher( x, y ); - data = X_UI_rootData.targetNodeData; - - - - - - while( true ){ + while( data ){ _ret = data[ 'dispatch' ]( e, sysOnly ); ret |= _ret; - if( X_UI_rootData !== data && _ret & X_CALLBACK_CAPTURE_POINTER ){ - X_UI_rootData.monopolyNodeData = data; - break; - }; - if( X_UI_rootData.monopolyNodeData === data ) X_UI_rootData.monopolyNodeData = null; if( type < XUI_Event._START_BUBLEUP || ret & X_CALLBACK_STOP_PROPAGATION ){ break; }; - if( !data.parentData ) break; data = data.parentData; - if( type !== XUI_Event._POINTER_MOVE ){ - //data !== X_UI_rootData && console.log( ( data.xnode[ 'className' ]() + data.xnode[ 'text' ]() ).substr( 0, 15 ) ); - }; }; - if( data !== X_UI_rootData ) ret |= X_UI_rootData[ 'dispatch' ]( e, sysOnly ); - eventOut = X_Object_copy( e ); - eventOut.type = XUI_Event.POINTER_OUT; - - eventIn = X_Object_copy( e ); - eventIn.type = XUI_Event.POINTER_IN; - for( i = list.length; i; ){ parent = data = list[ --i ]; while( parent.parentData && parent === parent.parentData.hitChildData ){ parent = parent.parentData; }; - if( parent !== X_UI_rootData ){ - data.hoverClassName && data.xnode[ 'removeClass' ]( data.hoverClassName ); - data[ '_listeners' ] && data[ '_listeners' ][ XUI_Event.POINTER_OUT ] && data[ 'dispatch' ]( eventOut, false ); // new Event + if( parent !== XUI_rootData ){ + if( data[ '_listeners' ] && data[ '_listeners' ][ XUI_Event.POINTER_OUT ] ){ + if( !eventOut ){ + eventOut = X_Object_copy( e ); + eventOut.type = XUI_Event.POINTER_OUT; + }; + data[ 'dispatch' ]( eventOut, false ); + }; delete data.hovering; list.splice( i, 1 ); - continue; - }; + } else if( !data.hovering ){ - data.hoverClassName && data.xnode.addClassName( data.hoverClassName ); - data[ '_listeners' ] && data[ '_listeners' ][ XUI_Event.POINTER_IN ] && data[ 'dispatch' ]( eventIn, true ); // new Event + if( data[ '_listeners' ] && data[ '_listeners' ][ XUI_Event.POINTER_IN ] ){ + if( !eventIn ){ + eventIn = X_Object_copy( e ); + eventIn.type = XUI_Event.POINTER_IN; + }; + data[ 'dispatch' ]( eventIn, true ); + }; data.hovering = true; }; }; @@ -84,7 +71,7 @@ function X_UI_eventRellay( e ){ }; function X_UI_onMouseOut( e ){ - var list = X_UI_rootData.hoverList, + var list = XUI_UINODES_HOVER, i = list.length; console.log( 'pointer out!!' + e.type + i + ' ' + e.pointerType ); @@ -93,8 +80,6 @@ function X_UI_onMouseOut( e ){ for( ; i; ){ data = list[ --i ]; - //console.log( data.xnode.className() ); - data.hoverClassName && data.xnode[ 'removeClass' ]( data.hoverClassName ); data[ '_listeners' ] && data[ '_listeners' ][ XUI_Event.POINTER_OUT ] && data[ 'dispatch' ]( e, false ); // new Event delete data.hovering; }; @@ -113,12 +98,7 @@ var XUI_Root = XUI_Box.inherits( layout : XUI_Layout_Canvas, calcReserved : false, - hoverList : null, - targetNodeData : null, - monopolyNodeData : null, - xnodeInteractiveLayer : null, - eventCounter : null, cursorStyle : null, Constructor : function( user, layout, args ){ @@ -130,39 +110,35 @@ var XUI_Root = XUI_Box.inherits( X_ViewPort[ 'listenOnce' ]( X_EVENT_XDOM_READY, this, this.start ); }; - this.hoverList = []; - this.eventCounter = {}; - - X_UI_rootData = this; + XUI_rootData = this; }, start : function(){ - // hover や rollover rollout のための move イベントの追加 - // TODO この切り替えを ViewPort へ - XUI_xnodeIneraction = ( X_UA[ 'IE' ] < 9 ? X_ViewPort_document : X_UA[ 'Opera' ] < 8 ? X_Node_body : X_ViewPort ); + this.initialize( this.User, this, null, null ); X_Timer_once( 0, this, this.addToView ); }, addToView : function(){ - var counter = this.eventCounter; - - // this.xnodeInteractiveLayer の前に追加する! - + // XUI_xnodeInteractionOverlay の前に追加する! this.addToParent( X_Node_body ); - this.xnodeInteractiveLayer = X_Node_body.create( 'div', { + XUI_xnodeInteractionOverlay = X_Node_body.create( 'div', { 'class' : 'mouse-operation-catcher', unselectable : 'on' } ); X_Node_body[ 'listen' ]( 'pointerleave', this, X_UI_onMouseOut ); + // hover や rollover rollout のための move イベントの追加 + // TODO この切り替えを ViewPort へ + XUI_xnodeIneraction = ( X_UA[ 'IE' ] < 9 ? X_ViewPort_document : X_UA[ 'Opera' ] < 8 ? X_Node_body : X_ViewPort ); XUI_xnodeIneraction[ 'listen' ]( 'pointermove', X_UI_eventRellay ); - if( counter[ XUI_Event._POINTER_MOVE ] ){ - ++counter[ XUI_Event._POINTER_MOVE ]; + + if( XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ] ){ + ++XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ]; } else { - counter[ XUI_Event._POINTER_MOVE ] = 1; + XUI_EVENT_COUNTER[ XUI_Event._POINTER_MOVE ] = 1; }; X_Timer_once( 0, this, this.afterAddToView ); @@ -205,7 +181,7 @@ var XUI_Root = XUI_Box.inherits( }, _remove : function(){ - X_EventDispatcher_unlistenAll( this.xnodeInteractiveLayer ); + X_EventDispatcher_unlistenAll( XUI_xnodeInteractionOverlay ); _Box.prototype._remove.call( this ); } } @@ -235,7 +211,7 @@ X.UI.Root = X.UI.Box.inherits( //if( !XUI_Root ){ supports = XUI_Attr_createAttrDef( XUI_Box.prototype.usableAttrs, XUI_Layout_Canvas.overrideAttrsForSelf ); - XUI_Root.prototype.layout = XUI_Layout_Canvas; + //XUI_Root.prototype.layout = XUI_Layout_Canvas; XUI_Root.prototype.usableAttrs = supports; XUI_Root.prototype.attrClass = XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, { width : '100%',