From: itozyun Date: Sun, 8 Nov 2015 11:04:31 +0000 (+0900) Subject: Version 0.6.191, fix X.UI.ScrollBox & X.UI.Gesture. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=74f0206369c34768338a44ad8442a7bcdf7d5a7e Version 0.6.191, fix X.UI.ScrollBox & X.UI.Gesture. --- 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 3aab9e1..f8b9535 100644 --- a/0.6.x/js/20_ui/05_XUI_Gesture.js +++ b/0.6.x/js/20_ui/05_XUI_Gesture.js @@ -323,7 +323,7 @@ if( type === XUI_Event.POINTER_OUT ) console.log( 'canceled ...' + e.button ) // store as previous event event hammer.lastEvent = hammerEvent; activated = hammer.activated; - + console.log( '... ' ); // call Hammer.gesture handlers for( i = 0, l = gestures.length; i < l; ++i ){ gesture = gestures[ i ]; @@ -645,7 +645,6 @@ var XUI_Gesture_LIST = [ startID : XUI_Event.TAP, endID : XUI_Event.DOUBLE_TAP, defaults : { - tap_min_touchtime : 75, tap_max_touchtime : 250, tap_max_distance : 3, tap_always : true, @@ -656,21 +655,22 @@ 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_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; -//console.log( ' rap? ' + e.deltaTime + 'ms' ); - //if( e.deltaTime < hammer.options.tap_min_touchtime ) 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 ); } else // do a single tap - if( hammer.options.tap_always && hammer.currentName !== 'tap' ){ // EventFire中にalert すると mouseleave で再び呼ばれるのを防ぐ + if( hammer.options.tap_always ){ //hammer.currentName = 'tap'; - console.log( 'tap! ' + e.deltaTime + 'ms' ); + console.log( 'tap! ' + e.deltaTime + 'ms ' + e.type ); return hammer.trigger( XUI_Event.TAP, e ); }; }; diff --git a/0.6.x/js/20_ui/08_Box.js b/0.6.x/js/20_ui/08_Box.js index d0c7818..73e6067 100644 --- a/0.6.x/js/20_ui/08_Box.js +++ b/0.6.x/js/20_ui/08_Box.js @@ -70,8 +70,8 @@ var XUI_Box = XUI_AbstractUINode.inherits( pointerChildren : true, through : false, - scrollingX : 0, // TODO 現在のスクロール位置 - scrollingY : 0, // TODO + scrollXEm : 0, + scrollYEm : 0, Constructor : function( user, layout, args ){ var i = 0, @@ -183,8 +183,8 @@ var XUI_Box = XUI_AbstractUINode.inherits( x -= this.boxX; y -= this.boxY; if( this.pointerChildren && ( uinodes = this.uinodes ) && ( i = uinodes.length ) ){ - _x = x - this.scrollingX; - _y = y - this.scrollingY; + _x = x - this.scrollXEm; + _y = y - this.scrollYEm; for( ; i; ){ child = uinodes[ --i ]; if( !child.pointerDisabled && child.boxX <= _x && _x < child.boxX + child.boxWidth && child.boxY <= _y && _y < child.boxY + child.boxHeight && child.capcher( _x, _y ) ){ diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 4948a7b..323b95b 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -316,8 +316,10 @@ function X_UI_ScrollBox_translate( that, x, y, opt_time, opt_easing, opt_release ); }; - that.scrollX = x; - that.scrollY = y; + that.scrollX = x; + that.scrollXEm = x / that.fontSize; + that.scrollY = y; + that.scrollYEm = y / that.fontSize; }; function X_UI_ScrollBox_onStart( e ){ diff --git a/0.6.x/js/20_ui/20_Root.js b/0.6.x/js/20_ui/20_Root.js index d5b794d..237af6a 100644 --- a/0.6.x/js/20_ui/20_Root.js +++ b/0.6.x/js/20_ui/20_Root.js @@ -17,30 +17,22 @@ function X_UI_eventRellay( e ){ 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 ) ); + }; e.type = type; // TODO capture は pointer 毎に! - if( data && ( data = data.monopolyNodeData ) && ( ret = data[ 'dispatch' ]( e ) ) & X_CALLBACK_CAPTURE_POINTER ){ - console.log( 'capture ' + data.xnode.className() ); - XUI_interactionBusy = false; - return ret | X_CALLBACK_PREVENT_DEFAULT; - }; - //if( ret & X_CALLBACK_RELEASE_POINTER ){ - data && ( data.monopolyNodeData = null ); - //return ret | X_CALLBACK_PREVENT_DEFAULT; - //}; + list = X_UI_rootData.hoverList; ( X_UI_rootData.targetNodeData = X_UI_rootData ).capcher( x, y ); data = X_UI_rootData.targetNodeData; - 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 ) ); - }; +