From: itozyun Date: Sat, 31 Oct 2015 14:05:49 +0000 (+0900) Subject: Version 0.6.187, add Scroll-Indicator for X.UI.ScrollBox, bugfix of X.HTMLAudio. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=b28fd52ddc41a1c927f92fa7eeeb6891c41e55d9 Version 0.6.187, add Scroll-Indicator for X.UI.ScrollBox, bugfix of X.HTMLAudio. --- diff --git a/0.6.x/css/xui.css b/0.6.x/css/xui.css index cfebdab..e676fed 100644 --- a/0.6.x/css/xui.css +++ b/0.6.x/css/xui.css @@ -127,6 +127,63 @@ background : url( "../img/opacity0.gif" ) fixed repeat; } + +.slidein, .slideout { + position : relative; + width : 200px; + height : 200px; + margin : 1em auto; + background : #000; + + -webkit-transition : 0.5s ease-in-out; /* win safari3.2 */ + -webkit-transition : -webkit-transform 0.5s ease-in-out; /* win safari4 delay は指定しない */ + -moz-transition : -moz-transform 0.5s ease-in-out 0s; + -ms-transition : -ms-transform 0.5s ease-in-out 0s; + -o-transition : -o-transform 0.5s ease-in-out 0s; + transition : transform 0.5s ease-in-out 0s; + + /* http://blog.webcreativepark.net/2012/10/19-161432.html */ + -webkit-backface-visibility : hidden; + -moz-backface-visibility : hidden; + backface-visibility : hidden; +} +.slidein .slider { + -webkit-transform : translate(100px,0); /* win safari3.2 */ + -webkit-transform : translateX(100px) translateZ(0); /* safari4 */ + -moz-transform : translateX(100px) translateZ(0); + -ms-transform : translateX(100px) translateZ(0); + -o-transform : translateX(100px) translateZ(0); + transform : translateX(100px) translateZ(0); +} +.slideout .slider { + -webkit-transform : translate(0,0); /* win safari3.2 */ + -webkit-transform : translateX(0) translateZ(0); /* safari4 */ + -moz-transform : translateX(0) translateZ(0); + -ms-transform : translateX(0) translateZ(0); + -o-transform : translateX(0) translateZ(0); + transform : translateX(0) translateZ(0); +} +.slider { + position : absolute; + top : 0; + height : 0; +} +.slider div { + position : absolute; + top : 0; + width : 200px; + height : 200px; +} +.slider-red { + left : 0; + background : #f00; +} +.slider-blue { + left : 200; + background : #00f; +} + + /*------------------------------------------------------------------------------------ * hidden-sysyem-node */ @@ -182,80 +239,23 @@ transformOrigin : '0 0'; position : absolute; } - .ScrollBox-Scrollbar-Wrapper-V, - .ScrollBox-Scrollbar-Wrapper-H, - .ScrollBox-Scrollbar-Wrapper-V-withH, - .ScrollBox-Scrollbar-Wrapper-H-withV { - position : absolute; - z-index : 100; - overflow : hidden; - } - .ScrollBox-Scrollbar-Wrapper-V, - .ScrollBox-Scrollbar-Wrapper-V-withH { - width : 7px; - top : 2px; - right : 1px; - } - .ScrollBox-Scrollbar-Wrapper-V { - bottom : 2px; - } - .ScrollBox-Scrollbar-Wrapper-V-withH { - bottom : 7px; - } - .ScrollBox-Scrollbar-Wrapper-H, - .ScrollBox-Scrollbar-Wrapper-H-withV { - height : 7px; - bottom : 1px; - left : 2px; - } - .ScrollBox-Scrollbar-Wrapper-H { - right : 2px; + .Root .ScrollBox-IndicatorV, + .Root .ScrollBox-IndicatorH { + position : absolute; + overflow : hidden; + background : #000; + background : rgba(0,0,0,0.5); + border : 0; } - .ScrollBox-Scrollbar-Wrapper-H-withV { - right : 7px; + .Root .ScrollBox-IndicatorV { + top : 0; + right : 0.1em; + left : auto; + width : 0.5em; + } + .Root .ScrollBox-IndicatorH { + top : auto; + bottom : 0.1em; + left : 0; + height : 0.5em; } - .ScrollBox-Scrollbar-Indicator-V, - .ScrollBox-Scrollbar-Indicator-H { - position : absolute; - z-index : 100; - background : #000; - background : rgba(0,0,0,0.5); - border : 1px solid #fff; - border : 1px solid rgba(255,255,255,0.9); - background-clip : padding-box; - -o-background-clip : padding-box; - -ms-background-clip : padding-box; - -moz-background-clip : padding-box; - -khtml-background-clip : padding-box; - -webkit-background-clip : padding-box; - box-sizing : border-box; - -o-box-sizing : border-box; - -ms-box-sizing : border-box; - -moz-box-sizing : border-box; - -khtml-box-sizing : border-box; - -webkit-box-sizing : border-box; - border-radius : 3px; - -o-border-radius : 3px; - -ms-border-radius : 3px; - -moz-border-radius : 3px; - -khtml-border-radius : 3px; - -webkit-border-radius : 3px; - transition-property : transform; - -o-transition-property : -o-transform; - -ms-transition-property : -ms-transform; - -moz-transition-property : -moz-transform; - -khtml-transition-property : -khtml-transform; - -webkit-transition-property : -webkit-transform; - transform: translate(0,0); - -o-transform: translate(0,0); - -ms-transform: translate(0,0); - -moz-transform: translate(0,0); - -khtml-transform: translate(0,0); - -webkit-transform: translate(0,0); - } - .ScrollBox-Scrollbar-Indicator-V { - width:100%; - } - .ScrollBox-Scrollbar-Indicator-H { - height:100%; - } \ No newline at end of file diff --git a/0.6.x/js/01_core/02_XUA.js b/0.6.x/js/01_core/02_XUA.js index c96fd6c..6f6e58b 100644 --- a/0.6.x/js/01_core/02_XUA.js +++ b/0.6.x/js/01_core/02_XUA.js @@ -728,20 +728,20 @@ var X_UA = X[ 'UA' ] = {}, // TODO CE3 の ie4 と WM の ie4 の分岐 X_UA_classNameForHTML = 'WinCE'; } else - if( X_UA[ 'Win' ] ){ + if( X_UA[ 'Windows' ] ){ X_UA_classNameForHTML = 'Win'; } else { X_UA_classNameForHTML = 'Other'; }; - X_UA_classNameForHTML += 'IE4'; + X_UA_classNameForHTML += '_IE4'; if( X_UA[ 'IE45' ] ){ X_UA_classNameForHTML += '5'; }; if( X_UA[ 'ActiveX' ] ){ - X_UA_classNameForHTML += 'ActiveX'; + X_UA_classNameForHTML += '_ActiveX'; }; } else { diff --git a/0.6.x/js/02_dom/03_XDomEvent.js b/0.6.x/js/02_dom/03_XDomEvent.js index 98d86f0..5a8069f 100644 --- a/0.6.x/js/02_dom/03_XDomEvent.js +++ b/0.6.x/js/02_dom/03_XDomEvent.js @@ -11,7 +11,7 @@ */ // http://msdn.microsoft.com/ja-jp/library/ie/dn255104%28v=vs.85%29.aspx -var X_Dom_Event_devicePixelRatio = window.devicePixelRatio || ( window.screen.deviceXDPI / window.screen.logicalXDPI ), +var X_Dom_Event_devicePixelRatio = window.devicePixelRatio || ( window.screen.deviceXDPI / window.screen.logicalXDPI ) || 1, X_Dom_Event_convertMSPointerType = ( !window.PointerEvent && window.MSPointerEvent ) && [ 0, 0, 'touch', 'pen', 'mouse' ], // WP8.1 は PointerEvent と MSPointerEvent 両方ある /*{ @@ -22,6 +22,12 @@ var X_Dom_Event_devicePixelRatio = window.devicePixelRatio || ( window.screen.de X_Dom_Event_CANCEL_MOUSE = {}, X_DomEvent; +if( X_Dom_Event_devicePixelRatio !== 1 ){ + X_UA_classNameForHTML += ' dpr' + X_Dom_Event_devicePixelRatio; + + X_UA[ 'dpr' ] = X_Dom_Event_devicePixelRatio; +}; + if( !X_UA[ 'IE' ] || 9 <= X_UA[ 'IE' ] ){ X_DomEvent = function( e, xnode ){ var originalType = e.type, diff --git a/0.6.x/js/02_dom/06_XNodeCSS.js b/0.6.x/js/02_dom/06_XNodeCSS.js index 4938a3a..22b3e02 100644 --- a/0.6.x/js/02_dom/06_XNodeCSS.js +++ b/0.6.x/js/02_dom/06_XNodeCSS.js @@ -299,7 +299,7 @@ function X_Node_CSS_objToCssText( that, skipFilter ){ var X_Node_CSS_FILTER_FIX_PROPS = - X_UA[ 'ActiveX' ] && X_UA[ 'IE' ] < 9 && !X_UA[ 'MacIE' ] ? + X_UA[ 'ActiveX' ] && X_UA[ 'IE' ] < 9 ? { 'opacity' : 2, 'boxShadow' : 3, diff --git a/0.6.x/js/02_dom/10_XNodeAnime.js b/0.6.x/js/02_dom/10_XNodeAnime.js index 8bb80ef..2d20bad 100644 --- a/0.6.x/js/02_dom/10_XNodeAnime.js +++ b/0.6.x/js/02_dom/10_XNodeAnime.js @@ -382,7 +382,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[ 'asyncDispatch' ]( time, { type : X_EVENT_ANIME_END, 'gpu' : obj.gpuParent } ); + xnode[ 'dispatch' ]( time, { type : X_EVENT_ANIME_END, 'gpu' : obj.gpuParent } ); } else { current = X_Node_Anime_getComputedPosition( xnode ); obj.startX = current.x; @@ -501,15 +501,15 @@ function X_Node_Anime_updatePosition( xnode, x, y, opacity, useGPU ){ if( X_Node_Anime_hasTransform ){ xnode[ 'css' ]({ transform : 'translate(' + ( x | 0 ) + 'px,' + ( y | 0 ) + 'px)' + ( useGPU ? X_Node_Anime_translateZ : '' ), - opacity : opacity === 1 ? '' : opacity + opacity : opacity }); } else { x === x && xnode[ 'css' ]({ left : ( x | 0 ) + 'px', - opacity : opacity === 1 ? '' : opacity }); + opacity : opacity }); y === y && xnode[ 'css' ]({ top : ( y | 0 ) + 'px', - opacity : opacity === 1 ? '' : opacity }); + opacity : opacity }); }; if( X_Node_Anime_translateZ ){ diff --git a/0.6.x/js/03_plugin/00_XPlugin.js b/0.6.x/js/03_plugin/00_XPlugin.js index ffcdedc..b73cffe 100644 --- a/0.6.x/js/03_plugin/00_XPlugin.js +++ b/0.6.x/js/03_plugin/00_XPlugin.js @@ -25,9 +25,6 @@ var X_Pulgin_FLASH_VERSION = })() : 0, -/* - * ie11 の 互換モード(8,7)では、Silverlight が動作しない? - */ X_Pulgin_SILVER_LIGHT_VERSION = !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? parseFloat( X_Object_find( navigator, 'plugins>Silverlight Plug-In>version' ) || 0 ) : X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] ? (function(){ @@ -47,8 +44,7 @@ var X_Pulgin_FLASH_VERSION = parseFloat( X_Object_find( navigator, 'plugins>Unity Player>version' ) || 0 ) : !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){ var obj = X_Script_createActiveXObjectSafty( 'UnityWebPlayer.UnityWebPlayer.1' ); - - //console.log( obj && obj[ 'GetPluginVersion' ]() ); + return obj ? parseFloat( obj[ 'GetPluginVersion' ]() ) : 0; })() : 0, @@ -66,7 +62,7 @@ var X_Pulgin_FLASH_VERSION = // Windows Media Player 7 がクライアントにインストールされている場合に、自動的に Web ページに埋め込む方法 // TODO GeckoActiveXObject X_Pulgin_WMP_VERSION = - !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? parseFloat( X_Object_find( navigator, 'plugins>Windows Media Player Plug-in Dynamic Link Library>version' ) || 0 ) : + !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? 0 : (function(){ var obj = X_Script_createActiveXObjectSafty( 'WMPlayer.OCX.7' ); diff --git a/0.6.x/js/05_util/01_XNinjaIframe.js b/0.6.x/js/05_util/01_XNinjaIframe.js index 9964d58..b39d0eb 100644 --- a/0.6.x/js/05_util/01_XNinjaIframe.js +++ b/0.6.x/js/05_util/01_XNinjaIframe.js @@ -54,7 +54,7 @@ var X_NinjaIframe = X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( if( html ) this._contentHTML = html; - this[ 'appendTo' ]( X_Node_body /* X_Node_systemNode */ ) + this[ 'appendTo' ]( X_Node_systemNode ) [ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, X_Util_NinjaIframe_handleEvent ); X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, X_Util_NinjaIframe_handleEvent ); @@ -77,13 +77,13 @@ var X_NinjaIframe = X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( this._iwin.location.reload(); }; - if( !opt_contentHTML && opt_contentHTML !== '' ) return this; + if( !X_Type_isString( opt_contentHTML ) ) return this; this._contentHTML = opt_contentHTML; if( !( X_UA[ 'IE' ] < 9 ) ){ X_Util_NinjaIframe_writeToIframe( this ); - this._ready = true; + //this._ready = true; }; return this; @@ -103,11 +103,11 @@ function X_Util_NinjaIframe_handleEvent( e ){ // こちらに名前をsetしないとtargetが動作しない if( X_UA[ 'IE' ] ) this._iwin.name = this._name; - this[ 'listen' ]( [ X_UA[ 'IE' ] < 9 ? 'readystatechange' : 'load', 'error' ], this, X_Util_NinjaIframe_handleEvent ); + this[ 'listen' ]( X_UA[ 'IE' ] < 9 ? 'readystatechange' : [ 'load', 'error' ], X_Util_NinjaIframe_handleEvent ); if( !( X_UA[ 'IE' ] < 9 ) ){ - ( this._contentHTML || this._contentHTML === '' ) && X_Util_NinjaIframe_writeToIframe( this ); - this._ready = true; + X_Util_NinjaIframe_writeToIframe( this ); + //this._ready = true; return; }; //break; これあると IE8 で駄目! @@ -116,8 +116,8 @@ function X_Util_NinjaIframe_handleEvent( e ){ if( ( raw.readyState !== 'complete' && raw.readyState !== 'loaded' ) ) break; // ie9- if( !this._ready ){ - ( this._contentHTML || this._contentHTML === '' ) && X_Util_NinjaIframe_writeToIframe( this ); - this._ready = true; + X_Util_NinjaIframe_writeToIframe( this ); + //this._ready = true; break; }; // onload diff --git a/0.6.x/js/07_audio/00_XAudio.js b/0.6.x/js/07_audio/00_XAudio.js index 49d1ee1..5d714c2 100644 --- a/0.6.x/js/07_audio/00_XAudio.js +++ b/0.6.x/js/07_audio/00_XAudio.js @@ -28,11 +28,11 @@ X_TEMP.onSystemReady.push( *

複数のバックエンドから、与えられた音声を再生可能なものを見つけ、音声を再生します。 *

HTMLAudio の動作・機能がブラウザ毎にバラバラなのに業を煮やし、メソッドやイベントは独自に定義しています。 *

バックエンドの種類

- *

HTMLAudio, WebAudio, Silverlight + *

HTMLAudio, WebAudio, Silverlight, WMP *

イベント

*
*
X.Event.BACKEND_READY
音声(src リスト)を再生可能なバックエンドが見つかった。 - *
X.Event.BACKEND_NONE
音声を再生可能なバックエンドが見つからなかった。 + *
X.Event.BACKEND_NONE
音声を再生可能なバックエンドが見つからなかった。Audio は kill されます。 *
X.Event.READY
再生可能、実際の状態は canplay から loadeddata まで様々、、、 *
X.Event.ERROR
    *
  • 1 : ユーザーによってメディアの取得が中断された @@ -40,13 +40,14 @@ X_TEMP.onSystemReady.push( *
  • 3 : メディアのデコードエラー *
  • 4 : メディアがサポートされていない *
- *
X.Event.MEDIA_PLAYING
再生中に1秒以下のタイミングで発生.currentTime が取れる? - *
X.Event.MEDIA_LOOP
ループ直前に発生、キャンセル可能 - *
X.Event.MEDIA_LOOPED
ループ時に発生 - *
X.Event.MEDIA_ENDED
再生位置の(音声の)最後についた - *
X.Event.MEDIA_PAUSED
ポーズした - *
X.Event.MEDIA_WAITING
再生中に音声が待機状態に。 - *
X.Event.MEDIA_SEEKING
シーク中に音声が待機状態に。 + *
X.Event.MEDIA_PLAYING
再生中に1秒以下のタイミングで発生.currentTime が取れる? + *
X.Event.MEDIA_LOOP
ループ直前に発生、キャンセル可能 + *
X.Event.MEDIA_LOOPED
ループ時に発生 + *
X.Event.MEDIA_ENDED
再生位置の(音声の)最後についた + *
X.Event.MEDIA_PAUSED
ポーズした + *
X.Event.MEDIA_WAITING
再生中に音声が待機状態に。 + *
X.Event.MEDIA_SEEKING
シーク中に音声が待機状態に。 + *
X.Event.MEDIA_CAN_TOUCH
シーク中に音声が待機状態に。 *
* * @alias X.Audio @@ -76,6 +77,7 @@ X[ 'Audio' ] = X_EventDispatcher[ 'inherits' ]( */ 'backendName' : '', + // TODO 'Constructor' : function( sourceList, opt_option ){ X_Audio_startDetectionBackend( X_Audio_BACKENDS[ 0 ], this, diff --git a/0.6.x/js/07_audio/01_XWebAudio.js b/0.6.x/js/07_audio/01_XWebAudio.js index 9fc97e7..7361e99 100644 --- a/0.6.x/js/07_audio/01_XWebAudio.js +++ b/0.6.x/js/07_audio/01_XWebAudio.js @@ -1,8 +1,8 @@ var X_Audio_constructor = 3.1 <= X_UA[ 'Safari' ] && X_UA[ 'Safari' ] < 4 ? function( s, a ){ - a = document.createElement( 'audio' ); - a.src = s; - a.load(); + //a = document.createElement( 'audio' ); + //a.src = s; + //a.load(); return a; } : // Android1.6 + MobileOpera12 HTMLAudio はいるが呼ぶとクラッシュする @@ -323,6 +323,8 @@ if( X_WebAudio_context ){ // alert( 'タッチイベント以外での play! ' + ( e ? e.type : '' ) ); return; }; + // http://qiita.com/uupaa/items/e5856e3cb2a9fc8c5507 + // iOS9 + touchstart で呼んでいた場合、 X_ViewPort['listenOnce']('pointerup',this,this.actualPlay()) this.disatcher[ 'asyncDispatch' ]( X_EVENT_READY ); }; X_WebAudio_touchState = false; @@ -369,7 +371,7 @@ if( X_WebAudio_context ){ _sourceDispose : function(){ this.bufferSource.disconnect(); - delete this.bufferSource.onended; + //delete this.bufferSource.onended; delete this.bufferSource; }, @@ -421,7 +423,7 @@ if( X_WebAudio_context ){ delete this.playing; if( this.bufferSource ){ - if( this.bufferSource.onended ) delete this.bufferSource.onended; + //if( this.bufferSource.onended ) delete this.bufferSource.onended; this.bufferSource.stop ? this.bufferSource.stop( 0 ) : this.bufferSource[ 'noteOff' ]( 0 ); diff --git a/0.6.x/js/07_audio/02_XHTMLAudio.js b/0.6.x/js/07_audio/02_XHTMLAudio.js index 03f8cca..7acc1e0 100644 --- a/0.6.x/js/07_audio/02_XHTMLAudio.js +++ b/0.6.x/js/07_audio/02_XHTMLAudio.js @@ -83,6 +83,7 @@ if( X_Audio_constructor ){ { // 1: canplaythrought|timeupdateに達している、またはdurationFixが終了している // 2: READY イベント発火済 + // 3: 1, 2 が済 _readyState : 0, _src : '', @@ -216,7 +217,7 @@ if( X_Audio_constructor ){ // console.log( e.loaded + ' ' + e.total * 100 + '%' ); // iem9 で常に0 raw.networkState; // opera Android 12 で buffered.end() へのアクセスはエラー try catch も無効、iem9 は常に end(0) = 0 - if( X_HTMLAudio_progressEnabled && this.duration && this._readyState < 2 ){ + if( X_HTMLAudio_progressEnabled && this.duration && this._readyState < 3 ){ buf = raw.buffered; time = 0; for( i = 0, l = buf.length; i < l; ++i ){ @@ -366,7 +367,7 @@ if( X_Audio_constructor ){ }; } else if( this._readyState === 1 && this.duration ){ - this._readyState = 2; + this._readyState |= 2; this.disatcher[ 'asyncDispatch' ]( X_EVENT_READY ); console.log( '> Audio Loaded!! ' + e.type + ' d:' + ( this.duration | 0 ) ); } else @@ -402,7 +403,7 @@ if( X_Audio_constructor ){ }; this._touchState = 3; } else - if( this._readyState !== 2 && this._durationFixPhase < 2 ){ + if( this._readyState !== 3 && this._durationFixPhase < 2 ){ return; }; diff --git a/0.6.x/js/07_audio/03_XSilverlightAudio.js b/0.6.x/js/07_audio/03_XSilverlightAudio.js index ff2f7b5..3b9d94d 100644 --- a/0.6.x/js/07_audio/03_XSilverlightAudio.js +++ b/0.6.x/js/07_audio/03_XSilverlightAudio.js @@ -412,6 +412,8 @@ if( X_Pulgin_SILVER_LIGHT_VERSION ){ }, detect : function( proxy, source, ext ){ + // TODO source = .mp3#CBR + // 得意度で返す proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : ext === 'mp3' || ext === 'wma' || ext === 'wav' } ); }, diff --git a/0.6.x/js/07_audio/05_XWMPAudio.js b/0.6.x/js/07_audio/05_XWMPAudio.js index 075f537..7c6964f 100644 --- a/0.6.x/js/07_audio/05_XWMPAudio.js +++ b/0.6.x/js/07_audio/05_XWMPAudio.js @@ -218,12 +218,12 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可 'snd' : true, 'au' : true, 'aif' : true, - 'aicf' : true, - 'aiff' : true + 'aiff' : true, + 'aicf' : true }, detect : function( proxy, source, ext ){ - proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : ext === 'mp3' || ext === 'wma' || ext === 'wav' } ); + proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : 0 <= 'mp3 wma wav midi snd au aiff aicf'.indexOf( ext ) } ); }, klass : X_WMPAudio diff --git a/0.6.x/js/20_ui/02_XUI_Attr.js b/0.6.x/js/20_ui/02_XUI_Attr.js index 447c496..b33ea9d 100644 --- a/0.6.x/js/20_ui/02_XUI_Attr.js +++ b/0.6.x/js/20_ui/02_XUI_Attr.js @@ -76,7 +76,7 @@ var XUI_Attr_AUTO = 1/0,//Number.POSITIVE_INFINITY, pointerEnabled : [ false, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.BOOLEAN ], pointerChildren : [ true, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.BOOLEAN ], cursor : [ 1, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.LIST, XUI_Attr_Option.CURSOR ], - tooltip : [ '', XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.STRING ], + tooltip : [ '', XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.STRING ], borderWidth : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.QUARTET | XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ], // em [ top, right, bottom, left ] padding : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.QUARTET | XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ], diff --git a/0.6.x/js/20_ui/06_AbstractUINode.js b/0.6.x/js/20_ui/06_AbstractUINode.js index a432110..63bddf4 100644 --- a/0.6.x/js/20_ui/06_AbstractUINode.js +++ b/0.6.x/js/20_ui/06_AbstractUINode.js @@ -81,7 +81,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( addToParent : function( xnodeParent ){ var attr = this.attrObject || this.attrClass.prototype, usableAttrs = this.usableAttrs, - i = 0, l = usableAttrs.length, def; + i = 0, l = usableAttrs.length, def, k; xnodeParent && xnodeParent[ 'append' ]( this.xnode ); @@ -1038,7 +1038,7 @@ X.UI.AbstractUINode = X_Class_create( var newNode, //newPair = X_Pair_get( newNode ), pair = X_Pair_get( this ), - attr, listeners, type, list, i, l; + attr, listeners, type, list, i, l, k; // attr もコピー if( pair.attrObject ){ diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 817ebdb..f2f6a27 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -3,6 +3,53 @@ * ScrollManager * indicatorX, Y は再利用 */ +var XUI_ScrollBox_current, + XUI_ScrollBox_indicatorV, + XUI_ScrollBox_indicatorH; + +function XUI_ScrollBox_start( scrollBox ){ + // 既存スクロールの停止 + if( scrollBox.hasVScroll ){ + if( !XUI_ScrollBox_indicatorV ){ + XUI_ScrollBox_indicatorV = X_Doc_create( 'div' )[ 'className' ]( 'ScrollBox-IndicatorV' ); + + }; + XUI_ScrollBox_indicatorV.parent !== scrollBox.xnode && scrollBox.xnode[ 'append' ]( XUI_ScrollBox_indicatorV ); + XUI_ScrollBox_indicatorV[ 'animate' ]( + { opacity : 0 }, + { opacity : 1 }, + 900, 'circular', 300 + ); + scrollBox + [ 'listenOnce' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorV, XUI_ScrollBox_indicatorHandleEvent ); + }; + if( scrollBox.hasHScroll ){ + if( !XUI_ScrollBox_indicatorH ){ + XUI_ScrollBox_indicatorH = X_Doc_create( 'div' )[ 'className' ]( 'ScrollBox-IndicatorH' ); + }; + XUI_ScrollBox_indicatorH.parent !== scrollBox.xnode && scrollBox.xnode[ 'append' ]( XUI_ScrollBox_indicatorH ); + XUI_ScrollBox_indicatorH[ 'animate' ]( + { opacity : 0 }, + { opacity : 1 }, + 900, 'circular', 300 + ); + scrollBox + [ 'listenOnce' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorH, XUI_ScrollBox_indicatorHandleEvent ); + }; +}; + +function XUI_ScrollBox_indicatorHandleEvent( e ){ + switch( e.type ){ + case X_EVENT_CANCELED : + case XUI_Event.SCROLL_END : + this[ 'animate' ]( + { opacity : 1 }, + { opacity : 0 }, + 900, 'circular', 300 + ); + break; + }; +}; var X_UI_ScrollBox_SUPPORT_ATTRS = { @@ -80,9 +127,6 @@ var XUI_ScrollBox = XUI_ChromeBox.inherits( _containerNode : null, xnodeSlider : null, - xnodeIndicatorX : null, - xnodeIndicatorY : null, - Constructor : function( user, layout, args ){ this[ 'Super' ]( user, layout, args ); this._containerNode = X_Pair_get( this.containerNode ); @@ -110,6 +154,7 @@ var XUI_ScrollBox = XUI_ChromeBox.inherits( this.lastScrollHeight !== this._containerNode.boxHeight || 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 ); }; }, @@ -141,8 +186,8 @@ function X_UI_ScrollBox_onLayoutBefore( e ){ this[ 'listenOnce' ]( XUI_Event.SCROLL_END, X_UI_rootData, X_UI_rootData.calculate ); return X_CALLBACK_PREVENT_DEFAULT; }; - this.scrollXRatio = this.scrollX ? this.scrollXMax / this.scrollX : 0; - this.scrollYRatio = this.scrollY ? this.scrollYMax / this.scrollY : 0; + this.scrollXRatio = this.scrollX / this.scrollXMax; + this.scrollYRatio = this.scrollY / this.scrollYMax; this.xnodeSlider[ 'stop' ](); this.isInTransition = false; return X_CALLBACK_NONE; @@ -199,34 +244,68 @@ function X_UI_ScrollBox_onLayoutComplete( e ){ }; }; - // TODO use scrollLeft, scrollTop - function X_UI_ScrollBox_translate( that, x, y, opt_time, opt_easing, opt_release ){ - - opt_time = 0 <= opt_time ? opt_time : 0; - opt_easing = opt_easing === '' ? '' : opt_easing || 'circular'; - opt_release = 0 <= opt_release ? opt_release : 300; - - that.xnodeSlider[ 'animate' ]( - { - x : that.scrollX, - y : that.scrollY - }, - { - x : x, - y : y - }, - opt_time, opt_easing, opt_release - ); - - that.scrollX = x; - that.scrollY = y; - - if( that.indicators ){ - for( i = that.indicators.length; i--; ){ - that.indicators[ i ].updatePosition(); - }; - }; - }; +// TODO use scrollLeft, scrollTop +function X_UI_ScrollBox_translate( that, x, y, opt_time, opt_easing, opt_release ){ + var scrollBoxSize, indicatorSize; + + opt_time = 0 <= opt_time ? opt_time : 0; + opt_easing = opt_easing === '' ? '' : opt_easing || 'circular'; + opt_release = 0 <= opt_release ? opt_release : 300; + + that.xnodeSlider[ 'animate' ]( + { + x : that.scrollX, + y : that.scrollY + }, + { + x : x, + y : y + }, + opt_time, opt_easing, opt_release + ); + + if( that.hasVScroll && XUI_ScrollBox_indicatorV ){ + scrollBoxSize = that.fontSize * that.boxHeight; + indicatorSize = scrollBoxSize * scrollBoxSize / ( - that.scrollYMax + scrollBoxSize ); + scrollBoxSize -= indicatorSize; + XUI_ScrollBox_indicatorV + [ 'css' ]({ + height : ( indicatorSize | 0 ) + 'px' + }) + [ 'animate' ]( + { + y : scrollBoxSize * that.scrollY / that.scrollYMax + }, + { + y : scrollBoxSize * y / that.scrollYMax, + opacity : 1 + }, + opt_time, opt_easing, opt_release + ); + }; + if( that.hasHScroll && XUI_ScrollBox_indicatorH ){ + scrollBoxSize = that.fontSize * that.boxWidth; + indicatorSize = scrollBoxSize * scrollBoxSize / ( - that.scrollXMax + scrollBoxSize ); + scrollBoxSize -= indicatorSize; + XUI_ScrollBox_indicatorH + [ 'css' ]({ + width : ( indicatorSize | 0 ) + 'px' + }) + [ 'animate' ]( + { + x : scrollBoxSize * that.scrollX / that.scrollXMax + }, + { + x : scrollBoxSize * x / that.scrollXMax, + opacity : 1 + }, + opt_time, opt_easing, opt_release + ); + }; + + that.scrollX = x; + that.scrollY = y; +}; function X_UI_ScrollBox_onStart( e ){ var ret = X_CALLBACK_NONE; @@ -252,6 +331,7 @@ function X_UI_ScrollBox_onStart( e ){ // スクロール中の停止 if( this.isInTransition ){ this.isInTransition = false; + console.log( '-1-' ); this[ 'dispatch' ]( XUI_Event.SCROLL_END ); // TODO current位置 this.xnodeSlider[ 'stop' ](); @@ -341,6 +421,8 @@ function X_UI_ScrollBox_onMove( e ){ this.moved = true; this.minusX = deltaX; this.minusY = deltaY; + // indicator + XUI_ScrollBox_start( this ); } else { this[ 'dispatch' ]( XUI_Event.SCROLL_MOVE ); }; @@ -405,7 +487,7 @@ function X_UI_ScrollBox_onEnd( e ){ // we scrolled less than 10 pixels if( !this.moved ){ - // this[ 'dispatch' ]( X_EVENT_CANCELED ); + this[ 'dispatch' ]( X_EVENT_CANCELED ); console.log( 'we scrolled less than 10 pixels ' + e.pageY ); return ret; }; @@ -434,14 +516,12 @@ function X_UI_ScrollBox_onEnd( e ){ console.log( 'end2 x:' + newX + ' y:' + newY + ' t:' + time ); this.scrollTo( newX, newY, time, easing, 1000 ); - return ret; + } else { + console.log( 'end1 x:' + newX + ' y:' + newY ); + this.scrollTo( newX, newY, 0, '', 1000 ); // ensures that the last position is rounded + console.log( '-3-' ); + this[ 'dispatch' ]( XUI_Event.SCROLL_END ); }; - - console.log( 'end1 x:' + newX + ' y:' + newY ); - this.scrollTo( newX, newY, 0, '', 1000 ); // ensures that the last position is rounded - - this[ 'dispatch' ]( XUI_Event.SCROLL_END ); - return ret; }; @@ -478,11 +558,9 @@ function X_UI_ScrollBox_resetPosition( that, time ){ }; function X_UI_ScrollBox_onAnimeEnd( e ){ - if( e.target !== this.xnodeSlider || !this.isInTransition ){ - return X_CALLBACK_NONE; - }; - if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){ + if( e.target === this.xnodeSlider && this.isInTransition && !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){ this.isInTransition = false; + console.log( '-2-' ); this[ 'dispatch' ]( XUI_Event.SCROLL_END ); }; return X_CALLBACK_NONE; diff --git a/0.6.x/js/20_ui/20_Root.js b/0.6.x/js/20_ui/20_Root.js index e1a756f..ae0cfba 100644 --- a/0.6.x/js/20_ui/20_Root.js +++ b/0.6.x/js/20_ui/20_Root.js @@ -140,7 +140,7 @@ var XUI_Root = XUI_Box.inherits( var cancelable = !e || ( e.type !== X_EVENT_VIEW_RESIZED && e.type !== X_EVENT_BASE_FONT_RESIZED ), size, font, w, h; - if( this[ 'dispatch' ]( { type : XUI_Event.LAYOUT_BEFORE, 'cancelable' : cancelable } ) & X_CALLBACK_PREVENT_DEFAULT && cancelable ){ + if( ( this[ 'dispatch' ]( { type : XUI_Event.LAYOUT_BEFORE, 'cancelable' : cancelable } ) & X_CALLBACK_PREVENT_DEFAULT ) && cancelable ){ return X_CALLBACK_NONE; };