X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=blobdiff_plain;f=0.6.x%2Fjs%2F06_net%2F04_XNetImage.js;fp=0.6.x%2Fjs%2F06_net%2F04_XNetImage.js;h=961190005105873276b24128bc6f68936fbfe274;hp=3bcc3b8f66073cde781a577e73310448a21138ad;hb=04ac203dfb25cc7e92db1f7f9f77122841f7cb1a;hpb=bafa8683f87b2f909d1301fca80684bf9ff221ed diff --git a/0.6.x/js/06_net/04_XNetImage.js b/0.6.x/js/06_net/04_XNetImage.js index 3bcc3b8..9611900 100644 --- a/0.6.x/js/06_net/04_XNetImage.js +++ b/0.6.x/js/06_net/04_XNetImage.js @@ -11,7 +11,7 @@ var X_ImgLoader_image = window[ 'Image' ] && new Image(), X_ImgLoader_isElement = !( X_UA[ 'IE' ] < 9 ) && X_Type_isHTMLElement( X_ImgLoader_image ), // http://uupaa.hatenablog.com/entry/2013/12/17/171809 // お手軽に画像の読み込みをハンドリングする、今どきな方法 - X_ImgLoader_0forError = !X_UA[ 'IE' ] || X_UA[ 'IE' ] === 11; + X_ImgLoader_0forError = !X_UA[ 'IE' ] || X_UA[ 'IE' ] === 11 || X_UA[ 'IEHost' ] === 11; /* * TODO @@ -64,15 +64,17 @@ X_TEMP.X_ImgLoader_params = { }, reset : function(){ - console.log( 'X.Net.Image:reset ' + this.abspath + ' timerID:' + this.timerID ); + //console.log( '/ X.Net.Image:reset ' + this.abspath + ' timerID:' + this.timerID ); this.timerID && X_Timer_remove( this.timerID ); this.timerID = 0; + this.finish = false; + this.abspath = ''; //X_ImgLoader_isElement ? this[ '_rawObject' ].removeAttribute( 'src' ) : ( this[ '_rawObject' ].src = '' ); this[ '_rawObject' ].src = ''; - this.finish = false; - this.abspath = ''; + + //console.log( '\ X.Net.Image:reset ----------- *' ); } }; @@ -83,14 +85,16 @@ function X_ImgLoader_detect(){ if( raw && raw.complete ){ this.finish = true; - console.log( 'X.Net.Image:detect ' + raw.width ); + //console.log( 'X.Net.Image:detect ' + raw.width ); if( raw.width ) return; X_Timer_remove( this.timerID ); + //console.log( '* X.Net.Image:ERROR @detect(1) ' + this.abspath ); this.timerID = this[ 'asyncDispatch' ]( X_EVENT_ERROR ); } else if( this.timeout < ( this.tick += this.delay ) ){ this.finish = true; X_Timer_remove( this.timerID ); + //console.log( '* X.Net.Image:ERROR @detect(2) ' + this.abspath ); this.timerID = this[ 'asyncDispatch' ]( { type : X_EVENT_ERROR, 'timeout' : true } ); }; }; @@ -100,17 +104,18 @@ function X_ImgLoader_handleEvent( e ){ // IE11 reset() 時にここに入ってくる... if( !this.abspath ) return; - console.log( 'X.Net.Image:handleEvent ' + e.type ); + //console.log( 'X.Net.Image:handleEvent ' + e.type ); switch( e.type ){ case 'error' : - //case 'abort' : // TODO ?? // ie11(10,9 開発モード)で mineType 不正の場合、画像取得に成功してもエラーイベントが起こるのを無視する。 if( X_ImgLoader_0forError && raw.width ) return; if( this.finish ) return; this.finish = true; this.timerID && X_Timer_remove( this.timerID ); - this.timerID = this[ 'asyncDispatch' ]( /*e.type === 'error' ?*/ X_EVENT_ERROR /*: X_EVENT_CANCELED*/ ); + //console.log( '* X.Net.Image:ERROR @handle ' + this.abspath + X.Timer.now() ); + //console.dir( raw ); + this.timerID = this[ 'asyncDispatch' ]( this.timeout, X_EVENT_ERROR ); break; case 'load' : @@ -123,6 +128,9 @@ function X_ImgLoader_handleEvent( e ){ return; }; + //console.log( '* X.Net.Image:LOAD @handle ' + this.abspath + X.Timer.now() ); + //console.dir( raw ); + size = X_Util_Image_getActualDimension( !X_ImgLoader_isElement ? this.abspath : this ); this.timerID = this[ 'asyncDispatch' ]( { 'type' : X_EVENT_SUCCESS,