From: itozyun Date: Fri, 17 Apr 2015 12:46:33 +0000 (+0900) Subject: Version 0.6.139, fix Node.animate when no. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=5d1a420699bfb2a488fb7a33cb1f9d6ed3164ee4 Version 0.6.139, fix Node.animate when no. --- diff --git a/0.6.x/css/xui.css b/0.6.x/css/xui.css index 36a29a0..5ec74e3 100644 --- a/0.6.x/css/xui.css +++ b/0.6.x/css/xui.css @@ -7,7 +7,7 @@ html, body { } .PageRoot { - height : 100%; + height : 100%; position : relative; } @@ -18,6 +18,7 @@ html, body { top : 0; left : 0; width : 100%; + height : auto; padding : 0; margin : 0; /* ブラウザのレイアウト機能による auto なサイズ指定は行わない */ @@ -100,6 +101,43 @@ html, body { visibility : hidden; /*z-index : 99;*/ } +.hidden-iframe { + z-index : -1; + visibility : hidden; + overflow : hidden; + border : 0; + outline : 0; + margin : -10px 0 0 -10px; + padding : 0; + min-width : 0; + min-height : 0; + width : 10px; + height : 10px; + max-width : 10px; + max-height : 10px; + top : -20px; + left : -20px; +} + +/* Fix for WebAudio + * see http://qiita.com/sou/items/5688d4e7d3a37b4e2ff1 +--------------------------------------------------------------------------------------*/ + #fps-slowdown-make-sound-noisy { + width: 0px; + height: 0px; + position: absolute; + -webkit-animation-name: anim-void; + -webkit-animation-duration: 1s; + -webkit-animation-iteration-count: infinite; + } + @-webkit-keyframes anim-void { + from { + top: 0px; + } + to { + top: 1px; + } + } /* Scrollbox --------------------------------------------------------------------------------------*/ diff --git a/0.6.x/js/01_core/10_XCallback.js b/0.6.x/js/01_core/10_XCallback.js index f5ee5ef..a8dd6a3 100644 --- a/0.6.x/js/01_core/10_XCallback.js +++ b/0.6.x/js/01_core/10_XCallback.js @@ -31,8 +31,12 @@ var /** @const */ X_Callback_PREVENT_DEFAULT = 8, // 結果動作のキャンセル, /** @const */ X_Callback_MONOPOLY = 16, // move event を独占する + + X_Callback_CAPTURE_POINTER = 16, + X_Callback_RELEASE_POINTER = 32, + /** @const */ - X_Callback_SYS_CANCEL = 32 | 4 | 2; + X_Callback_SYS_CANCEL = 64 | 4 | 2; /* * handleEvent という関数のメンバーを持つオブジェクト @@ -151,7 +155,11 @@ X[ 'Callback' ] = { /** * X.UI に於いて、ポインターイベントの戻り値に指定すると、以降のポインターベントを独占する。 */ - 'MONOPOLY' : X_Callback_MONOPOLY + 'MONOPOLY' : X_Callback_MONOPOLY, + + 'CAPTURE_POINTER' : X_Callback_CAPTURE_POINTER, + + 'RELEASE_POINTER' : X_Callback_RELEASE_POINTER }; // ------------------------------------------------------------------------- // diff --git a/0.6.x/js/01_core/14_XTimer.js b/0.6.x/js/01_core/14_XTimer.js index 41b4fcf..48b27a3 100644 --- a/0.6.x/js/01_core/14_XTimer.js +++ b/0.6.x/js/01_core/14_XTimer.js @@ -95,14 +95,18 @@ var var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X_Timer_REQ_ANIME_FRAME( X_Timer_onEnterFrame ) ); - f = X_Timer_REQ_FRAME_LIST[ i ] = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + f = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + if( !f.kind ) f = { func : f }; + X_Timer_REQ_FRAME_LIST[ i ] = f; return f.uid = ++X_Timer_uid; }) : (function( args1, args2, args3 ){ var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X_Timer_add( 0, 1, X_Timer_onEnterFrame ) ); - f = X_Timer_REQ_FRAME_LIST[ i ] = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + f = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + if( !f.kind ) f = { func : f }; + X_Timer_REQ_FRAME_LIST[ i ] = f; return f.uid = ++X_Timer_uid; }), @@ -110,7 +114,9 @@ var * requestAnimationFrame を解除します。登録時に受け取ったタイマーIDを使用します。 * @alias X.Timer.cancelFrame * @function - * @param {number} タイマーID + * @param {number|string} タイマーID, 数字文字の場合もある! + * @return {number} 0 が返る + * @example if( timerID ) timerID = X.Timer.cancelFrame( timerID ); */ X_Timer_cancelFrame = X_Timer_CANCEL_ANIME_FRAME ? (function( uid ){ @@ -118,8 +124,9 @@ var l = list.length, i = l, f; - // fire 中の cancel + if( X_Timer_busyOnFrame ){ + // fire 中の cancel if( !X_Timer_removal ) X_Timer_removal = {}; X_Timer_removal[ uid ] = true; } else { @@ -127,20 +134,22 @@ var if( ( f = list[ --i ] ).uid < uid ) break; if( f.uid === uid ){ list.splice( i, 1 ); - // gecko では無い場合がある + // gecko では cancelRequestAnimationFrame が無い場合がある l === 1 && X_Timer_CANCEL_ANIME_FRAME && X_Timer_CANCEL_ANIME_FRAME( X_Timer_requestID ); break; }; }; }; + return 0; }) : (function( uid ){ var list = X_Timer_REQ_FRAME_LIST, l = list.length, i = l, f; - // fire 中の cancel + if( X_Timer_busyOnFrame ){ + // fire 中の cancel if( !X_Timer_removal ) X_Timer_removal = {}; X_Timer_removal[ uid ] = true; } else { @@ -153,6 +162,7 @@ var }; }; }; + return 0; }); @@ -200,7 +210,7 @@ X[ 'Timer' ] = { * @param {*} args2 * @param {*} args3 * @return {number} タイマーID。1 以上の数値。タイマーの解除に使用。 - * @example X.Timer.add( 1000, 5, thisContext, onTimer ); + * @example timerID = X.Timer.add( 1000, 5, thisContext, onTimer ); */ function X_Timer_add( time, opt_count, args1, args2, args3 ){ var list = X_Timer_TICKET_LIST, @@ -245,14 +255,17 @@ X[ 'Timer' ] = { * タイマーを解除します。登録時に受け取ったタイマーIDを使用します。 * @alias X.Timer.remove * @param {number} タイマーID + * @return {number} 0 が返る + * @example if( timerID ) timerID = X.Timer.remove( timerID ); */ function X_Timer_remove( uid ){ var list = X_Timer_TICKET_LIST, i = list.length, l = i, f, q, eventDispatcher, lazy, listeners; - // fire 中の cancel + if( X_Timer_busyTimeout ){ + // fire 中の cancel if( !X_Timer_removal ) X_Timer_removal = {}; X_Timer_removal[ uid ] = true; } else { @@ -264,19 +277,7 @@ X[ 'Timer' ] = { * lazyDispatch 中の EventDispatcher の有無を調べる */ if( X_EventDispatcher_LAZY_TIMERS[ uid ] ){ - // eventDispatcher = X_EventDispatcher_LAZY_TIMERS[ uid ]; delete X_EventDispatcher_LAZY_TIMERS[ uid ]; - /* - listeners = eventDispatcher[ '_listeners' ]; - if( listeners && !listeners[ X_Listeners_.DISPATCHING ] && listeners[ X_Listeners_.KILL_RESERVED ] ){ - for( uid in X_EventDispatcher_LAZY_TIMERS ){ - if( X_EventDispatcher_LAZY_TIMERS[ uid ] === eventDispatcher ){ - lazy = true; - break; - }; - }; - !lazy && eventDispatcher[ 'kill' ](); - }; */ }; !X_Timer_skipUpdate && ( q.last <= X_Timer_waitTime || l === 1 ) && X_Timer_update(); @@ -284,6 +285,7 @@ X[ 'Timer' ] = { }; }; }; + return 0; }; if( X_UA[ 'IE4' ] || X_UA[ 'MacIE' ] ){ @@ -423,10 +425,10 @@ function X_Timer_onEnterFrame( time ){ if( X_Timer_removal && X_Timer_removal[ q.uid ] ) continue; - if( q.k ){ + if( q.kind ){ X_Callback_proxyCallback( q, args || ( args = [ time ] ) ); } else { - q( time ); + q.func( time ); }; }; diff --git a/0.6.x/js/01_core/16_XViewPort.js b/0.6.x/js/01_core/16_XViewPort.js index 0684d3f..a6eddb8 100644 --- a/0.6.x/js/01_core/16_XViewPort.js +++ b/0.6.x/js/01_core/16_XViewPort.js @@ -12,8 +12,8 @@ var X_ViewPort_readyState, X_Dom_detectFontSize = !( X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ] ) && function(){ var size = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight; if( X_ViewPort_baseFontSize !== size ){ - X_ViewPort_baseFontSize && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_BASE_FONT_RESIZED ); X_ViewPort_baseFontSize = size; + X_ViewPort_baseFontSize && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_BASE_FONT_RESIZED ); }; }, diff --git a/0.6.x/js/02_dom/02_XNode.js b/0.6.x/js/02_dom/02_XNode.js index c0bb170..b432339 100644 --- a/0.6.x/js/02_dom/02_XNode.js +++ b/0.6.x/js/02_dom/02_XNode.js @@ -1195,9 +1195,7 @@ function X_Node_text( text ){ function X_Node_call( name /*, opt_args... */ ){ var l = arguments.length - 1, raw, func, args, params, i; - - X_Node_updateTimerID && X_Node_startUpdate(); - + switch( name ){ case 'nodeType' : return this[ '_tag' ] ? 1 : 3; @@ -1213,13 +1211,12 @@ function X_Node_call( name /*, opt_args... */ ){ return v; case 'fontSize' : return X_Node_CSS_getCharSize( this ); - case 'GPU' : - return this[ '_flags' ] & X_Node_State.GPU_NOW ? 'NOW' : - this[ '_flags' ] & X_Node_State.GPU_RELEASE_RESERVED ? '解除予約' : ''; case 'inGPU' : return !!( this[ '_flags' ] & ( X_Node_State.GPU_NOW | X_Node_State.GPU_RELEASE_RESERVED ) ); }; + X_Node_updateTimerID && X_Node_startUpdate(); + raw = this[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this ); if( !raw ) return; @@ -1330,6 +1327,8 @@ function X_Node_startUpdate( time ){ if( time ){ // X.Timer 経由でないと発火しない このイベントでサイズを取ると無限ループに X_System[ '_listeners' ] && X_System[ '_listeners' ][ X_EVENT_UPDATED ] && X_System[ 'dispatch' ]( X_EVENT_UPDATED ); + } else { + X_System[ '_listeners' ] && X_System[ '_listeners' ][ X_EVENT_UPDATED ] && X_System[ 'asyncDispatch' ]( X_EVENT_UPDATED ); }; X_ViewPort[ '_listeners' ] && X_ViewPort[ '_listeners' ][ X_EVENT_AFTER_UPDATE ] && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_AFTER_UPDATE ); diff --git a/0.6.x/js/02_dom/10_XNodeAnime.js b/0.6.x/js/02_dom/10_XNodeAnime.js index e68b852..56c8adf 100644 --- a/0.6.x/js/02_dom/10_XNodeAnime.js +++ b/0.6.x/js/02_dom/10_XNodeAnime.js @@ -61,6 +61,8 @@ var X_Node_ANIMATIONS = [], X_Node_Anime_reserved = false, X_Node_Anime_updateTimerID = 0, X_Node_Anime_needsDetection = false, + X_Node_Anime_onTransition = false, + X_Node_Anime_hasTransform = !!X_Node_CSS_VENDER_PREFIX[ 'transform' ], /* Opera mobile で translateZ(0) が有効だと XY が 0 0 になる */ /* GPUレイヤーにいる間に要素のコンテンツを変更をすると transitionend が動かなくなるっぽい Mac safari と firefox, 手当てが済むまでここは常に false */ @@ -70,8 +72,7 @@ var X_Node_ANIMATIONS = [], X_Node_Anime_transitionProps = X_Node_Anime_hasTransform ? X_Node_CSS_VENDER_PREFIX[ 'transform' ] : 'left,top', // transitionEnd イベント中に要素の更新( X_Node_startUpdate() )ができるか? // iOS3+4 では可能、iOS6.1.5 で不可。TODO iOS5 及び他の環境で調査。ダメな場合、anime.html が正しく描画されない。 - X_Node_updateOnTransitionEnd = X_UA[ 'iOS' ] < 6, - X_Node_Anime_onTransition = false; + X_Node_updateOnTransitionEnd = X_UA[ 'iOS' ] < 6; // gpu化だけ transformX , willChange // 終了位置の変更 @@ -123,10 +124,19 @@ Node.prototype[ 'animate' ] = function( start, dest, duration, easing, wait ){ X_Node_Anime_reserveUpdate( true ); } else { - X_System[ 'unlisten' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); - X_Node_Anime_updateTimerID || ( X_Node_Anime_updateTimerID = X_Timer_requestFrame( X_Node_Anime_updateAnimationsNoTransition ) ); + if( !X_Node_Anime_reserved ){ + X_Node_Anime_reserved = true; + if( X_Node_updateTimerID ){ + X_System[ 'listen' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); + X_Node_Anime_updateTimerID && X_Timer_cancelFrame( X_Node_Anime_updateTimerID ); + X_Node_Anime_updateTimerID = 0; + } else { + X_System[ 'unlisten' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); + X_Node_Anime_updateTimerID = X_Timer_requestFrame( X_Node_Anime_updateAnimationsNoTransition ); + }; + }; - isNew && this[ 'dispatch' ]( { type : X_EVENT_ANIME_START, gpu : false } ); + isNew && this[ 'dispatch' ]( { type : X_EVENT_ANIME_START, 'gpu' : false } ); }; // console.log( 'animate() ' + this[ '_id' ] + ' y:' + obj.startY + ' > ' + obj.destY + ' d:' + obj.duration ); @@ -146,7 +156,7 @@ Node.prototype[ 'stop' ] = function(){ } else { X_Node_ANIMATIONS.splice( X_Node_ANIMATIONS.indexOf( this ), 1 ); //obj.gpuTimerID && X_Timer_remove( obj.gpuTimerID ); - delete this[ '_anime' ]; + delete this[ '_anime' ]; }; return this; }; @@ -294,7 +304,7 @@ function X_Node_Anime_updateAnimation( xnode ){ //console.log( '開始位置 ' + phase ); X_Node_Anime_updatePosition( xnode, obj.startX, obj.startY, obj.startA, phase === 8 ); - xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_START, gpu : phase === 8 } ); + xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_START, 'gpu' : phase === 8 } ); ++obj.phase; break; case 1 : @@ -320,7 +330,7 @@ function X_Node_Anime_updateAnimation( xnode ){ obj.phase = obj.gpuParent ? 10 : 4; // このタイミングで animation 関連の css を削除したところ(X_Node_Anime_clearTransition)、iOS3、4 で再描画忘れが度々起きるように、、、 if( !obj.gpuParent ) X_Node_Anime_clearTransition( xnode ); - xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_END, gpu : obj.gpuParent } ); + xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_END, 'gpu' : obj.gpuParent } ); break; case 4 : @@ -355,7 +365,7 @@ function X_Node_Anime_updateAnimation( xnode ){ X_Node_Anime_clearTransition( xnode ); X_Node_Anime_updatePosition( xnode, obj.destX, obj.destY, obj.destA, phase === 14 ); obj.phase = phase === 14 ? 10 : 4; - xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_END, gpu : obj.gpuParent } ); + xnode[ 'dispatch' ]( { type : X_EVENT_ANIME_END, 'gpu' : obj.gpuParent } ); } else { current = X_Node_Anime_getComputedPosition( xnode ); obj.startX = current.x; @@ -419,7 +429,7 @@ function X_Node_Anime_onTransitionEnd( e ){ this[ '_anime' ].phase = 3; X_Node_Anime_onTransition = true; - this[ 'dispatch' ]( { type : X_EVENT_ANIME_END, gpu : this[ '_anime' ].gpuParent } ); + this[ 'dispatch' ]( { type : X_EVENT_ANIME_END, 'gpu' : this[ '_anime' ].gpuParent } ); X_Node_Anime_onTransition = false; X_Node_Anime_needsDetection = true; @@ -448,7 +458,7 @@ function X_Node_Anime_releaseGPULayer(){ function X_Node_Anime_gpuReleased(){ //console.log( 'GPU レイヤーが解放されました' ); - this[ 'dispatch' ]( { type : X_EVENT_GPU_RELEASED, gpu : true } ); + this[ 'dispatch' ]( { type : X_EVENT_GPU_RELEASED, 'gpu' : true } ); }; function X_Node_Anime_clearTransition( xnode ){ @@ -504,7 +514,7 @@ function X_Node_Anime_updatePosition( xnode, x, y, opacity, useGPU ){ }; }; -function X_Node_Anime_updateAnimationsNoTransition(){ +function X_Node_Anime_updateAnimationsNoTransition( e ){ var i = X_Node_ANIMATIONS.length, now = X_Timer_now(), obj, @@ -522,7 +532,7 @@ function X_Node_Anime_updateAnimationsNoTransition(){ X_Node_ANIMATIONS.splice( i, 1 ); // filter な 親が解除されないと子要素への filter が反映されない - xnode[ 'asyncDispatch' ]( { type : X_EVENT_ANIME_END, gpu : false } ); + xnode[ 'asyncDispatch' ]( { type : X_EVENT_ANIME_END, 'gpu' : false } ); } else { easing = obj.easing.fn( ( now - obj.startTime ) / obj.duration ); newX = ( obj.destX - obj.startX ) * easing + obj.startX; @@ -536,14 +546,21 @@ function X_Node_Anime_updateAnimationsNoTransition(){ }; }; - if( c ){ + c && console.log( 'anime... ' + X_Node_updateTimerID ); + + if( X_Node_Anime_reserved = c ){ if( X_Node_updateTimerID ){ - X_System[ 'listen' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); + // scrollbox では X_System X_EVENT_UPDATED は不可。。。 + !e || e.type !== X_EVENT_UPDATED ? + X_System[ 'listen' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ) : + X_Node_Anime_updateTimerID && X_Timer_cancelFrame( X_Node_Anime_updateTimerID ); X_Node_Anime_updateTimerID = 0; } else { + X_System[ 'unlisten' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); X_Node_Anime_updateTimerID = X_Timer_requestFrame( X_Node_Anime_updateAnimationsNoTransition ); }; } else { + X_System[ 'unlisten' ]( X_EVENT_UPDATED, X_Node_Anime_updateAnimationsNoTransition ); X_Node_Anime_updateTimerID = 0; }; }; diff --git a/0.6.x/js/06_net/01_XNetXHR.js b/0.6.x/js/06_net/01_XNetXHR.js index 4eb6988..4f3ca4a 100644 --- a/0.6.x/js/06_net/01_XNetXHR.js +++ b/0.6.x/js/06_net/01_XNetXHR.js @@ -33,6 +33,8 @@ Android1.6- の XHR で 401 エラーが返った場合は、iframe に xml を var // Opera7.6+, Safari1.2+, khtml3.?+, Gecko0.9.7+ // ie7 ではローカルリソースには ActiveX の XHR を使う X_Net_XHR_W3C = ( !X_UA[ 'IE7' ] || !X_URL_IS_LOCAL ) && window[ 'XMLHttpRequest' ] && new XMLHttpRequest(), + X_Net_XHR_progress = false && X_Net_XHR_W3C && X_Net_XHR_W3C.onprogress !== undefined, + X_Net_XHR_upload = false && X_Net_XHR_W3C && !!X_Net_XHR_W3C.upload, X_Net_XHR_X_DOMAIN = window[ 'XDomainRequest' ] && new XDomainRequest(), X_Net_XHR_VERSION = 0, @@ -64,11 +66,13 @@ X[ 'Net' ][ 'XHR' ] = { */ 'FLASH' : false, -// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest -// Progress Events Chrome7, firefox3.5, ie10, opera12, Safari?, Chrome for Android 0.16 - 'PROGRESS' : false, // +/** + * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest + * Progress Events Chrome7, firefox3.5, ie10, opera12, Safari?, Chrome for Android 0.16 + */ + 'PROGRESS' : X_Net_XHR_progress, // - 'UL_PROGRESS' : false, + 'UL_PROGRESS' : X_Net_XHR_upload, 'CORS' : X_Net_XHR_X_DOMAIN || ( X_Net_XHR_W3C && X_Net_XHR_W3C.withCredentials !== undefined ) }; @@ -191,8 +195,11 @@ if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){ if( !X_Net_XHR_ACTIVE_X && X_Type_isFunction( raw.setRequestHeader ) ){ // http://nakigao.sitemix.jp/blog/?p=2040 - // SafariでHTTP/412のエラー - // headers[ 'If-Modified-Since' ] = ( new Date ).toUTCString(); + // json 取得時に SafariでHTTP/412のエラー。但し相手が audio の場合、この指定があるとロードに失敗する。 iOS8.2, iOS7.1 では遭遇せず + if( this._type === 'json' ){ + console.log( 'If-Modified-Since : ' + this._type ); + headers[ 'If-Modified-Since' ] = ( new Date ).toUTCString(); + }; for( p in headers ){ if( X_EMPTY_OBJECT[ p ] ) continue; @@ -247,9 +254,18 @@ if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){ // Timeout した Gecko の xhr.response に触るとエラー?? if( X_UA[ 'Opera' ] || X_UA[ 'Webkit' ] || X_UA[ 'Gecko' ] ){ if( this._error ){ + + if( X_Net_XHR_upload ){ + this[ '_rawObject' ].upload.removeEventListener( 'progress', X_NET_XHRWrapper.onUploadProgress ); + }; + X_EventDispatcher_toggleAllEvents( this, false ); this[ '_rawObject' ] = new XMLHttpRequest(); X_EventDispatcher_toggleAllEvents( this, true ); + + if( X_Net_XHR_upload ){ + this[ '_rawObject' ].upload.addEventListener( 'progress', X_NET_XHRWrapper.onUploadProgress ); + }; }; }; @@ -398,7 +414,7 @@ if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){ this._timerID = 0; }, - onUploadProgress : X[ 'Net' ][ 'XHR' ][ 'UL_PROGRESS' ] && function( e ){ + onUploadProgress : X_Net_XHR_upload && function( e ){ var raw = X_NET_XHRWrapper[ '_rawObject' ].upload, live = !X_NET_XHRWrapper._canceled, states, data; @@ -421,13 +437,13 @@ if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){ if( X_Net_XHR_ACTIVE_X ){ // win ie5-6 X_NET_XHRWrapper[ 'listen' ]( 'readystatechange' ); } else - if( X[ 'Net' ][ 'XHR' ][ 'PROGRESS' ] ){ + if( X_Net_XHR_progress ){ X_NET_XHRWrapper[ 'listen' ]( [ 'load', 'progress', 'error', 'timeout' ] ); //, 'abort' } else { X_NET_XHRWrapper[ 'listen' ]( [ 'load', 'readystatechange', 'error', 'timeout' ] ); //, 'abort' }; - if( X_NET_XHRWrapper.onUploadProgress ){ + if( X_Net_XHR_upload ){ X_NET_XHRWrapper[ '_rawObject' ].upload.addEventListener( 'progress', X_NET_XHRWrapper.onUploadProgress ); }; }; diff --git a/0.6.x/js/07_audio/01_XWebAudio.js b/0.6.x/js/07_audio/01_XWebAudio.js index 905ffd1..8a5e1ed 100644 --- a/0.6.x/js/07_audio/01_XWebAudio.js +++ b/0.6.x/js/07_audio/01_XWebAudio.js @@ -324,6 +324,14 @@ if( X_Audio_WebAudio_context ){ } ); + /* + * http://qiita.com/sou/items/5688d4e7d3a37b4e2ff1 + * L-01F 等の一部端末で Web Audio API の再生結果に特定条件下でノイズが混ざることがある。 + * 描画レート(描画 FPS)が下がるとノイズが混ざり始め、レートを上げると再生結果が正常になるというもので、オーディオ処理が描画スレッドに巻き込まれているような動作を見せる。 + */ + if( X_UA[ 'Android' ] && X_UA[ 'Chrome' ] ){ + X_Node_systemNode.create( 'div', { id : 'fps-slowdown-make-sound-noisy' } ); + }; X_Audio_BACKENDS.push( { diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 0191bb0..cd5e4f4 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -140,10 +140,6 @@ X.UI._ScrollBox = X.UI._ChromeBox.inherits( X_UI_rootData[ 'listenOnce' ]( X.UI.Event.LAYOUT_COMPLETE, this, X_UI_ScrollBox_onLayoutComplete ); }; }, - - scrollBy : function( x, y, opt_time, opt_easing ){ - this.scrollTo( this.scrollX + x, this.scrollY + y, opt_time, opt_easing ); - }, scrollTo : function( x, y, opt_time, opt_easing, opt_release ){ //if( this.scrollX === x && this.scrollY === y ) return; @@ -175,8 +171,8 @@ function X_UI_ScrollBox_onLayoutComplete( e ){ // scroll の停止、GPU の解除 var font = this.fontSize = this._containerXNode.call( 'fontSize' ); - this.maxScrollX = ( this.boxWidth - this._containerNode.boxWidth ) * font; - this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font; + this.maxScrollX = ( this.boxWidth - this._containerNode.boxWidth ) * font | 0; + this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font | 0; this.hasHScroll = this.scrollXEnabled && this.maxScrollX < 0; this.hasVScroll = this.scrollYEnabled && this.maxScrollY < 0; @@ -395,7 +391,7 @@ function X_UI_ScrollBox_onEnd( e ){ easing = '', newX, newY, momentumX, momentumY, - duration, distanceX, distanceY, font; + duration, distanceX, distanceY; this[ 'unlisten' ]( X.UI.Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove ); this[ 'unlisten' ]( [ X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd ); @@ -422,24 +418,24 @@ function X_UI_ScrollBox_onEnd( e ){ // we scrolled less than 10 pixels if( !this.moved ){ // this[ 'dispatch' ]( X_EVENT_CANCELED ); + console.log( 'we scrolled less than 10 pixels' ); return ret; }; // start momentum animation if needed if( this.momentumEnabled && duration < 300 ){ - font = this.fontSize; momentumX = this.hasHScroll ? - X_UI_ScrollBox_momentum( this.scrollX, this.startX, duration, this.maxScrollX, this.bounceEnabled ? this.boxWidth * font : 0, this.deceleration ) : + X_UI_ScrollBox_momentum( this.scrollX, this.startX, duration, this.maxScrollX, this.bounceEnabled ? this.boxWidth * this.fontSize : 0, this.deceleration ) : { destination: newX, duration: 0 }; momentumY = this.hasVScroll ? - X_UI_ScrollBox_momentum( this.scrollY, this.startY, duration, this.maxScrollY, this.bounceEnabled ? this.boxHeight * font : 0, this.deceleration ) : + X_UI_ScrollBox_momentum( this.scrollY, this.startY, duration, this.maxScrollY, this.bounceEnabled ? this.boxHeight * this.fontSize : 0, this.deceleration ) : { destination: newY, duration: 0 }; newX = momentumX.destination; newY = momentumY.destination; time = Math.max( momentumX.duration, momentumY.duration ) | 0; this.isInTransition = true; } else { - //console.log( '慣性無し' ); + console.log( '慣性無し' ); }; if( newX != this.scrollX || newY != this.scrollY ){ @@ -448,12 +444,12 @@ function X_UI_ScrollBox_onEnd( e ){ easing = 'quadratic'; }; - //console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time ); + console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time ); this.scrollTo( newX, newY, time, easing, 1000 ); return ret; }; - //console.log( 'end1 x:' + newX + ' y:' + newY ); + console.log( 'end1 x:' + newX + ' y:' + newY ); this.scrollTo( newX, newY, 0, '', 1000 ); // ensures that the last position is rounded this[ 'dispatch' ]( X.UI.Event.SCROLL_END ); @@ -482,7 +478,7 @@ function X_UI_ScrollBox_resetPosition( that, time ){ }; if( x === that.scrollX && y === that.scrollY ){ - //console.log( 'no バウンド y:' + y + ' max:' + that.maxScrollY ); + console.log( 'no バウンド y:' + y + ' max:' + that.maxScrollY ); return false; }; @@ -497,7 +493,6 @@ function X_UI_ScrollBox_onAnimeEnd( e ){ if( e.target !== this._containerXNode || !this.isInTransition ){ return X_Callback_NONE; }; - //this.xnodeScroller.stop(); if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){ this.isInTransition = false; this.dispatch( X.UI.Event.SCROLL_END ); diff --git a/0.6.x/js/20_ui/20_PageRoot.js b/0.6.x/js/20_ui/20_PageRoot.js index 8890fd4..26ce539 100644 --- a/0.6.x/js/20_ui/20_PageRoot.js +++ b/0.6.x/js/20_ui/20_PageRoot.js @@ -2,7 +2,7 @@ var X_UI_rootData = null, X_UI_eventBusy = false; function X_UI_eventRellay( e ){ - var font = X[ 'ViewPort' ][ 'getBaseFontSize' ](), + var font = X_ViewPort_baseFontSize, x = e.clientX / font, y = e.clientY / font, type = X.UI.Event.NameToID[ e.type ], @@ -114,7 +114,7 @@ X.UI._PageRoot = X.UI._Box.inherits( } ); // hover や rollover rollout のための move イベントの追加 - this.xnodeInteractiveLayer[ 'listen' ]( 'pointermove', X_UI_eventRellay ); + ( X.UA.IE < 9 ? X_ViewPort_document : X_ViewPort )[ 'listen' ]( 'pointermove', X_UI_eventRellay ); if( counter[ X.UI.Event._POINTER_MOVE ] ){ ++counter[ X.UI.Event._POINTER_MOVE ]; } else {