UNPKG

layaair-js

Version:

An open source HTML5 engine. Edition JavaScript.

2 lines 386 kB
var window=window||global,document=document||(window.document={}),Laya=window.Laya=function(t,e){var i={__internals:[],__packages:{},__classmap:{Object:Object,Function:Function,Array:Array,String:String},__sysClass:{object:"Object",array:"Array",string:"String",dictionary:"Dictionary"},__propun:{writable:!0,enumerable:!1,configurable:!0},__presubstr:String.prototype.substr,__substr:function(t,e){return 1==arguments.length?i.__presubstr.call(this,t):i.__presubstr.call(this,t,e>0?e:this.length+e)},__init:function(t){t.forEach(function(t){t.__init$&&t.__init$()})},__isClass:function(t){return t&&(t.__isclass||t==Object||t==String||t==Array)},__newvec:function(t,e){var i=[];i.length=t;for(var n=0;t>n;n++)i[n]=e;return i},__extend:function(t,e){function n(){i.un(this,"constructor",t)}for(var s in e)if(e.hasOwnProperty(s)){var r=Object.getOwnPropertyDescriptor(e,s).get,a=Object.getOwnPropertyDescriptor(e,s).set;r||a?(r&&Object.defineProperty(t,s,r),a&&Object.defineProperty(t,s,a)):t[s]=e[s]}n.prototype=e.prototype,t.prototype=new n,i.un(t.prototype,"__imps",i.__copy({},e.prototype.__imps))},__copy:function(t,e){if(!e)return null;t=t||{};for(var i in e)t[i]=e[i];return t},__package:function(e,n){if(!i.__packages[e]){i.__packages[e]=!0;var s=t,r=e.split(".");if(r.length>1)for(var a=0,o=r.length-1;o>a;a++){var h=s[r[a]];s=h?h:s[r[a]]={}}s[r[r.length-1]]||(s[r[r.length-1]]=n||{})}},__hasOwnProperty:function(t,e){function i(t,e){if(Object.hasOwnProperty.call(e.prototype,t))return!0;var n=e.prototype.__super;return null==n?null:i(t,n)}return e=e||this,Object.hasOwnProperty.call(e,t)||i(t,e.__class)},__typeof:function(t,e){if(!t||!e)return!1;if(e===String)return"string"==typeof t;if(e===Number)return"number"==typeof t;if(e.__interface__)e=e.__interface__;else if("string"!=typeof e)return t instanceof e;return t.__imps&&t.__imps[e]||t.__class==e},__as:function(t,e){return this.__typeof(t,e)?t:null},"interface":function(e,n){i.__package(e,{});var s=i.__internals,r=s[e]=s[e]||{self:e};if(n){var a=n.split(",");r.extend=[];for(var o=0;o<a.length;o++){var e=a[o];s[e]=s[e]||{self:e},r.extend.push(s[e])}}for(var h=t,l=e.split("."),o=0;o<l.length-1;o++)h=h[l[o]];h[l[l.length-1]]={__interface__:e}},"class":function(e,n,s,r){if(s&&i.__extend(e,s),n)if(i.__package(n,e),i.__classmap[n]=e,n.indexOf(".")>0){if(0==n.indexOf("laya.")){var a=n.split(".");r=r||a[a.length-1],(i[r]&&console.log("Warning!,this class["+r+"] already exist:",i[r]),i[r]=e)}}else"Main"==n?t.Main=e:(i[n]&&console.log("Error!,this class["+n+"] already exist:",i[n]),i[n]=e);var o=i.un,h=e.prototype;o(h,"hasOwnProperty",i.__hasOwnProperty),o(h,"__class",e),o(h,"__super",s),o(h,"__className",n),o(e,"__super",s),o(e,"__className",n),o(e,"__isclass",!0),o(e,"super",function(t){this.__super.call(t)})},imps:function(t,e){function n(t){var e,r;if((e=i.__internals[t])&&(s[t]=!0,r=e.extend))for(var a=0;a<r.length;a++)n(r[a].self)}if(!e)return null;var s=t.__imps||i.un(t,"__imps",{});for(var r in e)n(r)},getset:function(t,e,n,s,r){t?(s&&(e["_$GET_"+n]=s),r&&(e["_$SET_"+n]=r)):(s&&i.un(e,"_$get_"+n,s),r&&i.un(e,"_$set_"+n,r)),s&&r?Object.defineProperty(e,n,{get:s,set:r,enumerable:!1}):(s&&Object.defineProperty(e,n,{get:s,enumerable:!1}),r&&Object.defineProperty(e,n,{set:r,enumerable:!1}))},"static":function(t,e){function i(){var i=e[n],s=e[n+1];Object.defineProperty(t,i,{get:function(){return delete this[i],this[i]=s.call(this)},set:function(t){delete this[i],this[i]=t},enumerable:!0,configurable:!0})}for(var n=0,s=e.length;s>n;n+=2)"length"==e[n]?t.length=e[n+1].call(t):i()},un:function(t,e,n){return n||(n=t[e]),i.__propun.value=n,Object.defineProperty(t,e,i.__propun),n},uns:function(t,e){e.forEach(function(e){i.un(t,e)})}};return t.console=t.console||{log:function(){}},t.trace=t.console.log,Error.prototype.throwError=function(){throw arguments},String.prototype.substr=i.__substr,Object.defineProperty(Array.prototype,"fixed",{enumerable:!1}),i}(window,document);!function(t,e,i){i.un,i.uns,i["static"],i["class"],i.getset,i.__newvec}(window,document,Laya),function(window,document,Laya){var __un=Laya.un,__uns=Laya.uns,__static=Laya["static"],__class=Laya["class"],__getset=Laya.getset,__newvec=Laya.__newvec;Laya["interface"]("laya.runtime.IMarket"),Laya["interface"]("laya.filters.IFilter"),Laya["interface"]("laya.display.ILayout"),Laya["interface"]("laya.resource.IDispose"),Laya["interface"]("laya.runtime.IPlatform"),Laya["interface"]("laya.runtime.IConchNode"),Laya["interface"]("laya.filters.IFilterAction"),Laya["interface"]("laya.runtime.ICPlatformClass"),Laya["interface"]("laya.runtime.IPlatformClass","laya.runtime.IPlatform");var RunDriver=function(){function t(){}return __class(t,"laya.utils.RunDriver"),t.FILTER_ACTIONS=[],t.pixelRatio=-1,t._charSizeTestDiv=null,t.now=function(){return Date.now()},t.getWindow=function(){return window},t.newWebGLContext=function(t,e){return t.getContext(e,{stencil:!0,alpha:!1,antialias:Config.isAntialias,premultipliedAlpha:!1})},t.getPixelRatio=function(){if(t.pixelRatio<0){var e=Browser.context,i=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;t.pixelRatio=(Browser.window.devicePixelRatio||1)/i}return t.pixelRatio},t.getIncludeStr=function(t){return null},t.createShaderCondition=function(t){var e="(function() {return "+t+";})";return Browser.window.eval(e)},t.measureText=function(e,i){if(Render.isConchApp){var n=ConchTextCanvas;return n.font=i,n.measureText(e)}return null==t._charSizeTestDiv&&(t._charSizeTestDiv=Browser.createElement("div"),t._charSizeTestDiv.style.cssText="z-index:10000000;padding:0px;position: absolute;left:0px;visibility:hidden;top:0px;background:white",Browser.container.appendChild(t._charSizeTestDiv)),t._charSizeTestDiv.style.font=i,t._charSizeTestDiv.innerText=" "==e?"i":e,{width:t._charSizeTestDiv.offsetWidth,height:t._charSizeTestDiv.offsetHeight}},t.beginFlush=function(){},t.endFinish=function(){},t.addToAtlas=null,t.flashFlushImage=function(t){},t.drawToCanvas=function(t,e,i,n,s,r){var a=HTMLCanvas.create("2D"),o=new RenderContext(i,n,a);return RenderSprite.renders[e]._fun(t,o,s,r),a},t.createParticleTemplate2D=null,t.createGLTextur=null,t.createWebGLContext2D=null,t.changeWebGLSize=function(t,e){},t.createRenderSprite=function(t,e){return new RenderSprite(t,e)},t.createFilterAction=function(t){return new ColorFilterAction},t.createGraphics=function(){return new Graphics},t.clear=function(t){Render._context.ctx.clear()},t.clearAtlas=function(t){},t.addTextureToAtlas=function(t){},t.getTexturePixels=function(t,e,i,n,s){return null},t.fillTextureShader=function(t,e,i,n,s){return null},t.skinAniSprite=function(){return null},t}(),___Laya=function(){return __getset(1,Laya,"alertGlobalError",null,function(t){var e=0;t?Browser.window.onerror=function(t,i,n,s,r){e++<5&&r&&alert("出错啦,请把此信息截图给研发商\n"+t+"\n"+r.stack)}:Browser.window.onerror=null}),Laya.init=function(t,e,i){for(var n=[],s=2,r=arguments.length;r>s;s++)n.push(arguments[s]);Browser.__init__(),Context.__init__(),Graphics.__init__(),Laya.timer=new Timer,Laya.loader=new LoaderManager;for(var s=0,a=n.length;a>s;s++)n[s].enable&&n[s].enable();Font.__init__(),Style.__init__(),ResourceManager.__init__(),CacheManger.beginCheck(),Laya.stageBox=Laya.stage=new Stage,Laya.stage.model&&Laya.stage.model.setRootNode();var o=Browser.window.location,h=o.pathname;return h=":"==h.charAt(2)?h.substring(1):h,URL.rootPath=URL.basePath=URL.getPath("file:"==o.protocol?h:o.protocol+"//"+o.host+o.pathname),Laya.render=new Render(0,0),Laya.stage.size(t,e),RenderSprite.__init__(),KeyBoardManager.__init__(),MouseManager.instance.__init__(Laya.stage,Render.canvas),Input.__init__(),SoundManager.autoStopMusic=!0,LocalStorage.__init__(),Render.canvas},Laya.stage=null,Laya.timer=null,Laya.loader=null,Laya.render=null,Laya.version="1.5.2",Laya.stageBox=null,__static(Laya,["conchMarket",function(){return this.conchMarket=window.conch?conchMarket:null},"PlatformClass",function(){return this.PlatformClass=window.PlatformClass}]),Laya}(),Config=function(){function t(){}return __class(t,"Config"),t.WebGLTextCacheCount=500,t.atlasEnable=!1,t.showCanvasMark=!1,t.CPUMemoryLimit=125829120,t.GPUMemoryLimit=167772160,t.animationInterval=50,t.isAntialias=!1,t}(),EventDispatcher=function(){function t(){this._events=null}var e;__class(t,"laya.events.EventDispatcher");var i=t.prototype;return i.hasListener=function(t){var e=this._events&&this._events[t];return!!e},i.event=function(t,e){if(!this._events||!this._events[t])return!1;var i=this._events[t];if(i.run)i.once&&delete this._events[t],null!=e?i.runWith(e):i.run();else{for(var n=0,s=i.length;s>n;n++){var r=i[n];r&&(null!=e?r.runWith(e):r.run()),r&&!r.once||(i.splice(n,1),n--,s--)}0===i.length&&delete this._events[t]}return!0},i.on=function(t,e,i,n){return this._createListener(t,e,i,n,!1)},i.once=function(t,e,i,n){return this._createListener(t,e,i,n,!0)},i._createListener=function(t,i,n,s,r){this.off(t,i,n,r);var a=e.create(i||this,n,s,r);this._events||(this._events={});var o=this._events;return o[t]?o[t].run?o[t]=[o[t],a]:o[t].push(a):o[t]=a,this},i.off=function(t,e,i,n){if(void 0===n&&(n=!1),!this._events||!this._events[t])return this;var s=this._events[t];if(null!=i)if(s.run)e&&s.caller!==e||s.method!==i||n&&!s.once||(delete this._events[t],s.recover());else{for(var r=0,a=0,o=s.length;o>a;a++){var h=s[a];!h||e&&h.caller!==e||h.method!==i||n&&!h.once||(r++,s[a]=null,h.recover())}r===o&&delete this._events[t]}return this},i.offAll=function(t){var e=this._events;if(!e)return this;if(t)this._recoverHandlers(e[t]),delete e[t];else{for(var i in e)this._recoverHandlers(e[i]);this._events=null}return this},i._recoverHandlers=function(t){if(t)if(t.run)t.recover();else for(var e=t.length-1;e>-1;e--)t[e]&&(t[e].recover(),t[e]=null)},i.isMouseEvent=function(e){return t.MOUSE_EVENTS[e]},t.MOUSE_EVENTS={rightmousedown:!0,rightmouseup:!0,rightclick:!0,mousedown:!0,mouseup:!0,mousemove:!0,mouseover:!0,mouseout:!0,click:!0,doubleclick:!0},t.__init$=function(){e=function(t){function e(t,i,n,s){e.__super.call(this,t,i,n,s)}__class(e,"",t);var i=e.prototype;return i.recover=function(){this._id>0&&(this._id=0,e._pool.push(this.clear()))},e.create=function(t,i,n,s){return void 0===s&&(s=!0),e._pool.length?e._pool.pop().setTo(t,i,n,s):new e(t,i,n,s)},e._pool=[],e}(Handler)},t}(),Handler=function(){function t(t,e,i,n){this.once=!1,this._id=0,void 0===n&&(n=!1),this.setTo(t,e,i,n)}__class(t,"laya.utils.Handler");var e=t.prototype;return e.setTo=function(e,i,n,s){return this._id=t._gid++,this.caller=e,this.method=i,this.args=n,this.once=s,this},e.run=function(){if(null==this.method)return null;var t=this._id,e=this.method.apply(this.caller,this.args);return this._id===t&&this.once&&this.recover(),e},e.runWith=function(t){if(null==this.method)return null;var e=this._id;if(null==t)var i=this.method.apply(this.caller,this.args);else i=this.args||t.unshift?this.args?this.method.apply(this.caller,this.args.concat(t)):this.method.apply(this.caller,t):this.method.call(this.caller,t);return this._id===e&&this.once&&this.recover(),i},e.clear=function(){return this.caller=null,this.method=null,this.args=null,this},e.recover=function(){this._id>0&&(this._id=0,t._pool.push(this.clear()))},t.create=function(e,i,n,s){return void 0===s&&(s=!0),t._pool.length?t._pool.pop().setTo(e,i,n,s):new t(e,i,n,s)},t._pool=[],t._gid=1,t}(),BitmapFont=function(){function t(){this.fontSize=12,this.autoScaleSize=!1,this._texture=null,this._fontCharDic={},this._complete=null,this._path=null,this._maxHeight=0,this._maxWidth=0,this._spaceWidth=10,this._leftPadding=0,this._rightPadding=0,this._letterSpacing=0}__class(t,"laya.display.BitmapFont");var e=t.prototype;return e.loadFont=function(t,e){this._path=t,this._complete=e,Laya.loader.load([{url:this._path,type:"xml"},{url:this._path.replace(".fnt",".png"),type:"image"}],Handler.create(this,this.onLoaded))},e.onLoaded=function(){this.parseFont(Loader.getRes(this._path),Loader.getRes(this._path.replace(".fnt",".png"))),this._complete&&this._complete.run()},e.parseFont=function(t,e){if(null!=t&&null!=e){this._texture=e;var i=1,n=t.getElementsByTagName("info");this.fontSize=parseInt(n[0].attributes.size.nodeValue);var s=n[0].attributes.padding.nodeValue,r=s.split(","),a=parseInt(r[0]),o=parseInt(r[2]);this._leftPadding=parseInt(r[3]),this._rightPadding=parseInt(r[1]);var h=t.getElementsByTagName("char"),l=0;for(l=0;l<h.length;l++){var u=h[l].attributes,c=parseInt(u.id.nodeValue),_=parseInt(u.xoffset.nodeValue)/i,d=parseInt(u.yoffset.nodeValue)/i,f=(parseInt(u.xadvance.nodeValue)/i,new Rectangle);f.x=parseInt(u.x.nodeValue),f.y=parseInt(u.y.nodeValue),f.width=parseInt(u.width.nodeValue),f.height=parseInt(u.height.nodeValue);var p=Texture.create(e,f.x,f.y,f.width,f.height,_,d);this._maxHeight=Math.max(this._maxHeight,a+o+p.height),this._maxWidth=Math.max(this._maxWidth,p.width),this._fontCharDic[c]=p}this.getCharTexture(" ")&&this.setSpaceWidth(this.getCharWidth(" "))}},e.getCharTexture=function(t){return this._fontCharDic[t.charCodeAt(0)]},e.destroy=function(){var t=null;for(var e in this._fontCharDic)t=this._fontCharDic[e],t&&t.destroy(),delete this._fontCharDic[e];this._texture.destroy()},e.setSpaceWidth=function(t){this._spaceWidth=t},e.getCharWidth=function(t){if(" "==t)return this._spaceWidth+this._letterSpacing;var e=this.getCharTexture(t);return e?e.width+2*e.offsetX+this._letterSpacing:0},e.getTextWidth=function(t){for(var e=0,i=0,n=t.length;n>i;i++)e+=this.getCharWidth(t.charAt(i));return e},e.getMaxWidth=function(){return this._maxWidth+this._letterSpacing},e.getMaxHeight=function(){return this._maxHeight},e.drawText=function(t,e,i,n,s,r){for(var a,o=0,h=0,l=t.length;l>h;h++)o+=this.getCharWidth(t.charAt(h));var u=this._leftPadding;"center"===s&&(u=(r-o)/2),"right"===s&&(u=r-o-this._rightPadding);var c=0;for(h=0,l=t.length;l>h;h++)a=this.getCharTexture(t.charAt(h)),a&&e.graphics.drawTexture(a,i+c+u,n,a.width,a.height),c+=this.getCharWidth(t.charAt(h))},__getset(0,e,"letterSpacing",function(){return this._letterSpacing},function(t){this._letterSpacing=t}),t}(),Style=function(){function t(){this.alpha=1,this.visible=!0,this.scrollRect=null,this.blendMode=null,this._type=0,this._tf=t._TF_EMPTY}__class(t,"laya.display.css.Style");var e=t.prototype;return e.getTransform=function(){return this._tf},e.setTransform=function(e){this._tf="none"!==e&&e?e:t._TF_EMPTY},e.setTranslateX=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.translateX=e},e.setTranslateY=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.translateY=e},e.setScaleX=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.scaleX=e},e.setScaleY=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.scaleY=e},e.setRotate=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.rotate=e},e.setSkewX=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.skewX=e},e.setSkewY=function(e){this._tf===t._TF_EMPTY&&(this._tf=t._createTransform()),this._tf.skewY=e},e.destroy=function(){this.scrollRect=null},e.render=function(t,e,i,n){},e.getCSSStyle=function(){return CSSStyle.EMPTY},e._enableLayout=function(){return!1},__getset(0,e,"scaleX",function(){return this._tf.scaleX},function(t){this.setScaleX(t)}),__getset(0,e,"transform",function(){return this.getTransform()},function(t){this.setTransform(t)}),__getset(0,e,"translateX",function(){return this._tf.translateX},function(t){this.setTranslateX(t)}),__getset(0,e,"translateY",function(){return this._tf.translateY},function(t){this.setTranslateY(t)}),__getset(0,e,"scaleY",function(){return this._tf.scaleY},function(t){this.setScaleY(t)}),__getset(0,e,"block",function(){return 0!=(1&this._type)}),__getset(0,e,"skewY",function(){return this._tf.skewY},function(t){this.setSkewY(t)}),__getset(0,e,"rotate",function(){return this._tf.rotate},function(t){this.setRotate(t)}),__getset(0,e,"skewX",function(){return this._tf.skewX},function(t){this.setSkewX(t)}),__getset(0,e,"paddingLeft",function(){return 0}),__getset(0,e,"paddingTop",function(){return 0}),__getset(0,e,"absolute",function(){return!0}),t.__init__=function(){t._TF_EMPTY=t._createTransform(),t.EMPTY=new t},t._createTransform=function(){return{translateX:0,translateY:0,scaleX:1,scaleY:1,rotate:0,skewX:0,skewY:0}},t.EMPTY=null,t._TF_EMPTY=null,t}(),Font=function(){function t(e){this._type=0,this._weight=0,this._decoration=null,this._text=null,this.indent=0,this._color=Color.create(t.defaultColor),this.family=t.defaultFamily,this.stroke=t._STROKE,this.size=t.defaultSize,e&&e!==t.EMPTY&&e.copyTo(this)}__class(t,"laya.display.css.Font");var e=t.prototype;return e.set=function(t){this._text=null;for(var e=t.split(" "),i=0,n=e.length;n>i;i++){var s=e[i];switch(s){case"italic":this.italic=!0;continue;case"bold":this.bold=!0;continue}s.indexOf("px")>0&&(this.size=parseInt(s),this.family=e[i+1],i++)}},e.toString=function(){return this._text="",this.italic&&(this._text+="italic "),this.bold&&(this._text+="bold "),this._text+=this.size+"px "+this.family},e.copyTo=function(e){e._type=this._type,e._text=this._text,e._weight=this._weight,e._color=this._color,e.family=this.family,e.stroke=this.stroke!=t._STROKE?this.stroke.slice():t._STROKE,e.indent=this.indent,e.size=this.size},__getset(0,e,"password",function(){return 0!==(1024&this._type)},function(t){t?this._type|=1024:this._type&=-1025}),__getset(0,e,"color",function(){return this._color.strColor},function(t){this._color=Color.create(t)}),__getset(0,e,"italic",function(){return 0!==(512&this._type)},function(t){t?this._type|=512:this._type&=-513}),__getset(0,e,"bold",function(){return 0!==(2048&this._type)},function(t){t?this._type|=2048:this._type&=-2049}),__getset(0,e,"weight",function(){return""+this._weight},function(t){var e=0;switch(t){case"normal":break;case"bold":this.bold=!0,e=700;break;case"bolder":e=800;break;case"lighter":e=100;break;default:e=parseInt(t)}this._weight=e,this._text=null}),__getset(0,e,"decoration",function(){return this._decoration?this._decoration.value:"none"},function(t){var e=t.split(" ");switch(this._decoration||(this._decoration={}),e[0]){case"_":this._decoration.type="underline";break;case"-":this._decoration.type="line-through";break;case"overline":this._decoration.type="overline";break;default:this._decoration.type=e[0]}e[1]&&(this._decoration.color=Color.create(e)),this._decoration.value=t}),t.__init__=function(){t.EMPTY=new t(null)},t.EMPTY=null,t.defaultColor="#000000",t.defaultSize=12,t.defaultFamily="Arial",t.defaultFont="12px Arial",t._STROKE=[0,"#000000"],t._ITALIC=512,t._PASSWORD=1024,t._BOLD=2048,t}(),Graphics=function(){function t(){this._one=null,this._cmds=null,this._render=this._renderEmpty,this._render=this._renderEmpty,Render.isConchNode&&(this._nativeObj=new _conchGraphics,this.id=this._nativeObj.conchID)}__class(t,"laya.display.Graphics");var e=t.prototype;return e.destroy=function(){this.clear(),this._temp=null,this._bounds=null,this._rstBoundPoints=null,this._sp&&(this._sp._renderType=0),this._sp=null},e.clear=function(){if(this._one=null,this._render=this._renderEmpty,this._cmds=null,this._temp&&(this._temp.length=0),this._sp&&(this._sp._renderType&=-2),this._sp&&(this._sp._renderType&=-257),this._repaint(),this._vectorgraphArray){for(var t=0,e=this._vectorgraphArray.length;e>t;t++)VectorGraphManager.getInstance().deleteShape(this._vectorgraphArray[t]);this._vectorgraphArray.length=0}},e._repaint=function(){this._temp&&(this._temp.length=0),this._sp&&this._sp.repaint()},e._isOnlyOne=function(){return!this._cmds||0===this._cmds.length},e.getBounds=function(){return(!this._bounds||!this._temp||this._temp.length<1)&&(this._bounds=Rectangle._getWrapRec(this.getBoundPoints(),this._bounds)),this._bounds},e.getBoundPoints=function(){return(!this._temp||this._temp.length<1)&&(this._temp=this._getCmdPoints()),this._rstBoundPoints=Utils.copyArray(this._rstBoundPoints,this._temp)},e._addCmd=function(t){this._cmds=this._cmds||[],t.callee=t.shift(),this._cmds.push(t)},e._getCmdPoints=function(){var e,i=Render._context,n=this._cmds;if(e=this._temp||(this._temp=[]),e.length=0,n||null==this._one||(t._tempCmds.length=0,t._tempCmds.push(this._one),n=t._tempCmds),!n)return e;var s;s=t._tempMatrixArrays,s.length=0;var r=t._initMatrix;r.identity();for(var a,o=t._tempMatrix,h=0,l=n.length;l>h;h++)switch(a=n[h],a.callee){case i.save:case 7:s.push(r),r=r.clone();break;case i.restore:case 8:r=s.pop();break;case i._scale:case 5:o.identity(),o.translate(-a[2],-a[3]),o.scale(a[0],a[1]),o.translate(a[2],a[3]),this._switchMatrix(r,o);break;case i._rotate:case 3:o.identity(),o.translate(-a[1],-a[2]),o.rotate(a[0]),o.translate(a[1],a[2]),this._switchMatrix(r,o);break;case i._translate:case 6:o.identity(),o.translate(a[0],a[1]),this._switchMatrix(r,o);break;case i._transform:case 4:o.identity(),o.translate(-a[1],-a[2]),o.concat(a[0]),o.translate(a[1],a[2]),this._switchMatrix(r,o);break;case 16:case 24:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),r);break;case 17:r.copyTo(o),o.concat(a[4]),t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),o);break;case i._drawTexture:case i._fillTexture:if(a[3]&&a[4])t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],a[3],a[4]),r);else{var u=a[0];t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],u.width,u.height),r)}break;case i._drawTextureWithTransform:r.copyTo(o),o.concat(a[5]),a[3]&&a[4]?t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],a[3],a[4]),o):(u=a[0],t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],u.width,u.height),o));break;case i._drawRect:case 13:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),r);break;case i._drawCircle:case i._fillCircle:case 14:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0]-a[2],a[1]-a[2],a[2]+a[2],a[2]+a[2]),r);break;case i._drawLine:case 20:t._tempPoints.length=0;var c=NaN;c=.5*a[5],a[0]==a[2]?t._tempPoints.push(a[0]+c,a[1],a[2]+c,a[3],a[0]-c,a[1],a[2]-c,a[3]):a[1]==a[3]?t._tempPoints.push(a[0],a[1]+c,a[2],a[3]+c,a[0],a[1]-c,a[2],a[3]-c):t._tempPoints.push(a[0],a[1],a[2],a[3]),t._addPointArrToRst(e,t._tempPoints,r);break;case i._drawCurves:case 22:t._addPointArrToRst(e,Bezier.I.getBezierPoints(a[2]),r,a[0],a[1]);break;case i._drawPoly:case i._drawLines:case 18:t._addPointArrToRst(e,a[2],r,a[0],a[1]);break;case i._drawPath:case 19:t._addPointArrToRst(e,this._getPathPoints(a[2]),r,a[0],a[1]);break;case i._drawPie:case 15:t._addPointArrToRst(e,this._getPiePoints(a[0],a[1],a[2],a[3],a[4]),r)}return e.length>200?e=Utils.copyArray(e,Rectangle._getWrapRec(e)._getBoundPoints()):e.length>8&&(e=GrahamScan.scanPList(e)),e},e._switchMatrix=function(t,e){e.concat(t),e.copyTo(t)},e.drawTexture=function(t,e,i,n,s,r,a){if(void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=1),t&&(n||(n=t.sourceWidth),s||(s=t.sourceHeight),n=n-t.sourceWidth+t.width,s=s-t.sourceHeight+t.height,!t.loaded||!(0>=n||0>=s))){e+=t.offsetX,i+=t.offsetY,this._sp&&(this._sp._renderType|=256);var o=[t,e,i,n,s,r,a];o.callee=r||1!=a?Render._context._drawTextureWithTransform:Render._context._drawTexture,null!=this._one||r||1!=a?this._saveToCmd(o.callee,o):(this._one=o,this._render=this._renderOneImg),t.loaded||t.once("loaded",this,this._textureLoaded,[t,o]),this._repaint()}},e.drawTextures=function(t,e){t&&this._saveToCmd(Render._context._drawTextures,[t,e])},e.fillTexture=function(t,e,i,n,s,r,a){if(void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r="repeat"),t){var o=[t,e,i,n,s,r,a];if(t.loaded||t.once("loaded",this,this._textureLoaded,[t,o]),Render.isWebGL){var h=RunDriver.fillTextureShader(t,e,i,n,s);o.push(h)}this._saveToCmd(Render._context._fillTexture,o)}},e._textureLoaded=function(t,e){e[3]=e[3]||t.width,e[4]=e[4]||t.height,this._repaint()},e._saveToCmd=function(t,e){return this._sp&&(this._sp._renderType|=256),null==this._one?(this._one=e,this._render=this._renderOne):(this._sp&&(this._sp._renderType&=-2),this._render=this._renderAll,0===(this._cmds||(this._cmds=[])).length&&this._cmds.push(this._one),this._cmds.push(e)),e.callee=t,this._temp&&(this._temp.length=0),this._repaint(),e},e.clipRect=function(t,e,i,n){this._saveToCmd(Render._context._clipRect,[t,e,i,n])},e.fillText=function(t,e,i,n,s,r){this._saveToCmd(Render._context._fillText,[t,e,i,n||Font.defaultFont,s,r])},e.fillBorderText=function(t,e,i,n,s,r,a,o){this._saveToCmd(Render._context._fillBorderText,[t,e,i,n||Font.defaultFont,s,r,a,o])},e.strokeText=function(t,e,i,n,s,r,a){this._saveToCmd(Render._context._strokeText,[t,e,i,n||Font.defaultFont,s,r,a])},e.alpha=function(t){this._saveToCmd(Render._context._alpha,[t])},e.transform=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this._saveToCmd(Render._context._transform,[t,e,i])},e.rotate=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this._saveToCmd(Render._context._rotate,[t,e,i])},e.scale=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this._saveToCmd(Render._context._scale,[t,e,i,n])},e.translate=function(t,e){this._saveToCmd(Render._context._translate,[t,e])},e.save=function(){this._saveToCmd(Render._context._save,[])},e.restore=function(){this._saveToCmd(Render._context._restore,[])},e.replaceText=function(t){this._repaint();var e=this._cmds;if(e){for(var i=e.length-1;i>-1;i--)if(this._isTextCmd(e[i].callee))return e[i][0].toUpperCase?e[i][0]=t:e[i][0].setText(t),!0}else if(this._one&&this._isTextCmd(this._one.callee))return this._one[0].toUpperCase?this._one[0]=t:this._one[0].setText(t),!0;return!1},e._isTextCmd=function(t){return t===Render._context._fillText||t===Render._context._fillBorderText||t===Render._context._strokeText},e.replaceTextColor=function(t){this._repaint();var e=this._cmds;if(e)for(var i=e.length-1;i>-1;i--)this._isTextCmd(e[i].callee)&&(e[i][4]=t,e[i][0].toUpperCase||(e[i][0].changed=!0));else this._one&&this._isTextCmd(this._one.callee)&&(this._one[4]=t,this._one[0].toUpperCase||(this._one[0].changed=!0))},e.loadImage=function(t,e,i,n,s,r){function a(t){t&&(o.drawTexture(t,e,i,n,s),null!=r&&r.call(o._sp,t))}var o=this;void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0);var h=Loader.getRes(t);h?a(h):Laya.loader.load(t,Handler.create(null,a),null,"image")},e._renderEmpty=function(t,e,i,n){},e._renderAll=function(t,e,i,n){for(var s,r=this._cmds,a=0,o=r.length;o>a;a++)(s=r[a]).callee.call(e,i,n,s)},e._renderOne=function(t,e,i,n){this._one.callee.call(e,i,n,this._one)},e._renderOneImg=function(t,e,i,n){this._one.callee.call(e,i,n,this._one),2305!==t._renderType&&(t._renderType|=1)},e.drawLine=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=0;Render.isWebGL&&(a=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(a));var o=[t+.5,e+.5,i+.5,n+.5,s,r,a];this._saveToCmd(Render._context._drawLine,o)},e.drawLines=function(t,e,i,n,s){void 0===s&&(s=1);var r=0;Render.isWebGL&&(r=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(r));var a=[t+.5,e+.5,i,n,s,r];this._saveToCmd(Render._context._drawLines,a)},e.drawCurves=function(t,e,i,n,s){void 0===s&&(s=1);var r=[t+.5,e+.5,i,n,s];this._saveToCmd(Render._context._drawCurves,r)},e.drawRect=function(t,e,i,n,s,r,a){void 0===a&&(a=1);var o=r?.5:0,h=[t+o,e+o,i,n,s,r,a];this._saveToCmd(Render._context._drawRect,h)},e.drawCircle=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=s?.5:0,o=0;Render.isWebGL&&(o=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(o));var h=[t+a,e+a,i,n,s,r,o];this._saveToCmd(Render._context._drawCircle,h)},e.drawPie=function(t,e,i,n,s,r,a,o){void 0===o&&(o=1);var h=a?.5:0,l=0;Render.isWebGL&&(l=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(l));var u=[t+h,e+h,i,n,s,r,a,o,l];u[3]=Utils.toRadian(n),u[4]=Utils.toRadian(s),this._saveToCmd(Render._context._drawPie,u)},e._getPiePoints=function(e,i,n,s,r){var a=t._tempPoints;t._tempPoints.length=0,a.push(e,i);var o=Math.PI/10,h=NaN;for(h=s;r>h;h+=o)a.push(e+n*Math.cos(h),i+n*Math.sin(h));return r!=h&&a.push(e+n*Math.cos(r),i+n*Math.sin(r)),a},e.drawPoly=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=s?.5:0,o=0;if(Render.isWebGL){o=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(o);var h=!1;h=!(i.length>6)}var l=[t+a,e+a,i,n,s,r,o,h];this._saveToCmd(Render._context._drawPoly,l)},e._getPathPoints=function(e){var i=0,n=0,s=t._tempPoints;s.length=0,n=e.length;var r;for(i=0;n>i;i++)r=e[i],r.length>1&&(s.push(r[1],r[2]),r.length>3&&s.push(r[3],r[4]));return s},e.drawPath=function(t,e,i,n,s){var r=[t+.5,e+.5,i,n,s];this._saveToCmd(Render._context._drawPath,r)},__getset(0,e,"cmds",function(){return this._cmds},function(t){this._sp&&(this._sp._renderType|=256),this._cmds=t,this._render=this._renderAll,this._repaint()}),t.__init__=function(){if(Render.isConchNode){for(var t=laya.display.Graphics.prototype,e=ConchGraphics.prototype,i=["clear","destroy","alpha","rotate","transform","scale","translate","save","restore","clipRect","blendMode","fillText","fillBorderText","_fands","drawRect","drawCircle","drawPie","drawPoly","drawPath","drawImageM","drawLine","drawLines","_drawPs","drawCurves","replaceText","replaceTextColor","_fillImage","fillTexture"],n=0,s=i.length;s>=n;n++){var r=i[n];t[r]=e[r]}t._saveToCmd=null,t.drawTexture=function(t,e,i,n,s,r){if(void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),t&&t.loaded&&t.bitmap&&t.source&&(n||(n=t.sourceWidth),s||(s=t.sourceHeight),n=n-t.sourceWidth+t.width,s=s-t.sourceHeight+t.height,!(0>=n||0>=s))){e+=t.offsetX,i+=t.offsetY;var a=t.uv,o=t.bitmap.width,h=t.bitmap.height;this.drawImageM(t.bitmap.source,a[0]*o,a[1]*h,(a[2]-a[0])*o,(a[5]-a[3])*h,e,i,n,s,r)}},t.fillTexture=function(t,e,i,n,s,r,a){if(void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r="repeat"),t&&t.loaded){var o,h=Render._context.ctx,l=t.bitmap.width,u=t.bitmap.height,c=t.uv;o=t.uv!=Texture.DEF_UV?h.createPattern(t.bitmap.source,r,c[0]*l,c[1]*u,(c[2]-c[0])*l,(c[5]-c[3])*u):h.createPattern(t.bitmap.source,r);var _=0,d=0;a&&(e+=a.x%t.width,i+=a.y%t.height,_-=a.x%t.width,d-=a.y%t.height),this._fillImage(o,e,i,_,d,n,s)}}}},t._addPointArrToRst=function(e,i,n,s,r){void 0===s&&(s=0),void 0===r&&(r=0);var a=0,o=0;for(o=i.length,a=0;o>a;a+=2)t._addPointToRst(e,i[a]+s,i[a+1]+r,n)},t._addPointToRst=function(t,e,i,n){var s=Point.TEMP;s.setTo(e?e:0,i?i:0),n.transformPoint(s),t.push(s.x,s.y)},t._tempPoints=[],t._tempMatrixArrays=[],t._tempCmds=[],__static(t,["_tempMatrix",function(){return this._tempMatrix=new Matrix},"_initMatrix",function(){return this._initMatrix=new Matrix}]),t}(),Event=function(){function t(){}__class(t,"laya.events.Event");var e=t.prototype;return e.setTo=function(t,e,i){return this.type=t,this.currentTarget=e,this.target=i,this},e.stopPropagation=function(){this._stoped=!0},__getset(0,e,"stageY",function(){return Laya.stage.mouseY}),__getset(0,e,"charCode",function(){return this.nativeEvent.charCode}),__getset(0,e,"touches",function(){var t=this.nativeEvent.touches;if(t)for(var e=0,i=t.length;i>e;e++){var n=t[e],s=Point.TEMP;s.setTo(n.clientX,n.clientY),Laya.stage._canvasTransform.invertTransformPoint(s),n.stageX=s.x,n.stageY=s.y}return t}),__getset(0,e,"keyLocation",function(){return this.nativeEvent.keyLocation}),__getset(0,e,"ctrlKey",function(){return this.nativeEvent.ctrlKey}),__getset(0,e,"altKey",function(){return this.nativeEvent.altKey}),__getset(0,e,"shiftKey",function(){return this.nativeEvent.shiftKey}),__getset(0,e,"stageX",function(){return Laya.stage.mouseX}),t.EMPTY=new t,t.MOUSE_DOWN="mousedown",t.MOUSE_UP="mouseup",t.CLICK="click",t.RIGHT_MOUSE_DOWN="rightmousedown", t.RIGHT_MOUSE_UP="rightmouseup",t.RIGHT_CLICK="rightclick",t.MOUSE_MOVE="mousemove",t.MOUSE_OVER="mouseover",t.MOUSE_OUT="mouseout",t.MOUSE_WHEEL="mousewheel",t.ROLL_OVER="mouseover",t.ROLL_OUT="mouseout",t.DOUBLE_CLICK="doubleclick",t.CHANGE="change",t.CHANGED="changed",t.RESIZE="resize",t.ADDED="added",t.REMOVED="removed",t.DISPLAY="display",t.UNDISPLAY="undisplay",t.ERROR="error",t.COMPLETE="complete",t.LOADED="loaded",t.PROGRESS="progress",t.INPUT="input",t.RENDER="render",t.OPEN="open",t.MESSAGE="message",t.CLOSE="close",t.KEY_DOWN="keydown",t.KEY_PRESS="keypress",t.KEY_UP="keyup",t.FRAME="enterframe",t.DRAG_START="dragstart",t.DRAG_MOVE="dragmove",t.DRAG_END="dragend",t.ENTER="enter",t.SELECT="select",t.BLUR="blur",t.FOCUS="focus",t.PLAYED="played",t.PAUSED="paused",t.STOPPED="stopped",t.START="start",t.END="end",t.ENABLED_CHANGED="enabledchanged",t.COMPONENT_ADDED="componentadded",t.COMPONENT_REMOVED="componentremoved",t.ACTIVE_CHANGED="activechanged",t.LAYER_CHANGED="layerchanged",t.HIERARCHY_LOADED="hierarchyloaded",t.RECOVERING="recovering",t.RECOVERED="recovered",t.RELEASED="released",t.LINK="link",t.LABEL="label",t.FULL_SCREEN_CHANGE="fullscreenchange",t.DEVICE_LOST="devicelost",t.MESH_CHANGED="meshchanged",t.MATERIAL_CHANGED="materialchanged",t.RENDERQUEUE_CHANGED="renderqueuechanged",t.WORLDMATRIX_NEEDCHANGE="worldmatrixneedchanged",t.ANIMATION_CHANGED="actionchanged",t.INSTAGE_CHANGED="instagechanged",t.CACHEFRAMEINDEX_CHANGED="cacheframeindexchanged",t}(),Keyboard=function(){function t(){}return __class(t,"laya.events.Keyboard"),t.NUMBER_0=48,t.NUMBER_1=49,t.NUMBER_2=50,t.NUMBER_3=51,t.NUMBER_4=52,t.NUMBER_5=53,t.NUMBER_6=54,t.NUMBER_7=55,t.NUMBER_8=56,t.NUMBER_9=57,t.A=65,t.B=66,t.C=67,t.D=68,t.E=69,t.F=70,t.G=71,t.H=72,t.I=73,t.J=74,t.K=75,t.L=76,t.M=77,t.N=78,t.O=79,t.P=80,t.Q=81,t.R=82,t.S=83,t.T=84,t.U=85,t.V=86,t.W=87,t.X=88,t.Y=89,t.Z=90,t.F1=112,t.F2=113,t.F3=114,t.F4=115,t.F5=116,t.F6=117,t.F7=118,t.F8=119,t.F9=120,t.F10=121,t.F11=122,t.F12=123,t.F13=124,t.F14=125,t.F15=126,t.NUMPAD=21,t.NUMPAD_0=96,t.NUMPAD_1=97,t.NUMPAD_2=98,t.NUMPAD_3=99,t.NUMPAD_4=100,t.NUMPAD_5=101,t.NUMPAD_6=102,t.NUMPAD_7=103,t.NUMPAD_8=104,t.NUMPAD_9=105,t.NUMPAD_ADD=107,t.NUMPAD_DECIMAL=110,t.NUMPAD_DIVIDE=111,t.NUMPAD_ENTER=108,t.NUMPAD_MULTIPLY=106,t.NUMPAD_SUBTRACT=109,t.SEMICOLON=186,t.EQUAL=187,t.COMMA=188,t.MINUS=189,t.PERIOD=190,t.SLASH=191,t.BACKQUOTE=192,t.LEFTBRACKET=219,t.BACKSLASH=220,t.RIGHTBRACKET=221,t.QUOTE=222,t.ALTERNATE=18,t.BACKSPACE=8,t.CAPS_LOCK=20,t.COMMAND=15,t.CONTROL=17,t.DELETE=46,t.ENTER=13,t.ESCAPE=27,t.PAGE_UP=33,t.PAGE_DOWN=34,t.END=35,t.HOME=36,t.LEFT=37,t.UP=38,t.RIGHT=39,t.DOWN=40,t.SHIFT=16,t.SPACE=32,t.TAB=9,t.INSERT=45,t}(),KeyBoardManager=function(){function t(){}return __class(t,"laya.events.KeyBoardManager"),t.__init__=function(){t._addEvent("keydown"),t._addEvent("keypress"),t._addEvent("keyup")},t._addEvent=function(t){Browser.document.addEventListener(t,function(e){laya.events.KeyBoardManager._dispatch(e,t)},!0)},t._dispatch=function(e,i){if(t.enabled){t._event._stoped=!1,t._event.nativeEvent=e,t._event.keyCode=e.keyCode||e.which||e.charCode,"keydown"===i?t._pressKeys[t._event.keyCode]=!0:"keyup"===i&&(t._pressKeys[t._event.keyCode]=null);for(var n=Laya.stage.focus&&null!=Laya.stage.focus.event?Laya.stage.focus:Laya.stage,s=n;s;)s.event(i,t._event.setTo(i,s,n)),s=s.parent}},t.hasKeyDown=function(e){return t._pressKeys[e]},t._pressKeys={},t.enabled=!0,__static(t,["_event",function(){return this._event=new Event}]),t}(),KeyLocation=function(){function t(){}return __class(t,"laya.events.KeyLocation"),t.STANDARD=0,t.LEFT=1,t.RIGHT=2,t.NUM_PAD=3,t}(),MouseManager=function(){function t(){this.mouseX=0,this.mouseY=0,this.disableMouseEvent=!1,this.mouseDownTime=0,this.mouseMoveAccuracy=2,this._stage=null,this._target=null,this._lastOvers=[],this._currOvers=[],this._lastClickTimer=0,this._lastMoveTimer=0,this._isDoubleClick=!1,this._isLeftMouse=!1,this._eventList=[],this._event=new Event,this._matrix=new Matrix,this._point=new Point,this._rect=new Rectangle,this._prePoint=new Point}__class(t,"laya.events.MouseManager");var e=t.prototype;return e.__init__=function(e,i){var n=this;this._stage=e;var s=this,r=this._eventList;i.oncontextmenu=function(e){return t.enabled?!1:void 0},i.addEventListener("mousedown",function(e){t.enabled&&(e.preventDefault(),r.push(e),s.mouseDownTime=Browser.now())}),i.addEventListener("mouseup",function(e){t.enabled&&(e.preventDefault(),r.push(e),s.mouseDownTime=-Browser.now())},!0),i.addEventListener("mousemove",function(e){if(t.enabled){e.preventDefault();var i=Browser.now();if(i-s._lastMoveTimer<10)return;s._lastMoveTimer=i,r.push(e)}},!0),i.addEventListener("mouseout",function(e){t.enabled&&r.push(e)}),i.addEventListener("mouseover",function(e){t.enabled&&r.push(e)}),i.addEventListener("touchstart",function(e){t.enabled&&(r.push(e),n.runEvent(),Input.isInputting||e.preventDefault(),s.mouseDownTime=Browser.now())}),i.addEventListener("touchend",function(e){t.enabled&&(Input.isInputting||e.preventDefault(),r.push(e),s.mouseDownTime=-Browser.now())},!0),i.addEventListener("touchmove",function(e){t.enabled&&(e.preventDefault(),r.push(e))},!0),i.addEventListener("mousewheel",function(e){t.enabled&&r.push(e)}),i.addEventListener("DOMMouseScroll",function(e){t.enabled&&r.push(e)})},e.initEvent=function(t,e){var i=this;i._event._stoped=!1,i._event.nativeEvent=e||t,i._target=null,this._point.setTo(t.clientX,t.clientY),this._stage._canvasTransform.invertTransformPoint(this._point),i.mouseX=this._point.x,i.mouseY=this._point.y,i._event.touchId=t.identifier},e.checkMouseWheel=function(t){this._event.delta=t.wheelDelta?.025*t.wheelDelta:-t.detail;for(var e=0,i=this._lastOvers.length;i>e;e++){var n=this._lastOvers[e];n.event("mousewheel",this._event.setTo("mousewheel",n,this._target))}this._stage.event("mousewheel",this._event.setTo("mousewheel",this._stage,this._target))},e.checkMouseOut=function(){if(!this.disableMouseEvent){for(var t=0,e=this._lastOvers.length;e>t;t++){var i=this._lastOvers[t];!i.destroyed&&this._currOvers.indexOf(i)<0&&(i._set$P("$_MOUSEOVER",!1),i.event("mouseout",this._event.setTo("mouseout",i,this._target)))}var n=this._lastOvers;this._lastOvers=this._currOvers,this._currOvers=n,this._currOvers.length=0}},e.onMouseMove=function(t){this.sendMouseMove(t),this._event._stoped=!1,this.sendMouseOver(this._target)},e.sendMouseMove=function(t){t.event("mousemove",this._event.setTo("mousemove",t,this._target)),!this._event._stoped&&t.parent&&this.sendMouseMove(t.parent)},e.sendMouseOver=function(t){(t.parent||t===this._stage)&&(t._get$P("$_MOUSEOVER")||(t._set$P("$_MOUSEOVER",!0),t.event("mouseover",this._event.setTo("mouseover",t,this._target))),this._currOvers.push(t)),!this._event._stoped&&t.parent&&this.sendMouseOver(t.parent)},e.onMouseDown=function(t){Input.isInputting&&Laya.stage.focus&&Laya.stage.focus.focus&&!Laya.stage.focus.contains(this._target)&&(Laya.stage.focus.focus=!1),this._onMouseDown(t)},e._onMouseDown=function(t){this._isLeftMouse?(t._set$P("$_MOUSEDOWN",!0),t.event("mousedown",this._event.setTo("mousedown",t,this._target))):(t._set$P("$_RIGHTMOUSEDOWN",!0),t.event("rightmousedown",this._event.setTo("rightmousedown",t,this._target))),!this._event._stoped&&t.parent&&this.onMouseDown(t.parent)},e.onMouseUp=function(t){var e=this._isLeftMouse?"mouseup":"rightmouseup";this.sendMouseUp(t,e),this._event._stoped=!1,this.sendClick(this._target,e)},e.sendMouseUp=function(t,e){t.event(e,this._event.setTo(e,t,this._target)),!this._event._stoped&&t.parent&&this.sendMouseUp(t.parent,e)},e.sendClick=function(t,e){t.destroyed||("mouseup"===e&&t._get$P("$_MOUSEDOWN")?(t._set$P("$_MOUSEDOWN",!1),t.event("click",this._event.setTo("click",t,this._target)),this._isDoubleClick&&t.event("doubleclick",this._event.setTo("doubleclick",t,this._target))):"rightmouseup"===e&&t._get$P("$_RIGHTMOUSEDOWN")&&(t._set$P("$_RIGHTMOUSEDOWN",!1),t.event("rightclick",this._event.setTo("rightclick",t,this._target))),!this._event._stoped&&t.parent&&this.sendClick(t.parent,e))},e.check=function(t,e,i,n){var s=t.transform||this._matrix,r=t.pivotX,a=t.pivotY;if(0===r&&0===a)s.setTranslate(t.x,t.y);else if(s===this._matrix)s.setTranslate(t.x-r,t.y-a);else{var o=s.cos,h=s.sin;s.setTranslate(t.x-(r*o-a*h)*t.scaleX,t.y-(r*h+a*o)*t.scaleY)}s.invertTransformPoint(this._point.setTo(e,i)),s.setTranslate(0,0),e=this._point.x,i=this._point.y;var l=t.scrollRect;if(l){this._rect.setTo(0,0,l.width,l.height);var u=this._rect.contains(e,i);if(!u)return!1}if(!this.disableMouseEvent){var c=!1;if(t.hitTestPrior&&!t.mouseThrough&&!this.hitTest(t,e,i))return!1;for(var _=t._childs.length-1;_>-1;_--){var d=t._childs[_];if(!d.destroyed&&d.mouseEnabled&&d.visible&&(c=this.check(d,e+(l?l.x:0),i+(l?l.y:0),n)))return!0}}return u=this.hitTest(t,e,i),u?(this._target=t,n.call(this,t)):n===this.onMouseUp&&t===this._stage&&(this._target=this._stage,n.call(this,this._target)),u},e.hitTest=function(t,e,i){var n=!1;if(t.hitArea instanceof laya.utils.HitArea)return t.hitArea.isHit(e,i);if(t.width>0&&t.height>0||t.mouseThrough||t.hitArea){var s=this._rect;t.mouseThrough?n=t.getGraphicBounds().contains(e,i):(t.hitArea?s=t.hitArea:s.setTo(0,0,t.width,t.height),n=s.contains(e,i))}return n},e.runEvent=function(){var e=this._eventList.length;if(e){for(var i=this,n=0;e>n;){var s=this._eventList[n];switch("mousemove"!==s.type&&(this._prePoint.x=this._prePoint.y=-1e6),s.type){case"mousedown":t._isTouchRespond?t._isTouchRespond=!1:(i._isLeftMouse=0===s.button,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseDown));break;case"mouseup":i._isLeftMouse=0===s.button;var r=Browser.now();i._isDoubleClick=r-i._lastClickTimer<300,i._lastClickTimer=r,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseUp);break;case"mousemove":Math.abs(this._prePoint.x-s.clientX)+Math.abs(this._prePoint.y-s.clientY)>=this.mouseMoveAccuracy&&(this._prePoint.x=s.clientX,this._prePoint.y=s.clientY,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseMove),i.checkMouseOut());break;case"touchstart":t._isTouchRespond=!0,i._isLeftMouse=!0;for(var a=s.changedTouches,o=0,h=a.length;h>o;o++)i.initEvent(a[o],s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseDown);break;case"touchend":t._isTouchRespond=!0,i._isLeftMouse=!0,r=Browser.now(),i._isDoubleClick=r-i._lastClickTimer<300,i._lastClickTimer=r;var l=s.changedTouches;for(o=0,h=l.length;h>o;o++)i.initEvent(l[o],s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseUp);break;case"touchmove":var u=s.changedTouches;for(o=0,h=u.length;h>o;o++)i.initEvent(u[o],s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseMove);i.checkMouseOut();break;case"wheel":case"mousewheel":case"DOMMouseScroll":i.checkMouseWheel(s);break;case"mouseout":i._stage.event("mouseout",i._event.setTo("mouseout",i._stage,i._stage));break;case"mouseover":i._stage.event("mouseover",i._event.setTo("mouseover",i._stage,i._stage))}n++}this._eventList.length=0}},t.enabled=!0,t._isTouchRespond=!1,__static(t,["instance",function(){return this.instance=new t}]),t}(),Filter=function(){function t(){this._action=null}__class(t,"laya.filters.Filter");var e=t.prototype;return Laya.imps(e,{"laya.filters.IFilter":!0}),e.callNative=function(t){},__getset(0,e,"type",function(){return-1}),__getset(0,e,"action",function(){return this._action}),t.BLUR=16,t.COLOR=32,t.GLOW=8,t._filterStart=null,t._filterEnd=null,t._EndTarget=null,t._recycleScope=null,t._filter=null,t._useSrc=null,t._endSrc=null,t._useOut=null,t._endOut=null,t}(),ColorFilterAction=function(){function t(){this.data=null}__class(t,"laya.filters.ColorFilterAction");var e=t.prototype;return Laya.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){var e=t.ctx.ctx,i=t.ctx.ctx.canvas;if(0==i.width||0==i.height)return i;for(var n,s=e.getImageData(0,0,i.width,i.height),r=s.data,a=0,o=r.length;o>a;a+=4)n=this.getColor(r[a],r[a+1],r[a+2],r[a+3]),0!=r[a+3]&&(r[a]=n[0],r[a+1]=n[1],r[a+2]=n[2],r[a+3]=n[3]);return e.putImageData(s,0,0),t},e.getColor=function(t,e,i,n){var s=[];if(this.data._mat&&this.data._alpha){var r=this.data._mat,a=this.data._alpha;s[0]=r[0]*t+r[1]*e+r[2]*i+r[3]*n+a[0],s[1]=r[4]*t+r[5]*e+r[6]*i+r[7]*n+a[1],s[2]=r[8]*t+r[9]*e+r[10]*i+r[11]*n+a[2],s[3]=r[12]*t+r[13]*e+r[14]*i+r[15]*n+a[3]}return s},t}(),Arith=function(){function t(){}return __class(t,"laya.maths.Arith"),t.formatR=function(t){return t>Math.PI&&(t-=2*Math.PI),t<-Math.PI&&(t+=2*Math.PI),t},t.isPOT=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},t.setMatToArray=function(t,e){t.a,t.b,t.c,t.d,t.tx+20,t.ty+20,1,e[0]=t.a,e[1]=t.b,e[4]=t.c,e[5]=t.d,e[12]=t.tx,e[13]=t.ty},t}(),Bezier=function(){function t(){this._controlPoints=[new Point,new Point,new Point],this._calFun=this.getPoint2}__class(t,"laya.maths.Bezier");var e=t.prototype;return e._switchPoint=function(t,e){var i=this._controlPoints.shift();i.setTo(t,e),this._controlPoints.push(i)},e.getPoint2=function(t,e){var i=this._controlPoints[0],n=this._controlPoints[1],s=this._controlPoints[2],r=Math.pow(1-t,2)*i.x+2*t*(1-t)*n.x+Math.pow(t,2)*s.x,a=Math.pow(1-t,2)*i.y+2*t*(1-t)*n.y+Math.pow(t,2)*s.y;e.push(r,a)},e.getPoint3=function(t,e){var i=this._controlPoints[0],n=this._controlPoints[1],s=this._controlPoints[2],r=this._controlPoints[3],a=Math.pow(1-t,3)*i.x+3*n.x*t*(1-t)*(1-t)+3*s.x*t*t*(1-t)+r.x*Math.pow(t,3),o=Math.pow(1-t,3)*i.y+3*n.y*t*(1-t)*(1-t)+3*s.y*t*t*(1-t)+r.y*Math.pow(t,3);e.push(a,o)},e.insertPoints=function(t,e){var i=NaN;t=t>0?t:5;var n=NaN;for(n=1/t,i=0;1>=i;i+=n)this._calFun(i,e)},e.getBezierPoints=function(t,e,i){void 0===e&&(e=5),void 0===i&&(i=2);var n=0,s=0;if(s=t.length,2*(i+1)>s)return[];var r;switch(r=[],i){case 2:this._calFun=this.getPoint2;break;case 3:this._calFun=this.getPoint3;break;default:return[]}for(n=0;2*i>n;n+=2)this._switchPoint(t[n],t[n+1]);for(n=2*i;s>n;n+=2)this._switchPoint(t[n],t[n+1]),n/2%i==0&&this.insertPoints(e,r);return r},__static(t,["I",function(){return this.I=new t}]),t}(),GrahamScan=function(){function t(){}return __class(t,"laya.maths.GrahamScan"),t.multiply=function(t,e,i){return(t.x-i.x)*(e.y-i.y)-(e.x-i.x)*(t.y-i.y)},t.dis=function(t,e){return(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)},t._getPoints=function(e,i,n){for(void 0===i&&(i=!1),t._mPointList||(t._mPointList=[]);t._mPointList.length<e;)t._mPointList.push(new Point);return n||(n=[]),n.length=0,i?t.getFrom(n,t._mPointList,e):t.getFromR(n,t._mPointList,e),n},t.getFrom=function(t,e,i){var n=0;for(n=0;i>n;n++)t.push(e[n]);return t},t.getFromR=function(t,e,i){var n=0;for(n=0;i>n;n++)t.push(e.pop());return t},t.pListToPointList=function(e,i){void 0===i&&(i=!1);var n=0,s=e.length/2,r=t._getPoints(s,i,t._tempPointList);for(n=0;s>n;n++)r[n].setTo(e[n+n],e[n+n+1]);return r},t.pointListToPlist=function(e){var i,n=0,s=e.length,r=t._temPList;for(r.length=0,n=0;s>n;n++)i=e[n],r.push(i.x,i.y);return r},t.scanPList=function(e){return Utils.copyArray(e,t.pointListToPlist(t.scan(t.pListToPointList(e,!0))))},t.scan=function(e){var i,n,s,r=0,a=0,o=0,h=e.length,l={};for(n=t._temArr,n.length=0,h=e.length,r=h-1;r>=0;r--)i=e[r],s=i.x+"_"+i.y,l.hasOwnProperty(s)||(l[s]=!0,n.push(i));for(h=n.length,Utils.copyArray(e,n),r=1;h>r;r++)(e[r].y<e[o].y||e[r].y==e[o].y&&e[r].x<e[o].x)&&(o=r);for(i=e[0],e[0]=e[o],e[o]=i,r=1;h-1>r;r++){for(o=r,a=r+1;h>a;a++)(t.multiply(e[a],e[o],e[0])>0||0==t.multiply(e[a],e[o],e[0])&&t.dis(e[0],e[a])<t.dis(e[0],e[o]))&&(o=a);i=e[r],e[r]=e[o],e[o]=i}if(n=t._temArr,n.length=0,e.length<3)return Utils.copyArray(n,e);for(n.push(e[0],e[1],e[2]),r=3;h>r;r++){for(;n.length>=2&&t.multiply(e[r],n[n.length-1],n[n.length-2])>=0;)n.pop();e[r]&&n.push(e[r])}return n},t._mPointList=null,t._tempPointList=[],t._temPList=[],t._temArr=[],t}(),MathUtil=function(){function t(){}return __class(t,"laya.maths.MathUtil"),t.subtractVector3=function(t,e,i){i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2]},t.lerp=function(t,e,i){return t*(1-i)+e*i},t.scaleVector3=function(t,e,i){i[0]=t[0]*e,i[1]=t[1]*e,i[2]=t[2]*e},t.lerpVector3=function(t,e,i,n){var s=t[0],r=t[1],a=t[2];n[0]=s+i*(e[0]-s),n[1]=r+i*(e[1]-r),n[2]=a+i*(e[2]-a)},t.lerpVector4=function(t,e,i,n){var s=t[0],r=t[1],a=t[2],o=t[3];n[0]=s+i*(e[0]-s),n[1]=r+i*(e[1]-r),n[2]=a+i*(e[2]-a),n[3]=o+i*(e[3]-o)},t.slerpQuaternionArray=function(t,e,i,n,s,r,a){var o,h,l,u,c,_=t[e+0],d=t[e+1],f=t[e+2],p=t[e+3],g=i[n+0],m=i[n+1],v=i[n+2],y=i[n+3];return h=_*g+d*m+f*v+p*y,0>h&&(h=-h,g=-g,m=-m,v=-v,y=-y),1-h>1e-6?(o=Math.acos(h),l=Math.sin(o),u=Math.sin((1-s)*o)/l,c=Math.sin(s*o)/l):(u=1-s,c=s),r[a+0]=u*_+c*g,r[a+1]=u*d+c*m,r[a+2]=u*f+c*v,r[a+3]=u*p+c*y,r},t.getRotation=function(t,e,i,n){return Math.atan2(n-e,i-t)/Math.PI*180},t.sortBigFirst=function(t,e){return t==e?0:e>t?1:-1},t.sortSmallFirst=function(t,e){return t==e?0:e>t?-1:1},t.sortNumBigFirst=function(t,e){return parseFloat(e)-parseFloat(t)},t.sortNumSmallFirst=function(t,e){return parseFloat(t)-parseFloat(e)},t.sortByKey=function(e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0);var s;return s=i?n?t.sortNumBigFirst:t.sortBigFirst:n?t.sortNumSmallFirst:t.sortSmallFirst,function(t,i){return s(t[e],i[e])}},t}(),Matrix=function(){function t(t,e,i,n,s,r){this.cos=1,this.sin=0,this.inPool=!1,this.bTransform=!1,void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this._checkTransform()}__class(t,"laya.maths.Matrix");var e=t.prototype;return e.identity=function(){return this.a=this.d=1,this.b=this.tx=this.ty=this.c=0,this.bTransform=!1,this},e._checkTransform=function(){return this.bTransform=1!==this.a||0!==this.b||0!==this.c||1!==this.d},e.setTranslate=function(t,e){return this.tx=t,this.ty=e,this},e.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.scale=function(t,e){this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this.bTransform=!0},e.rotate=function(t){var e=this.cos=Math.cos(t),i=this.sin=Math.sin(t),n=this.a,s=this.c,r=this.tx;this.a=n*e-this.b*i,this.b=n*i+this.b*e,