OSDN Git Service

Version 0.6.56, working X.UI.Event.Tap.
authoritozyun <itozyun@user.sourceforge.jp>
Sun, 13 Jul 2014 22:37:44 +0000 (07:37 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Sun, 13 Jul 2014 22:37:44 +0000 (07:37 +0900)
0.6.x/js/ui/05_XUI_Gesture.js
0.6.x/js/ui/20_PageRoot.js

index 58f8432..f8dab24 100644 (file)
                if( !this.types[ type ] ) return;\r
                var e = Utils.extend( {}, gesture );\r
                e.type = type;\r
-               console.log( 'trigger : ' + type );\r
                return this.uinode.dispatch( e );\r
        };\r
        \r
                                        return hammer.trigger( X.UI.Event.DOUBLE_TAP, e );\r
                                } else\r
                                // do a single tap\r
-                               if( hammer.options.tap_always ){\r
+                               if( hammer.options.tap_always && Detection.current.name !== 'tap' ){ // EventFire中にalert すると mouseleave で再び呼ばれるのを防ぐ\r
                                        Detection.current.name = 'tap';\r
                                        return hammer.trigger( X.UI.Event.TAP, e );\r
                                };\r
index d9167ad..a1821dd 100644 (file)
@@ -8,15 +8,24 @@ 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 );
-       //};
+
+       if( !data ) return ret;
+       
+       // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止
+       // gesture にも手当てが必要
+       if( data._eventBudy ) return X.Callback.STOP_PROPAGATION | _ret & X.Callback.PREVENT_DEFAULT;
+       data._eventBudy = 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._eventBudy;
+               return ret;
+       };
        
        list = X.UI.currentRootData.hoverList;
        ( X.UI.currentRootData.targetNodeData = X.UI.currentRootData ).capcher( x, y );
@@ -49,6 +58,7 @@ function eventRellay( e ){
                        data.hovering = true;
                };
        };
+       delete X.UI.currentRootData._eventBudy;
        return ret;
 };
 
@@ -72,6 +82,8 @@ var _PageRoot = _Box.inherits(
                eventCounter          : null,
                cursorStyle           : null,
                
+               _eventBudy            : false,
+               
                Constructor : function( layout, args ){
                        this.SuperConstructor( layout, args );