var ZLei_Scene={widgetEventPrefix:"scene",options:{width:0,height:0,blockWidth:256,blockHeight:256,blockColumns:0,blockRows:0,blockUrlFormat:"",visualWidth:undefined,visualHeight:undefined,visualRectangle:{top:0,right:0,bottom:0,left:0},scrollTop:0,scrollLeft:0},_elementBlocks:null,_currentBlocks:null,_loadedBlocks:null,_create:function(){this._elementBlocks=$('
');this._currentBlocks={left:-1,top:-1,right:-1,bottom:-1};this.element.addClass("ZLei-Scene").append(this._elementBlocks.css({width:this.options.width,height:this.options.height}));this.options.blockColumns=Math.ceil(this.options.width/this.options.blockWidth);this.options.blockRows=Math.ceil(this.options.height/this.options.blockHeight);this._loadedBlocks=new Array();for(var a=0;aimg":function(b,a,d){this._loadedBlocks[d][a]=true;TweenLite.to($(b.target),0.5,{opacity:1})}},_refresh:function(){var b=this.getVisibleBlocks();if(b.left==this._currentBlocks.left&&b.right==this._currentBlocks.right&&b.top==this._currentBlocks.top&&b.bottom==this._currentBlocks.bottom){return}$("img",this._elementBlocks).filter(function(g){var h=$(this).attr("block-column");var i=$(this).attr("block-row");return(hb.right||ib.bottom)}).remove();var a="";for(var e=b.top;ef&&this._currentBlocks.tope){continue}var d="";if(!this._loadedBlocks[e][f]){d+='class="collapsed"';d+="onload=\"$(event.target).trigger('loaded', ["+f+","+e+']);"'}a+="'}}this._elementBlocks.append(a);this._currentBlocks=b},getVisibleBlocks:function(){var d=Math.floor(this.options.visualRectangle.left/this.options.blockWidth);var f=Math.ceil(this.options.visualRectangle.right/this.options.blockWidth);var e=Math.floor(this.options.visualRectangle.top/this.options.blockHeight);var a=Math.ceil(this.options.visualRectangle.bottom/this.options.blockHeight);return{left:d,top:e,right:f,bottom:a}},setVisibleSize:function(b,a){if(this.options.visualWidth==b&&this.options.visualHeight==a){return}this.options.visualWidth=b;this.options.visualHeight=a;this.element.scroll();this._trigger("change")},getInvisibleWidth:function(){return this.options.visualWidth-this.options.width},getInvisibleHeight:function(){return this.options.visualHeight-this.options.height}};$.widget("ZLei.Scene",ZLei_Scene);