diff --git a/CHANGELOG.md b/CHANGELOG.md index ce278a6b..c30d629e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ + +## [2.0.1](https://github.com/hiloteam/hilo/compare/2.0.0...2.0.1) (2020-07-03) + + +### Bug Fixes + +* Tween reverse onComplete not work, fix [#165](https://github.com/hiloteam/hilo/issues/165) ([2522897](https://github.com/hiloteam/hilo/commit/2522897)) + # [2.0.0](https://github.com/hiloteam/hilo/compare/1.6.0...2.0.0) (2019-12-10) diff --git a/build/amd/hilo-amd.js b/build/amd/hilo-amd.js index 80bcf37a..867ad69c 100644 --- a/build/amd/hilo-amd.js +++ b/build/amd/hilo-amd.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -192,7 +192,7 @@ return browser; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -229,7 +229,7 @@ return util; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -257,7 +257,7 @@ var Hilo = { * Hilo version * @type String */ - version: '2.0.0', + version: '2.0.1', /** * @language=en * Gets a globally unique id. Such as Stage1, Bitmap2 etc. @@ -565,7 +565,7 @@ return Hilo; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -748,7 +748,7 @@ return Class; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -972,7 +972,7 @@ return Matrix; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -1125,7 +1125,7 @@ return EventMixin; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -1206,7 +1206,7 @@ return Drawable; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -1300,7 +1300,7 @@ return Renderer; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -1511,7 +1511,7 @@ return CanvasRenderer; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -1693,7 +1693,7 @@ return DOMRenderer; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -2277,7 +2277,7 @@ return WebGLRenderer; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -2774,7 +2774,7 @@ return View; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -2840,7 +2840,7 @@ return CacheMixin; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3214,7 +3214,7 @@ return Container; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3481,7 +3481,7 @@ return Stage; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3561,7 +3561,7 @@ return Bitmap; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3832,7 +3832,7 @@ return Sprite; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3947,7 +3947,7 @@ return DOMElement; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -4509,7 +4509,7 @@ return Graphics; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -4762,7 +4762,7 @@ return Text; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -4946,7 +4946,7 @@ return BitmapText; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5125,7 +5125,7 @@ return Button; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5362,7 +5362,7 @@ return TextureAtlas; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5591,7 +5591,7 @@ return Ticker; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5639,7 +5639,7 @@ if (!fnProto.bind) { }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5778,7 +5778,7 @@ return drag; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6024,7 +6024,7 @@ return Class.create(/** @lends Tween.prototype */{ if(elapsed < 0) return; //elapsed ratio - var ratio = elapsed / me.duration, complete = false, callback; + var ratio = elapsed / me.duration, callback; ratio = ratio <= 0 ? 0 : ratio >= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -6038,7 +6038,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; @@ -6234,7 +6234,7 @@ return Tween; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6506,7 +6506,7 @@ return Ease; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6554,7 +6554,7 @@ return ImageLoader; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6621,7 +6621,7 @@ return ScriptLoader; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6888,7 +6888,7 @@ return LoadQueue; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7091,7 +7091,7 @@ return HTMLAudio; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7415,7 +7415,7 @@ return WebAudio; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7518,7 +7518,7 @@ return WebSound; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7611,7 +7611,7 @@ return Camera; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7798,7 +7798,7 @@ return Camera3d; }); /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo-amd.min.js b/build/amd/hilo-amd.min.js index dd8b23b8..30b6bae2 100644 --- a/build/amd/hilo-amd.min.js +++ b/build/amd/hilo-amd.min.js @@ -1,8 +1,8 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define("hilo/util/browser",function(){var t=function(){var t=navigator.userAgent,e=document,i=window,r=e.documentElement,n={iphone:/iphone/i.test(t),ipad:/ipad/i.test(t),ipod:/ipod/i.test(t),ios:/iphone|ipad|ipod/i.test(t),android:/android/i.test(t),webkit:/webkit/i.test(t),chrome:/chrome/i.test(t),safari:/safari/i.test(t),firefox:/firefox/i.test(t),ie:/msie/i.test(t),opera:/opera/i.test(t),supportTouch:"ontouchstart"in i,supportCanvas:null!=e.createElement("canvas").getContext,supportStorage:!1,supportOrientation:"orientation"in i||"orientation"in i.screen,supportDeviceMotion:"ondevicemotion"in i};try{var a="hilo";localStorage.setItem(a,a),localStorage.removeItem(a),n.supportStorage=!0}catch(o){}var s=n.jsVendor=n.webkit?"webkit":n.firefox?"webkit":n.opera?"o":n.ie?"ms":"",h=n.cssVendor="-"+s+"-",l=e.createElement("div"),c=l.style,u=void 0!=c[s+"Transform"],d=void 0!=c[s+"Perspective"];d&&(l.id="test3d",c=e.createElement("style"),c.textContent="@media ("+h+"transform-3d){#test3d{height:3px}}",e.head.appendChild(c),r.appendChild(l),d=3==l.offsetHeight,e.head.removeChild(c),r.removeChild(l)),n.supportTransform=u,n.supportTransform3D=d;var f=n.supportTouch,p=f?"touchstart":"mousedown",v=f?"touchmove":"mousemove",m=f?"touchend":"mouseup";return n.POINTER_START=p,n.POINTER_MOVE=v,n.POINTER_END=m,n}();return t}),define("hilo/util/util",function(){var t={copy:function(t,e,i){for(var r in e)i&&!t.hasOwnProperty(r)&&void 0===t[r]||(t[r]=e[r]);return t}};return t}),define("hilo/core/Hilo",["hilo/util/browser","hilo/util/util"],function(t,e){var i=window,r=document,n=r.documentElement,a=0,o={},s={version:"2.0.0",getUid:function(t){var e=++a;if(t){var i=t.charCodeAt(t.length-1);return i>=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,i,r){return e.copy(t,i,r),o.copy||(o.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:t,event:{POINTER_START:t.POINTER_START,POINTER_MOVE:t.POINTER_MOVE,POINTER_END:t.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(r){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var a=(i.pageXOffset||n.scrollLeft)-(n.clientLeft||0)||0,o=(i.pageYOffset||n.scrollTop)-(n.clientTop||0)||0,s=i.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(s.paddingLeft)+h(s.borderLeftWidth)||0,c=h(s.paddingTop)+h(s.borderTopWidth)||0,u=h(s.paddingRight)+h(s.borderRightWidth)||0,d=h(s.paddingBottom)+h(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+a+l,top:f+o+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,n,a,o=r.createElement(t);for(i in e)if(n=e[i],"style"===i)for(a in n)o.style[a]=n[a];else o[i]=n;return o},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=s.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var h=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+h.a+", "+h.b+", 0, 0, "+h.c+", "+h.d+", 0, 0, 0, 0, 1, 0, "+h.tx+", "+h.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var l=e.image;if(l){var c=l.src;c!==r.image&&(r.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,g=p.y;m===r.maskX&&g===r.maskY||(r.maskX=m,r.maskY=g,i[n+"MaskPosition"]=m+a+" "+g+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return e}),define("hilo/event/EventMixin",["hilo/core/Class"],function(t){var e={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[n],!0}return!1}},i=t.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),r=window.Event;if(r){var n=r.prototype,a=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){a&&a.call(this),this._stopped=!0}}return e}),define("hilo/view/Drawable",["hilo/core/Class","hilo/util/util"],function(t,e){var i=t.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var r=this,n=r.image;i.isDrawable(t)?r.image=t:e.copy(r,t,!0);var a=r.image;if("string"==typeof a){if(!n||a!==n.getAttribute("src")){r.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,r.init(o)},void(o.src=a)}a=r.image=n}a&&!r.rect&&(r.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return i}),define("hilo/renderer/Renderer",["hilo/core/Class","hilo/util/util"],function(t,e){var i=t.create({constructor:function(t){t=t||{},e.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return i}),define("hilo/renderer/CanvasRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"],function(t,e,i){var r=t.create({Extends:i,constructor:function(t){r.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var i=t.drawable;if(i&&i.domElement)return void e.setElementStyleByView(t);var r=this.context,n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),r.clip());var g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.y}v?r.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||r.translate(c,u),0!=p&&r.rotate(p*Math.PI/180),1==n&&1==a||r.scale(n,a),0==d&&0==f||r.translate(-d,-f))}t.alpha>0&&(r.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return r}),define("hilo/renderer/DOMRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/view/Drawable"],function(t,e,i,r){var n=function(){function a(t,i){var r=t.tagName||"div",n=i.image,a=t.width||n&&n.width,o=t.height||n&&n.height,s=e.createElement(r),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==r){if(s.width=a,s.height=o,n){var l=s.getContext("2d"),c=i.rect||[0,0,a,o];l.drawImage(n,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),n&&n.src){h.backgroundImage="url("+n.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return t.create({Extends:i,constructor:function(t){n.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(t){var e=t.drawable=t.drawable||new r;return e.domElement=e.domElement||a(t,e),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(e.setElementStyleByView(t),t===this.stage){var i=this.canvas.style,r=t._scaleX,n=t._scaleY,a=t.scaleX,o=t.scaleY;(!r&&1!=a||r&&r!=a)&&(t._scaleX=a,i.width=a*t.width+"px"),(!n&&1!=o||n&&n!=o)&&(t._scaleY=o,i.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return n}),define("hilo/renderer/WebGLRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"],function(t,e,i,r){var n=Math.PI/180,a=t.create({Extends:i,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){a.superclass.constructor.call(this,t);var e=this,i=a.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=a.MAX_BATCH_NUM,this.positionStride=4*a.ATTRIBUTE_NUM;var r=this.maxBatchNum*a.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var o=0,s=0;o0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var i=t.drawable;if(i&&i.domElement)return void e.setElementStyleByView(t);var n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new o(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,a=0,o=t.rotation%360,s=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*n;r=Math.cos(d),a=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=a*l,i.c=-a*c,i.d=r*c,i.tx=f.x-i.a*s-i.c*h,i.ty=f.y-i.b*s-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),o=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return o.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},a}),define("hilo/view/View",["hilo/core/Hilo","hilo/core/Class","hilo/event/EventMixin","hilo/geom/Matrix","hilo/util/util"],function(t,e,i,r,n){var a=function(){function a(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return e.create({Mixes:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("View"),n.copy(this,e,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(t,e,i){var r=this.getBounds(),n=t>=r.x&&t<=r.x+r.width&&e>=r.y&&e<=r.y+r.height;return n&&i&&(n=a(t,e,r)),n},hitTestObject:function(t,e){var i=this.getBounds(),r=t.getBounds(),n=i.x<=r.x+r.width&&r.x<=i.x+i.width&&i.y<=r.y+r.height&&r.y<=i.y+i.height;return n&&e&&(n=o(i,r)),!!n},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=n.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return t.viewToString(this)}})}();return a}),define("hilo/view/CacheMixin",["hilo/view/Drawable","hilo/util/browser"],function(t,e){var i,r,n={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){e.supportCanvas&&(i||(i=document.createElement("canvas"),r=i.getContext("2d")),i.width=this.width,i.height=this.height,this._draw(r),this.drawable=this.drawable||new t,this.drawable.init({image:i.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return n}),define("hilo/view/Container",["hilo/core/Hilo","hilo/core/Class","hilo/view/View"],function(t,e,i){var r=e.create({Extends:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("Container"),r.superclass.constructor.call(this,e),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){r.superclass.render.call(this,t,e);var i,n,a,o=this.children.slice(0);for(i=0,n=o.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var a=this._frames[i].callback;a&&a.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),n.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return n}),define("hilo/view/DOMElement",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"],function(t,e,i,r){var n=e.create({Extends:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("DOMElement"),n.superclass.constructor.call(this,e),this.drawable=new r;var i=this.drawable.domElement=e.element||t.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(e,i){if("dom"!==e.renderType){var r=e.canvas,n=this.parent,a=e._domElementContainer;e._domElementContainer||(a=e._domElementContainer=t.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),r.parentNode.insertBefore(e._domElementContainer,r.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else e.draw(this)}});return n}),define("hilo/view/Graphics",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,r){var n=function(){var a=document.createElement("canvas"),o=a.getContext&&a.getContext("2d");return e.create({Extends:i,Mixes:r,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("Graphics"),n.superclass.constructor.call(this,e),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,r,n,a){for(var s=this,h=o.createLinearGradient(t,e,i,r),l=0,c=n.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return n}),define("hilo/view/Text",["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,r){var n=t.create({Extends:i,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Text"),n.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=n.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=n.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l>1;break;case"bottom":_=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var i,r=document.documentElement,n=e.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return r.appendChild(n),i=n.offsetHeight,r.removeChild(n),i}}});return n}),define("hilo/view/BitmapText",["hilo/core/Class","hilo/core/Hilo","hilo/view/Container","hilo/view/Bitmap"],function(t,e,i,r){var n=t.create({Extends:i,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("BitmapText"),n.superclass.constructor.call(this,t);var i=t.text+"";i&&(this.text="",this.setText(i)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return n._pool.length?(e=n._pool.pop(),e.setImage(t.image,t.rect)):e=new r({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){n._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var l=n.ease?n.ease(s):s;n.reverse&&n.isStart&&(n._reverseFlag<0&&(s=1-s,l=1-l),s<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?h=!0:(n._startTime=i(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(l),(o=n.onUpdate)&&o.call(n,l,n),s>=1&&(n.reverse?(n._startTime=i(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=t?(c._render(s),c.time=a,e.add(c)):n.isComplete&&(u<0||u>t)&&c.start()}return n.isComplete?((o=n.onComplete)&&o.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,n=e._tweens,a=n.length;for(r=0;r-1&&n.splice(i,1);else for(i=0;i=i)return void t.fire("complete");if(t._currentIndex=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,i,r){return e.copy(t,i,r),o.copy||(o.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:t,event:{POINTER_START:t.POINTER_START,POINTER_MOVE:t.POINTER_MOVE,POINTER_END:t.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(r){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var a=(i.pageXOffset||n.scrollLeft)-(n.clientLeft||0)||0,o=(i.pageYOffset||n.scrollTop)-(n.clientTop||0)||0,s=i.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(s.paddingLeft)+h(s.borderLeftWidth)||0,c=h(s.paddingTop)+h(s.borderTopWidth)||0,u=h(s.paddingRight)+h(s.borderRightWidth)||0,d=h(s.paddingBottom)+h(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+a+l,top:f+o+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,n,a,o=r.createElement(t);for(i in e)if(n=e[i],"style"===i)for(a in n)o.style[a]=n[a];else o[i]=n;return o},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=s.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var h=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+h.a+", "+h.b+", 0, 0, "+h.c+", "+h.d+", 0, 0, 0, 0, 1, 0, "+h.tx+", "+h.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var l=e.image;if(l){var c=l.src;c!==r.image&&(r.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,g=p.y;m===r.maskX&&g===r.maskY||(r.maskX=m,r.maskY=g,i[n+"MaskPosition"]=m+a+" "+g+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return e}),define("hilo/event/EventMixin",["hilo/core/Class"],function(t){var e={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[n],!0}return!1}},i=t.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),r=window.Event;if(r){var n=r.prototype,a=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){a&&a.call(this),this._stopped=!0}}return e}),define("hilo/view/Drawable",["hilo/core/Class","hilo/util/util"],function(t,e){var i=t.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var r=this,n=r.image;i.isDrawable(t)?r.image=t:e.copy(r,t,!0);var a=r.image;if("string"==typeof a){if(!n||a!==n.getAttribute("src")){r.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,r.init(o)},void(o.src=a)}a=r.image=n}a&&!r.rect&&(r.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return i}),define("hilo/renderer/Renderer",["hilo/core/Class","hilo/util/util"],function(t,e){var i=t.create({constructor:function(t){t=t||{},e.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return i}),define("hilo/renderer/CanvasRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"],function(t,e,i){var r=t.create({Extends:i,constructor:function(t){r.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var i=t.drawable;if(i&&i.domElement)return void e.setElementStyleByView(t);var r=this.context,n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),r.clip());var g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.y}v?r.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||r.translate(c,u),0!=p&&r.rotate(p*Math.PI/180),1==n&&1==a||r.scale(n,a),0==d&&0==f||r.translate(-d,-f))}t.alpha>0&&(r.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return r}),define("hilo/renderer/DOMRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/view/Drawable"],function(t,e,i,r){var n=function(){function a(t,i){var r=t.tagName||"div",n=i.image,a=t.width||n&&n.width,o=t.height||n&&n.height,s=e.createElement(r),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==r){if(s.width=a,s.height=o,n){var l=s.getContext("2d"),c=i.rect||[0,0,a,o];l.drawImage(n,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),n&&n.src){h.backgroundImage="url("+n.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return t.create({Extends:i,constructor:function(t){n.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(t){var e=t.drawable=t.drawable||new r;return e.domElement=e.domElement||a(t,e),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(e.setElementStyleByView(t),t===this.stage){var i=this.canvas.style,r=t._scaleX,n=t._scaleY,a=t.scaleX,o=t.scaleY;(!r&&1!=a||r&&r!=a)&&(t._scaleX=a,i.width=a*t.width+"px"),(!n&&1!=o||n&&n!=o)&&(t._scaleY=o,i.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return n}),define("hilo/renderer/WebGLRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"],function(t,e,i,r){var n=Math.PI/180,a=t.create({Extends:i,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){a.superclass.constructor.call(this,t);var e=this,i=a.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=a.MAX_BATCH_NUM,this.positionStride=4*a.ATTRIBUTE_NUM;var r=this.maxBatchNum*a.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var o=0,s=0;o0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var i=t.drawable;if(i&&i.domElement)return void e.setElementStyleByView(t);var n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new o(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,a=0,o=t.rotation%360,s=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*n;r=Math.cos(d),a=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=a*l,i.c=-a*c,i.d=r*c,i.tx=f.x-i.a*s-i.c*h,i.ty=f.y-i.b*s-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),o=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return o.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},a}),define("hilo/view/View",["hilo/core/Hilo","hilo/core/Class","hilo/event/EventMixin","hilo/geom/Matrix","hilo/util/util"],function(t,e,i,r,n){var a=function(){function a(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return e.create({Mixes:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("View"),n.copy(this,e,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(t,e,i){var r=this.getBounds(),n=t>=r.x&&t<=r.x+r.width&&e>=r.y&&e<=r.y+r.height;return n&&i&&(n=a(t,e,r)),n},hitTestObject:function(t,e){var i=this.getBounds(),r=t.getBounds(),n=i.x<=r.x+r.width&&r.x<=i.x+i.width&&i.y<=r.y+r.height&&r.y<=i.y+i.height;return n&&e&&(n=o(i,r)),!!n},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=n.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return t.viewToString(this)}})}();return a}),define("hilo/view/CacheMixin",["hilo/view/Drawable","hilo/util/browser"],function(t,e){var i,r,n={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){e.supportCanvas&&(i||(i=document.createElement("canvas"),r=i.getContext("2d")),i.width=this.width,i.height=this.height,this._draw(r),this.drawable=this.drawable||new t,this.drawable.init({image:i.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return n}),define("hilo/view/Container",["hilo/core/Hilo","hilo/core/Class","hilo/view/View"],function(t,e,i){var r=e.create({Extends:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("Container"),r.superclass.constructor.call(this,e),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){r.superclass.render.call(this,t,e);var i,n,a,o=this.children.slice(0);for(i=0,n=o.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var a=this._frames[i].callback;a&&a.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),n.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return n}),define("hilo/view/DOMElement",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"],function(t,e,i,r){var n=e.create({Extends:i,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("DOMElement"),n.superclass.constructor.call(this,e),this.drawable=new r;var i=this.drawable.domElement=e.element||t.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(e,i){if("dom"!==e.renderType){var r=e.canvas,n=this.parent,a=e._domElementContainer;e._domElementContainer||(a=e._domElementContainer=t.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),r.parentNode.insertBefore(e._domElementContainer,r.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else e.draw(this)}});return n}),define("hilo/view/Graphics",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,r){var n=function(){var a=document.createElement("canvas"),o=a.getContext&&a.getContext("2d");return e.create({Extends:i,Mixes:r,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("Graphics"),n.superclass.constructor.call(this,e),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,r,n,a){for(var s=this,h=o.createLinearGradient(t,e,i,r),l=0,c=n.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return n}),define("hilo/view/Text",["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,r){var n=t.create({Extends:i,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Text"),n.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=n.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=n.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l>1;break;case"bottom":_=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var i,r=document.documentElement,n=e.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return r.appendChild(n),i=n.offsetHeight,r.removeChild(n),i}}});return n}),define("hilo/view/BitmapText",["hilo/core/Class","hilo/core/Hilo","hilo/view/Container","hilo/view/Bitmap"],function(t,e,i,r){var n=t.create({Extends:i,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("BitmapText"),n.superclass.constructor.call(this,t);var i=t.text+"";i&&(this.text="",this.setText(i)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return n._pool.length?(e=n._pool.pop(),e.setImage(t.image,t.rect)):e=new r({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){n._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var h=n.ease?n.ease(s):s;n.reverse&&n.isStart&&(n._reverseFlag<0&&(s=1-s,h=1-h),s<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=i(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(h),(o=n.onUpdate)&&o.call(n,h,n),s>=1&&(n.reverse?(n._startTime=i(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&c<=t?(l._render(s),l.time=a,e.add(l)):n.isComplete&&(c<0||c>t)&&l.start()}return n.isComplete?((o=n.onComplete)&&o.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,n=e._tweens,a=n.length;for(r=0;r-1&&n.splice(i,1);else for(i=0;i=i)return void t.fire("complete");if(t._currentIndexe.z})},tick:function(){this.sortZ()}});return o}();return i}),define("hilo/game/ParticleSystem",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Container","hilo/view/Drawable","hilo/util/util"],function(t,e,i,r,n,a){var o=function(){function o(t,e){return e?t+2*(Math.random()-.5)*e:t}for(var s=["x","y","vx","vy","ax","ay","rotation","rotationV","scale","scaleV","alpha","alphaV","life"],h=[],l=0,c=s.length;l=this._emitTime&&(this._currentRunTime=0,this._emitTime=o(this.emitTime,this.emitTimeVar),this._emit()),this._totalRunTime>=this.totalTime&&this.stop())},_emit:function(){for(var t=o(this.emitNum,this.emitNumVar)>>0,e=0;e=0;e--)this.children[e].destroy()}}),v=e.create({Extends:i,constructor:function(e){this.id=this.id||e.id||t.getUid("Particle"),v.superclass.constructor.call(this,e),this.init(e)},onUpdate:function(t){if(t*=.001,this._died)return!1;var e=this.ax+this.system.gx,i=this.ay+this.system.gy;return this.vx+=e*t,this.vy+=i*t,this.x+=this.vx*t,this.y+=this.vy*t,this.rotation+=this.rotationV,this._time>.1&&(this.alpha+=this.alphaV),this.scale+=this.scaleV,this.scaleX=this.scaleY=this.scale,this._time+=t,this._time>=this.life||this.alpha<=0?(this.destroy(),!1):void 0},setImage:function(t,e){this.drawable=this.drawable||new n,e=e||[0,0,t.width,t.height],this.width=e[2],this.height=e[3],this.drawable.rect=e,this.drawable.image=t},destroy:function(){this._died=!0,this.alpha=0,this.removeFromParent(),f.push(this)},init:function(t){this.system=t.system,this._died=!1,this._time=0,this.alpha=1;for(var e=0,i=h.length;e>0]),this.setImage(t.image,a),void 0!==t.pivotX&&(this.pivotX=t.pivotX*a[2]),void 0!==t.pivotY&&(this.pivotY=t.pivotY*a[3])}},Statics:{create:function(t){if(f.length>0){var e=f.pop();return e.init(t),e}return new v(t)}}});return p}();return o}); \ No newline at end of file diff --git a/build/amd/hilo-amd.zip b/build/amd/hilo-amd.zip index bc60495e..55bf2144 100644 Binary files a/build/amd/hilo-amd.zip and b/build/amd/hilo-amd.zip differ diff --git a/build/amd/hilo/core/Class.js b/build/amd/hilo/core/Class.js index 75925ddb..9c77425b 100644 --- a/build/amd/hilo/core/Class.js +++ b/build/amd/hilo/core/Class.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/core/Class.min.js b/build/amd/hilo/core/Class.min.js index a395dfbf..61dbcf98 100644 --- a/build/amd/hilo/core/Class.min.js +++ b/build/amd/hilo/core/Class.min.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/core/Hilo.js b/build/amd/hilo/core/Hilo.js index e107d549..6397f5c5 100644 --- a/build/amd/hilo/core/Hilo.js +++ b/build/amd/hilo/core/Hilo.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -27,7 +27,7 @@ var Hilo = { * Hilo version * @type String */ - version: '2.0.0', + version: '2.0.1', /** * @language=en * Gets a globally unique id. Such as Stage1, Bitmap2 etc. diff --git a/build/amd/hilo/core/Hilo.min.js b/build/amd/hilo/core/Hilo.min.js index d6f61d65..2e1532f5 100644 --- a/build/amd/hilo/core/Hilo.min.js +++ b/build/amd/hilo/core/Hilo.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define("hilo/core/Hilo",["hilo/util/browser","hilo/util/util"],function(t,e){var a=window,o=document,r=o.documentElement,n=0,i={},s={version:"2.0.0",getUid:function(t){var e=++n;if(t){var a=t.charCodeAt(t.length-1);return a>=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,a,o){return e.copy(t,a,o),i.copy||(i.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:t,event:{POINTER_START:t.POINTER_START,POINTER_MOVE:t.POINTER_MOVE,POINTER_END:t.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(o){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var n=(a.pageXOffset||r.scrollLeft)-(r.clientLeft||0)||0,i=(a.pageYOffset||r.scrollTop)-(r.clientTop||0)||0,s=a.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(s.paddingLeft)+c(s.borderLeftWidth)||0,f=c(s.paddingTop)+c(s.borderTopWidth)||0,d=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+n+h,top:g+i+f,width:m-d-p-h,height:T-l-g-f}},createElement:function(t,e){var a,r,n,i=o.createElement(t);for(a in e)if(r=e[a],"style"===a)for(n in r)i.style[n]=r[n];else i[a]=r;return i},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,o=t._stateCache||(t._stateCache={}),r=s.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],o)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],o)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],o)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],o)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],o)&&(a.zIndex=t.depth+1),t.transform){var c=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]="0 0"),a[r+"Transform"]="matrix3d("+c.a+", "+c.b+", 0, 0, "+c.c+", "+c.d+", 0, 0, 0, 0, 1, 0, "+c.tx+", "+c.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],o)||i)&&(a[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],o)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var h=e.image;if(h){var f=h.src;f!==o.image&&(o.image=f,a.backgroundImage="url("+f+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==o.sx&&(o.sx=l,a.backgroundPositionX=-l+n),g!==o.sy&&(o.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==o.maskImage&&(o.maskImage=m,a[r+"MaskImage"]=m,a[r+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===o.maskX&&u===o.maskY||(o.maskX=T,o.maskY=u,a[r+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var o,r,n,i,s=!1;for(o=0,r=e.length;o=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,a,o){return e.copy(t,a,o),i.copy||(i.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:t,event:{POINTER_START:t.POINTER_START,POINTER_MOVE:t.POINTER_MOVE,POINTER_END:t.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(o){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var n=(a.pageXOffset||r.scrollLeft)-(r.clientLeft||0)||0,i=(a.pageYOffset||r.scrollTop)-(r.clientTop||0)||0,s=a.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(s.paddingLeft)+c(s.borderLeftWidth)||0,f=c(s.paddingTop)+c(s.borderTopWidth)||0,d=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+n+h,top:g+i+f,width:m-d-p-h,height:T-l-g-f}},createElement:function(t,e){var a,r,n,i=o.createElement(t);for(a in e)if(r=e[a],"style"===a)for(n in r)i.style[n]=r[n];else i[a]=r;return i},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,o=t._stateCache||(t._stateCache={}),r=s.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],o)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],o)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],o)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],o)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],o)&&(a.zIndex=t.depth+1),t.transform){var c=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]="0 0"),a[r+"Transform"]="matrix3d("+c.a+", "+c.b+", 0, 0, "+c.c+", "+c.d+", 0, 0, 0, 0, 1, 0, "+c.tx+", "+c.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],o)||i)&&(a[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],o)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var h=e.image;if(h){var f=h.src;f!==o.image&&(o.image=f,a.backgroundImage="url("+f+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==o.sx&&(o.sx=l,a.backgroundPositionX=-l+n),g!==o.sy&&(o.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==o.maskImage&&(o.maskImage=m,a[r+"MaskImage"]=m,a[r+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===o.maskX&&u===o.maskY||(o.maskX=T,o.maskY=u,a[r+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var o,r,n,i,s=!1;for(o=0,r=e.length;o= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -259,7 +259,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; diff --git a/build/amd/hilo/tween/Tween.min.js b/build/amd/hilo/tween/Tween.min.js index 7f1e3d53..70b35051 100644 --- a/build/amd/hilo/tween/Tween.min.js +++ b/build/amd/hilo/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for amd + * hilojs 2.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define("hilo/tween/Tween",["hilo/core/Class"],function(e){var t=function(){function r(){return+new Date}return e.create({constructor:function(e,t,r,a){var n=this;n.target=e,n._startTime=0,n._seekTime=0,n._pausedTime=0,n._pausedStartTime=0,n._reverseFlag=1,n._repeatCount=0,3==arguments.length&&(a=r,r=t,t=null);for(var i in a)n[i]=a[i];n._fromProps=t,n._toProps=r,!a.duration&&a.time&&(n.duration=a.time||0,n.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,a=r.target,n=e||t,i=r._fromProps={},s=r._toProps={};e=e||a,t=t||a;for(var o in n)s[o]=t[o]||0,a[o]=i[o]=e[o]||0;return r},start:function(){var e=this;return e._startTime=r()+e.delay,e._seekTime=0,e._pausedTime=0,e._reverseFlag=1,e._repeatCount=0,e.paused=!1,e.isStart=!1,e.isComplete=!1,t.add(e),e},stop:function(){return t.remove(this),this},pause:function(){var e=this;return e.paused=!0,e._pausedStartTime=r(),e},resume:function(){var e=this;return e.paused=!1,e._pausedStartTime&&(e._pausedTime+=r()-e._pausedStartTime),e._pausedStartTime=0,e},seek:function(e,a){var n=this,i=r();return n._startTime=i,n._seekTime=e,n._pausedTime=0,void 0!==a&&(n.paused=a),n._update(i,!0),t.add(n),n},link:function(e){var r,a,n=this,i=e.delay,s=n._startTime;return"string"==typeof i&&(r=0==i.indexOf("+"),a=0==i.indexOf("-"),i=r||a?Number(i.substr(1))*(r?1:-1):Number(i)),e.delay=i,e._startTime=r||a?s+n.duration+i:s+i,n._next=e,t.remove(e),e},_render:function(e){var t,r=this,a=r.target,n=r._fromProps;for(t in n)a[t]=n[t]+(r._toProps[t]-n[t])*e},_update:function(e,a){var n=this;if(!n.paused||a){if(n.isComplete)return!0;var i=e-n._startTime-n._pausedTime+n._seekTime;if(!(i<0)){var s,o=i/n.duration,u=!1;o=o<=0?0:o>=1?1:o;var p=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,p=1-p),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?u=!0:(n._startTime=r(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(p),(s=n.onUpdate)&&s.call(n,p,n),o>=1&&(n.reverse?(n._startTime=r(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&m<=e?(l._render(o),l.time=i,t.add(l)):n.isComplete&&(m<0||m>e)&&l.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,a,n=t._tweens,i=n.length;for(a=0;a-1&&n.splice(r,1);else for(r=0;r=1?1:o;var u=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,u=1-u),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=r(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(u),(s=n.onUpdate)&&s.call(n,u,n),o>=1&&(n.reverse?(n._startTime=r(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&l<=e?(p._render(o),p.time=i,t.add(p)):n.isComplete&&(l<0||l>e)&&p.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,a,n=t._tweens,i=n.length;for(a=0;a-1&&n.splice(r,1);else for(r=0;r= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -6132,7 +6132,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; @@ -6328,7 +6328,7 @@ return Tween; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6600,7 +6600,7 @@ return Ease; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6650,7 +6650,7 @@ return ImageLoader; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6719,7 +6719,7 @@ return ScriptLoader; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6991,7 +6991,7 @@ return LoadQueue; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7198,7 +7198,7 @@ return HTMLAudio; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7526,7 +7526,7 @@ return WebAudio; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7633,7 +7633,7 @@ return WebSound; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7729,7 +7729,7 @@ return Camera; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7919,7 +7919,7 @@ return Camera3d; }); /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo-cmd.min.js b/build/cmd/hilo-cmd.min.js index aff8a1a2..fbbc8e54 100644 --- a/build/cmd/hilo-cmd.min.js +++ b/build/cmd/hilo-cmd.min.js @@ -1,8 +1,8 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(t,e,i){var r=function(){var t=navigator.userAgent,e=document,i=window,r=e.documentElement,n={iphone:/iphone/i.test(t),ipad:/ipad/i.test(t),ipod:/ipod/i.test(t),ios:/iphone|ipad|ipod/i.test(t),android:/android/i.test(t),webkit:/webkit/i.test(t),chrome:/chrome/i.test(t),safari:/safari/i.test(t),firefox:/firefox/i.test(t),ie:/msie/i.test(t),opera:/opera/i.test(t),supportTouch:"ontouchstart"in i,supportCanvas:null!=e.createElement("canvas").getContext,supportStorage:!1,supportOrientation:"orientation"in i||"orientation"in i.screen,supportDeviceMotion:"ondevicemotion"in i};try{var a="hilo";localStorage.setItem(a,a),localStorage.removeItem(a),n.supportStorage=!0}catch(o){}var s=n.jsVendor=n.webkit?"webkit":n.firefox?"webkit":n.opera?"o":n.ie?"ms":"",h=n.cssVendor="-"+s+"-",l=e.createElement("div"),c=l.style,u=void 0!=c[s+"Transform"],d=void 0!=c[s+"Perspective"];d&&(l.id="test3d",c=e.createElement("style"),c.textContent="@media ("+h+"transform-3d){#test3d{height:3px}}",e.head.appendChild(c),r.appendChild(l),d=3==l.offsetHeight,e.head.removeChild(c),r.removeChild(l)),n.supportTransform=u,n.supportTransform3D=d;var f=n.supportTouch,p=f?"touchstart":"mousedown",v=f?"touchmove":"mousemove",m=f?"touchend":"mouseup";return n.POINTER_START=p,n.POINTER_MOVE=v,n.POINTER_END=m,n}();return r}),define(function(t,e,i){var r={copy:function(t,e,i){for(var r in e)i&&!t.hasOwnProperty(r)&&void 0===t[r]||(t[r]=e[r]);return t}};return r}),define(function(t,e,i){var r=t("hilo/util/browser"),n=t("hilo/util/util"),a=window,o=document,s=o.documentElement,h=0,l={},c={version:"2.0.0",getUid:function(t){var e=++h;if(t){var i=t.charCodeAt(t.length-1);return i>=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,i){return n.copy(t,e,i),l.copy||(l.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:r,event:{POINTER_START:r.POINTER_START,POINTER_MOVE:r.POINTER_MOVE,POINTER_END:r.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(a.pageXOffset||s.scrollLeft)-(s.clientLeft||0)||0,n=(a.pageYOffset||s.scrollTop)-(s.clientTop||0)||0,o=a.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(o.paddingLeft)+h(o.borderLeftWidth)||0,c=h(o.paddingTop)+h(o.borderTopWidth)||0,u=h(o.paddingRight)+h(o.borderRightWidth)||0,d=h(o.paddingBottom)+h(o.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+r+l,top:f+n+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,r,n,a=o.createElement(t);for(i in e)if(r=e[i],"style"===i)for(n in r)a.style[n]=r[n];else a[i]=r;return a},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=c.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var h=e.image;if(h){var l=h.src;l!==r.image&&(r.image=l,i.backgroundImage="url("+l+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,_=p.y;m===r.maskX&&_===r.maskY||(r.maskX=m,r.maskY=_,i[n+"MaskPosition"]=m+a+" "+_+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return n}),define(function(t,e,i){var r=t("hilo/core/Class"),n={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete n[r],!0}return!1}},a=r.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),o=window.Event;if(o){var s=o.prototype,h=s.stopImmediatePropagation;s.stopImmediatePropagation=function(){h&&h.call(this),this._stopped=!0}}return n}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/util/util"),a=r.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,i=e.image;a.isDrawable(t)?e.image=t:n.copy(e,t,!0);var r=e.image;if("string"==typeof r){if(!i||r!==i.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=r)}r=e.image=i}r&&!e.rect&&(e.rect=[0,0,r.width,r.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return a}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/util/util"),a=r.create({constructor:function(t){t=t||{},n.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return a}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=r.create({Extends:a,constructor:function(t){o.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void n.setElementStyleByView(t);var i=this.context,r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),i.clip());var _=t.align;if(_){var g=t.getAlignPosition();c=g.x,u=g.y}v?i.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||i.translate(c,u),0!=p&&i.rotate(p*Math.PI/180),1==r&&1==a||i.scale(r,a),0==d&&0==f||i.translate(-d,-f))}t.alpha>0&&(i.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return o}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=t("hilo/view/Drawable"),s=function(){function t(t,e){var i=t.tagName||"div",r=e.image,a=t.width||r&&r.width,o=t.height||r&&r.height,s=n.createElement(i),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==i){if(s.width=a,s.height=o,r){var l=s.getContext("2d"),c=e.rect||[0,0,a,o];l.drawImage(r,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),r&&r.src){h.backgroundImage="url("+r.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return r.create({Extends:a,constructor:function(t){s.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new o;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(n.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,i=t._scaleX,r=t._scaleY,a=t.scaleX,o=t.scaleY;(!i&&1!=a||i&&i!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!r&&1!=o||r&&r!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=t("hilo/geom/Matrix"),s=Math.PI/180,h=r.create({Extends:a,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){h.superclass.constructor.call(this,t);var e=this,i=h.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=h.MAX_BATCH_NUM,this.positionStride=4*h.ATTRIBUTE_NUM;var r=this.maxBatchNum*h.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var a=0,o=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void n.setElementStyleByView(t);var i=t.scaleX,r=t.scaleY;if(t===this.stage){var a=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=i||s&&s!=i)&&(t._scaleX=i,a.width=i*t.width+"px",l=!0),(!h&&1!=r||h&&h!=r)&&(t._scaleY=r,a.height=r*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new o(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new o(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new l(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,n=0,a=t.rotation%360,o=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(a){var d=a*s;r=Math.cos(d),n=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=n*l,i.c=-n*c,i.d=r*c,i.tx=f.x-i.a*o-i.c*h,i.ty=f.y-i.b*o-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),l=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return l.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},h}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/event/EventMixin"),o=t("hilo/geom/Matrix"),s=t("hilo/util/util"),h=function(){function t(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return n.create({Mixes:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("View"),s.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(e,i,r){var n=this.getBounds(),a=e>=n.x&&e<=n.x+n.width&&i>=n.y&&i<=n.y+n.height;return a&&r&&(a=t(e,i,n)),a},hitTestObject:function(t,i){var r=this.getBounds(),n=t.getBounds(),a=r.x<=n.x+n.width&&n.x<=r.x+r.width&&r.y<=n.y+n.height&&n.y<=r.y+r.height;return a&&i&&(a=e(r,n)),!!a},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=s.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return r.viewToString(this)}})}();return h}),define(function(t,e,i){var r,n,a=t("hilo/view/Drawable"),o=t("hilo/util/browser"),s={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){o.supportCanvas&&(r||(r=document.createElement("canvas"),n=r.getContext("2d")),r.width=this.width,r.height=this.height,this._draw(n),this.drawable=this.drawable||new a,this.drawable.init({image:r.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=n.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("Container"),o.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){o.superclass.render.call(this,t,e);var i,r,n,a=this.children.slice(0);for(i=0,r=a.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var n=this._frames[i].callback;n&&n.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),s.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=t("hilo/view/Drawable"),s=n.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("DOMElement"),s.superclass.constructor.call(this,t),this.drawable=new o;var e=this.drawable.domElement=t.element||r.createElement("div");e.id=this.id,this.pointerEnabled&&!e.style.pointerEvents&&(e.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,e){if("dom"!==t.renderType){var i=t.canvas,n=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=r.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),i.parentNode.insertBefore(t._domElementContainer,i.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else t.draw(this)}});return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=t("hilo/view/CacheMixin"),s=function(){var t=document.createElement("canvas"),e=t.getContext&&t.getContext("2d");return n.create({Extends:a,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("Graphics"),s.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,i,r,n,a,o){for(var s=this,h=e.createLinearGradient(t,i,r,n),l=0,c=a.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/view/View"),o=t("hilo/view/CacheMixin"),s=r.create({Extends:a,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||n.getUid("Text"),s.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=s.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=s.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l<_&&(l=_),c+=u,m=v):(_=f,m+=v),p==s-1&&(d.push({text:m,y:c}),m!==v&&l>1;break;case"bottom":g=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,r=n.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(r),e=r.offsetHeight,i.removeChild(r),e}}});return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/view/Container"),o=t("hilo/view/Bitmap"),s=r.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||n.getUid("BitmapText"),s.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return s._pool.length?(e=s._pool.pop(),e.setImage(t.image,t.rect)):e=new o({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){s._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var l=r.ease?r.ease(s):s;r.reverse&&r.isStart&&(r._reverseFlag<0&&(s=1-s,l=1-l),s<1e-7&&(r.repeat>0&&r._repeatCount++>=r.repeat||0==r.repeat&&!r.loop?h=!0:(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1))),r.isStart||(r.setProps(r._fromProps,r._toProps),r.isStart=!0,r.onStart&&r.onStart.call(r,r)),r.time=a,r._render(l),(o=r.onUpdate)&&o.call(r,l,r),s>=1&&(r.reverse?(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1):r.loop||r.repeat>0&&r._repeatCount++0&&u<=e?(c._render(s),c.time=a,n.add(c)):r.isComplete&&(u<0||u>e)&&c.start()}return r.isComplete?((o=r.onComplete)&&o.call(r,r),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,i,r=n._tweens,a=r.length;for(i=0;i-1&&r.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndex=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,i){return n.copy(t,e,i),l.copy||(l.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:r,event:{POINTER_START:r.POINTER_START,POINTER_MOVE:r.POINTER_MOVE,POINTER_END:r.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(a.pageXOffset||s.scrollLeft)-(s.clientLeft||0)||0,n=(a.pageYOffset||s.scrollTop)-(s.clientTop||0)||0,o=a.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(o.paddingLeft)+h(o.borderLeftWidth)||0,c=h(o.paddingTop)+h(o.borderTopWidth)||0,u=h(o.paddingRight)+h(o.borderRightWidth)||0,d=h(o.paddingBottom)+h(o.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+r+l,top:f+n+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,r,n,a=o.createElement(t);for(i in e)if(r=e[i],"style"===i)for(n in r)a.style[n]=r[n];else a[i]=r;return a},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=c.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var h=e.image;if(h){var l=h.src;l!==r.image&&(r.image=l,i.backgroundImage="url("+l+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,_=p.y;m===r.maskX&&_===r.maskY||(r.maskX=m,r.maskY=_,i[n+"MaskPosition"]=m+a+" "+_+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return n}),define(function(t,e,i){var r=t("hilo/core/Class"),n={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete n[r],!0}return!1}},a=r.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),o=window.Event;if(o){var s=o.prototype,h=s.stopImmediatePropagation;s.stopImmediatePropagation=function(){h&&h.call(this),this._stopped=!0}}return n}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/util/util"),a=r.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,i=e.image;a.isDrawable(t)?e.image=t:n.copy(e,t,!0);var r=e.image;if("string"==typeof r){if(!i||r!==i.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=r)}r=e.image=i}r&&!e.rect&&(e.rect=[0,0,r.width,r.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return a}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/util/util"),a=r.create({constructor:function(t){t=t||{},n.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return a}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=r.create({Extends:a,constructor:function(t){o.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void n.setElementStyleByView(t);var i=this.context,r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),i.clip());var _=t.align;if(_){var g=t.getAlignPosition();c=g.x,u=g.y}v?i.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||i.translate(c,u),0!=p&&i.rotate(p*Math.PI/180),1==r&&1==a||i.scale(r,a),0==d&&0==f||i.translate(-d,-f))}t.alpha>0&&(i.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return o}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=t("hilo/view/Drawable"),s=function(){function t(t,e){var i=t.tagName||"div",r=e.image,a=t.width||r&&r.width,o=t.height||r&&r.height,s=n.createElement(i),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==i){if(s.width=a,s.height=o,r){var l=s.getContext("2d"),c=e.rect||[0,0,a,o];l.drawImage(r,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),r&&r.src){h.backgroundImage="url("+r.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return r.create({Extends:a,constructor:function(t){s.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new o;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(n.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,i=t._scaleX,r=t._scaleY,a=t.scaleX,o=t.scaleY;(!i&&1!=a||i&&i!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!r&&1!=o||r&&r!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/renderer/Renderer"),o=t("hilo/geom/Matrix"),s=Math.PI/180,h=r.create({Extends:a,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){h.superclass.constructor.call(this,t);var e=this,i=h.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=h.MAX_BATCH_NUM,this.positionStride=4*h.ATTRIBUTE_NUM;var r=this.maxBatchNum*h.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var a=0,o=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void n.setElementStyleByView(t);var i=t.scaleX,r=t.scaleY;if(t===this.stage){var a=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=i||s&&s!=i)&&(t._scaleX=i,a.width=i*t.width+"px",l=!0),(!h&&1!=r||h&&h!=r)&&(t._scaleY=r,a.height=r*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new o(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new o(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new l(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,n=0,a=t.rotation%360,o=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(a){var d=a*s;r=Math.cos(d),n=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=n*l,i.c=-n*c,i.d=r*c,i.tx=f.x-i.a*o-i.c*h,i.ty=f.y-i.b*o-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),l=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return l.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},h}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/event/EventMixin"),o=t("hilo/geom/Matrix"),s=t("hilo/util/util"),h=function(){function t(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return n.create({Mixes:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("View"),s.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(e,i,r){var n=this.getBounds(),a=e>=n.x&&e<=n.x+n.width&&i>=n.y&&i<=n.y+n.height;return a&&r&&(a=t(e,i,n)),a},hitTestObject:function(t,i){var r=this.getBounds(),n=t.getBounds(),a=r.x<=n.x+n.width&&n.x<=r.x+r.width&&r.y<=n.y+n.height&&n.y<=r.y+r.height;return a&&i&&(a=e(r,n)),!!a},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=s.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return r.viewToString(this)}})}();return h}),define(function(t,e,i){var r,n,a=t("hilo/view/Drawable"),o=t("hilo/util/browser"),s={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){o.supportCanvas&&(r||(r=document.createElement("canvas"),n=r.getContext("2d")),r.width=this.width,r.height=this.height,this._draw(n),this.drawable=this.drawable||new a,this.drawable.init({image:r.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=n.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("Container"),o.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){o.superclass.render.call(this,t,e);var i,r,n,a=this.children.slice(0);for(i=0,r=a.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var n=this._frames[i].callback;n&&n.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),s.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=t("hilo/view/Drawable"),s=n.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("DOMElement"),s.superclass.constructor.call(this,t),this.drawable=new o;var e=this.drawable.domElement=t.element||r.createElement("div");e.id=this.id,this.pointerEnabled&&!e.style.pointerEvents&&(e.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,e){if("dom"!==t.renderType){var i=t.canvas,n=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=r.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),i.parentNode.insertBefore(t._domElementContainer,i.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else t.draw(this)}});return s}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=t("hilo/view/CacheMixin"),s=function(){var t=document.createElement("canvas"),e=t.getContext&&t.getContext("2d");return n.create({Extends:a,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||r.getUid("Graphics"),s.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,i,r,n,a,o){for(var s=this,h=e.createLinearGradient(t,i,r,n),l=0,c=a.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/view/View"),o=t("hilo/view/CacheMixin"),s=r.create({Extends:a,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||n.getUid("Text"),s.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=s.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=s.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l<_&&(l=_),c+=u,m=v):(_=f,m+=v),p==s-1&&(d.push({text:m,y:c}),m!==v&&l>1;break;case"bottom":g=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,r=n.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(r),e=r.offsetHeight,i.removeChild(r),e}}});return s}),define(function(t,e,i){var r=t("hilo/core/Class"),n=t("hilo/core/Hilo"),a=t("hilo/view/Container"),o=t("hilo/view/Bitmap"),s=r.create({Extends:a,constructor:function(t){t=t||{},this.id=this.id||t.id||n.getUid("BitmapText"),s.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return s._pool.length?(e=s._pool.pop(),e.setImage(t.image,t.rect)):e=new o({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){s._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var h=r.ease?r.ease(s):s;r.reverse&&r.isStart&&(r._reverseFlag<0&&(s=1-s,h=1-h),s<1e-7&&(r.repeat>0&&r._repeatCount++>=r.repeat||0==r.repeat&&!r.loop?r.isComplete=!0:(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1))),r.isStart||(r.setProps(r._fromProps,r._toProps),r.isStart=!0,r.onStart&&r.onStart.call(r,r)),r.time=a,r._render(h),(o=r.onUpdate)&&o.call(r,h,r),s>=1&&(r.reverse?(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1):r.loop||r.repeat>0&&r._repeatCount++0&&c<=e?(l._render(s),l.time=a,n.add(l)):r.isComplete&&(c<0||c>e)&&l.start()}return r.isComplete?((o=r.onComplete)&&o.call(r,r),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,i,r=n._tweens,a=r.length;for(i=0;i-1&&r.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndexe.z})},tick:function(){this.sortZ()}});return o}();return a}),define(function(t,e,i){var r=t("hilo/core/Hilo"),n=t("hilo/core/Class"),a=t("hilo/view/View"),o=t("hilo/view/Container"),s=t("hilo/view/Drawable"),h=t("hilo/util/util"),l=function(){function t(t,e){return e?t+2*(Math.random()-.5)*e:t}for(var e=["x","y","vx","vy","ax","ay","rotation","rotationV","scale","scaleV","alpha","alphaV","life"],i=[],l=0,c=e.length;l=this._emitTime&&(this._currentRunTime=0,this._emitTime=t(this.emitTime,this.emitTimeVar),this._emit()),this._totalRunTime>=this.totalTime&&this.stop())},_emit:function(){for(var e=t(this.emitNum,this.emitNumVar)>>0,i=0;i=0;e--)this.children[e].destroy()}}),v=n.create({Extends:a,constructor:function(t){this.id=this.id||t.id||r.getUid("Particle"),v.superclass.constructor.call(this,t),this.init(t)},onUpdate:function(t){if(t*=.001,this._died)return!1;var e=this.ax+this.system.gx,i=this.ay+this.system.gy;return this.vx+=e*t,this.vy+=i*t,this.x+=this.vx*t,this.y+=this.vy*t,this.rotation+=this.rotationV,this._time>.1&&(this.alpha+=this.alphaV),this.scale+=this.scaleV,this.scaleX=this.scaleY=this.scale,this._time+=t,this._time>=this.life||this.alpha<=0?(this.destroy(),!1):void 0},setImage:function(t,e){this.drawable=this.drawable||new s,e=e||[0,0,t.width,t.height],this.width=e[2],this.height=e[3],this.drawable.rect=e,this.drawable.image=t},destroy:function(){this._died=!0,this.alpha=0,this.removeFromParent(),f.push(this)},init:function(e){this.system=e.system,this._died=!1,this._time=0,this.alpha=1;for(var r=0,n=i.length;r>0]),this.setImage(e.image,s),void 0!==e.pivotX&&(this.pivotX=e.pivotX*s[2]),void 0!==e.pivotY&&(this.pivotY=e.pivotY*s[3])}},Statics:{create:function(t){if(f.length>0){var e=f.pop();return e.init(t),e}return new v(t)}}});return p}();return l}); \ No newline at end of file diff --git a/build/cmd/hilo-cmd.zip b/build/cmd/hilo-cmd.zip index 581070f4..90216cdb 100644 Binary files a/build/cmd/hilo-cmd.zip and b/build/cmd/hilo-cmd.zip differ diff --git a/build/cmd/hilo/core/Class.js b/build/cmd/hilo/core/Class.js index 29c9e7f5..9404f0f3 100644 --- a/build/cmd/hilo/core/Class.js +++ b/build/cmd/hilo/core/Class.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/core/Class.min.js b/build/cmd/hilo/core/Class.min.js index 023f8096..cb7523e2 100644 --- a/build/cmd/hilo/core/Class.min.js +++ b/build/cmd/hilo/core/Class.min.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/core/Hilo.js b/build/cmd/hilo/core/Hilo.js index e6a5e544..41755fc6 100644 --- a/build/cmd/hilo/core/Hilo.js +++ b/build/cmd/hilo/core/Hilo.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -30,7 +30,7 @@ var Hilo = { * Hilo version * @type String */ - version: '2.0.0', + version: '2.0.1', /** * @language=en * Gets a globally unique id. Such as Stage1, Bitmap2 etc. diff --git a/build/cmd/hilo/core/Hilo.min.js b/build/cmd/hilo/core/Hilo.min.js index 1cc25055..f3be966f 100644 --- a/build/cmd/hilo/core/Hilo.min.js +++ b/build/cmd/hilo/core/Hilo.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(t,e,a){var r=t("hilo/util/browser"),o=t("hilo/util/util"),n=window,i=document,s=i.documentElement,c=0,h={},f={version:"2.0.0",getUid:function(t){var e=++c;if(t){var a=t.charCodeAt(t.length-1);return a>=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,a){return o.copy(t,e,a),h.copy||(h.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:r,event:{POINTER_START:r.POINTER_START,POINTER_MOVE:r.POINTER_MOVE,POINTER_END:r.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(n.pageXOffset||s.scrollLeft)-(s.clientLeft||0)||0,o=(n.pageYOffset||s.scrollTop)-(s.clientTop||0)||0,i=n.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(i.paddingLeft)+c(i.borderLeftWidth)||0,f=c(i.paddingTop)+c(i.borderTopWidth)||0,d=c(i.paddingRight)+c(i.borderRightWidth)||0,l=c(i.paddingBottom)+c(i.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+r+h,top:g+o+f,width:m-d-p-h,height:T-l-g-f}},createElement:function(t,e){var a,r,o,n=i.createElement(t);for(a in e)if(r=e[a],"style"===a)for(o in r)n.style[o]=r[o];else n[a]=r;return n},getElement:function(t){return i.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,r=t._stateCache||(t._stateCache={}),o=f.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],r)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],r)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||i)&&(a[o+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var c=e.image;if(c){var h=c.src;h!==r.image&&(r.image=h,a.backgroundImage="url("+h+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+n),g!==r.sy&&(r.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==r.maskImage&&(r.maskImage=m,a[o+"MaskImage"]=m,a[o+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===r.maskX&&u===r.maskY||(r.maskX=T,r.maskY=u,a[o+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var r,o,n,i,s=!1;for(r=0,o=e.length;r=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,a){return o.copy(t,e,a),h.copy||(h.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:r,event:{POINTER_START:r.POINTER_START,POINTER_MOVE:r.POINTER_MOVE,POINTER_END:r.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(n.pageXOffset||s.scrollLeft)-(s.clientLeft||0)||0,o=(n.pageYOffset||s.scrollTop)-(s.clientTop||0)||0,i=n.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(i.paddingLeft)+c(i.borderLeftWidth)||0,f=c(i.paddingTop)+c(i.borderTopWidth)||0,d=c(i.paddingRight)+c(i.borderRightWidth)||0,l=c(i.paddingBottom)+c(i.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+r+h,top:g+o+f,width:m-d-p-h,height:T-l-g-f}},createElement:function(t,e){var a,r,o,n=i.createElement(t);for(a in e)if(r=e[a],"style"===a)for(o in r)n.style[o]=r[o];else n[a]=r;return n},getElement:function(t){return i.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,r=t._stateCache||(t._stateCache={}),o=f.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],r)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],r)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||i)&&(a[o+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var c=e.image;if(c){var h=c.src;h!==r.image&&(r.image=h,a.backgroundImage="url("+h+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+n),g!==r.sy&&(r.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==r.maskImage&&(r.maskImage=m,a[o+"MaskImage"]=m,a[o+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===r.maskX&&u===r.maskY||(r.maskX=T,r.maskY=u,a[o+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var r,o,n,i,s=!1;for(r=0,o=e.length;r= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -261,7 +261,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; diff --git a/build/cmd/hilo/tween/Tween.min.js b/build/cmd/hilo/tween/Tween.min.js index 1929a7ed..014780fe 100644 --- a/build/cmd/hilo/tween/Tween.min.js +++ b/build/cmd/hilo/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for cmd + * hilojs 2.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(e,t,r){var a=e("hilo/core/Class"),n=function(){function e(){return+new Date}return a.create({constructor:function(e,t,r,a){var n=this;n.target=e,n._startTime=0,n._seekTime=0,n._pausedTime=0,n._pausedStartTime=0,n._reverseFlag=1,n._repeatCount=0,3==arguments.length&&(a=r,r=t,t=null);for(var i in a)n[i]=a[i];n._fromProps=t,n._toProps=r,!a.duration&&a.time&&(n.duration=a.time||0,n.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,a=r.target,n=e||t,i=r._fromProps={},s=r._toProps={};e=e||a,t=t||a;for(var o in n)s[o]=t[o]||0,a[o]=i[o]=e[o]||0;return r},start:function(){var t=this;return t._startTime=e()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,n.add(t),t},stop:function(){return n.remove(this),this},pause:function(){var t=this;return t.paused=!0,t._pausedStartTime=e(),t},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=e()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,r){var a=this,i=e();return a._startTime=i,a._seekTime=t,a._pausedTime=0,void 0!==r&&(a.paused=r),a._update(i,!0),n.add(a),a},link:function(e){var t,r,a=this,i=e.delay,s=a._startTime;return"string"==typeof i&&(t=0==i.indexOf("+"),r=0==i.indexOf("-"),i=t||r?Number(i.substr(1))*(t?1:-1):Number(i)),e.delay=i,e._startTime=t||r?s+a.duration+i:s+i,a._next=e,n.remove(e),e},_render:function(e){var t,r=this,a=r.target,n=r._fromProps;for(t in n)a[t]=n[t]+(r._toProps[t]-n[t])*e},_update:function(t,r){var a=this;if(!a.paused||r){if(a.isComplete)return!0;var i=t-a._startTime-a._pausedTime+a._seekTime;if(!(i<0)){var s,o=i/a.duration,u=!1;o=o<=0?0:o>=1?1:o;var p=a.ease?a.ease(o):o;a.reverse&&a.isStart&&(a._reverseFlag<0&&(o=1-o,p=1-p),o<1e-7&&(a.repeat>0&&a._repeatCount++>=a.repeat||0==a.repeat&&!a.loop?u=!0:(a._startTime=e(),a._pausedTime=0,a._reverseFlag*=-1))),a.isStart||(a.setProps(a._fromProps,a._toProps),a.isStart=!0,a.onStart&&a.onStart.call(a,a)),a.time=i,a._render(p),(s=a.onUpdate)&&s.call(a,p,a),o>=1&&(a.reverse?(a._startTime=e(),a._pausedTime=0,a._reverseFlag*=-1):a.loop||a.repeat>0&&a._repeatCount++0&&m<=t?(l._render(o),l.time=i,n.add(l)):a.isComplete&&(m<0||m>t)&&l.start()}return a.isComplete?((s=a.onComplete)&&s.call(a,a),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,a=n._tweens,i=a.length;for(r=0;r-1&&a.splice(t,1);else for(t=0;t=1?1:o;var u=a.ease?a.ease(o):o;a.reverse&&a.isStart&&(a._reverseFlag<0&&(o=1-o,u=1-u),o<1e-7&&(a.repeat>0&&a._repeatCount++>=a.repeat||0==a.repeat&&!a.loop?a.isComplete=!0:(a._startTime=e(),a._pausedTime=0,a._reverseFlag*=-1))),a.isStart||(a.setProps(a._fromProps,a._toProps),a.isStart=!0,a.onStart&&a.onStart.call(a,a)),a.time=i,a._render(u),(s=a.onUpdate)&&s.call(a,u,a),o>=1&&(a.reverse?(a._startTime=e(),a._pausedTime=0,a._reverseFlag*=-1):a.loop||a.repeat>0&&a._repeatCount++0&&l<=t?(p._render(o),p.time=i,n.add(p)):a.isComplete&&(l<0||l>t)&&p.start()}return a.isComplete?((s=a.onComplete)&&s.call(a,a),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,a=n._tweens,i=a.length;for(r=0;r-1&&a.splice(t,1);else for(t=0;t=48&&a<=57&&(e+="_"),e+t}return t},viewToString:function(e){for(var t,a=e;a;)t=t?a.id+"."+t:a.id,a=a.parent;return t},copy:function(e,t,a){return util.copy(e,t,a),hasWarnedDict.copy||(hasWarnedDict.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),e},browser:browser,event:{POINTER_START:browser.POINTER_START,POINTER_MOVE:browser.POINTER_MOVE,POINTER_END:browser.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(e){var t;try{t=e.getBoundingClientRect()}catch(a){t={top:e.offsetTop,left:e.offsetLeft,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}}var r=(win.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)||0,o=(win.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0)||0,i=win.getComputedStyle?getComputedStyle(e):e.currentStyle,n=parseInt,s=n(i.paddingLeft)+n(i.borderLeftWidth)||0,c=n(i.paddingTop)+n(i.borderTopWidth)||0,d=n(i.paddingRight)+n(i.borderRightWidth)||0,h=n(i.paddingBottom)+n(i.borderBottomWidth)||0,l=t.top||0,f=t.left||0,g=t.right||0,p=t.bottom||0;return{left:f+r+s,top:l+o+c,width:g-d-f-s,height:p-h-l-c}},createElement:function(e,t){var a,r,o,i=doc.createElement(e);for(a in t)if(r=t[a],"style"===a)for(o in r)i.style[o]=r[o];else i[a]=r;return i},getElement:function(e){return doc.getElementById(e)},setElementStyleByView:function(e){var t=e.drawable,a=t.domElement.style,r=e._stateCache||(e._stateCache={}),o=Hilo.browser.jsVendor,i="px",n=!1;if(this.cacheStateIfChanged(e,["visible"],r)&&(a.display=e.visible?"":"none"),this.cacheStateIfChanged(e,["alpha"],r)&&(a.opacity=e.alpha),e.visible&&!(e.alpha<=0)){if(this.cacheStateIfChanged(e,["width"],r)&&(a.width=e.width+i),this.cacheStateIfChanged(e,["height"],r)&&(a.height=e.height+i),this.cacheStateIfChanged(e,["depth"],r)&&(a.zIndex=e.depth+1),e.transform){var s=e.transform;(n=this.cacheStateIfChanged(e,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(n=this.cacheStateIfChanged(e,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=e.pivotX+i+" "+e.pivotY+i),(this.cacheStateIfChanged(e,["x","y","rotation","scaleX","scaleY"],r)||n)&&(a[o+"Transform"]=this.getTransformCSS(e));this.cacheStateIfChanged(e,["background"],r)&&(a.backgroundColor=e.background),a.pointerEvents||(a.pointerEvents="none");var c=t.image;if(c){var d=c.src;d!==r.image&&(r.image=d,a.backgroundImage="url("+d+")");var h=t.rect;if(h){var l=h[0],f=h[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+i),f!==r.sy&&(r.sy=f,a.backgroundPositionY=-f+i)}}var g=e.mask;if(g){var p=g.drawable.domElement.style.backgroundImage;p!==r.maskImage&&(r.maskImage=p,a[o+"MaskImage"]=p,a[o+"MaskRepeat"]="no-repeat");var m=g.x,u=g.y;m===r.maskX&&u===r.maskY||(r.maskX=m,r.maskY=u,a[o+"MaskPosition"]=m+i+" "+u+i)}}},cacheStateIfChanged:function(e,t,a){var r,o,i,n,s=!1;for(r=0,o=t.length;r=48&&a<=57&&(e+="_"),e+t}return t},viewToString:function(e){for(var t,a=e;a;)t=t?a.id+"."+t:a.id,a=a.parent;return t},copy:function(e,t,a){return util.copy(e,t,a),hasWarnedDict.copy||(hasWarnedDict.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),e},browser:browser,event:{POINTER_START:browser.POINTER_START,POINTER_MOVE:browser.POINTER_MOVE,POINTER_END:browser.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(e){var t;try{t=e.getBoundingClientRect()}catch(a){t={top:e.offsetTop,left:e.offsetLeft,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}}var r=(win.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)||0,o=(win.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0)||0,i=win.getComputedStyle?getComputedStyle(e):e.currentStyle,n=parseInt,s=n(i.paddingLeft)+n(i.borderLeftWidth)||0,c=n(i.paddingTop)+n(i.borderTopWidth)||0,d=n(i.paddingRight)+n(i.borderRightWidth)||0,h=n(i.paddingBottom)+n(i.borderBottomWidth)||0,l=t.top||0,f=t.left||0,g=t.right||0,p=t.bottom||0;return{left:f+r+s,top:l+o+c,width:g-d-f-s,height:p-h-l-c}},createElement:function(e,t){var a,r,o,i=doc.createElement(e);for(a in t)if(r=t[a],"style"===a)for(o in r)i.style[o]=r[o];else i[a]=r;return i},getElement:function(e){return doc.getElementById(e)},setElementStyleByView:function(e){var t=e.drawable,a=t.domElement.style,r=e._stateCache||(e._stateCache={}),o=Hilo.browser.jsVendor,i="px",n=!1;if(this.cacheStateIfChanged(e,["visible"],r)&&(a.display=e.visible?"":"none"),this.cacheStateIfChanged(e,["alpha"],r)&&(a.opacity=e.alpha),e.visible&&!(e.alpha<=0)){if(this.cacheStateIfChanged(e,["width"],r)&&(a.width=e.width+i),this.cacheStateIfChanged(e,["height"],r)&&(a.height=e.height+i),this.cacheStateIfChanged(e,["depth"],r)&&(a.zIndex=e.depth+1),e.transform){var s=e.transform;(n=this.cacheStateIfChanged(e,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(n=this.cacheStateIfChanged(e,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=e.pivotX+i+" "+e.pivotY+i),(this.cacheStateIfChanged(e,["x","y","rotation","scaleX","scaleY"],r)||n)&&(a[o+"Transform"]=this.getTransformCSS(e));this.cacheStateIfChanged(e,["background"],r)&&(a.backgroundColor=e.background),a.pointerEvents||(a.pointerEvents="none");var c=t.image;if(c){var d=c.src;d!==r.image&&(r.image=d,a.backgroundImage="url("+d+")");var h=t.rect;if(h){var l=h[0],f=h[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+i),f!==r.sy&&(r.sy=f,a.backgroundPositionY=-f+i)}}var g=e.mask;if(g){var p=g.drawable.domElement.style.backgroundImage;p!==r.maskImage&&(r.maskImage=p,a[o+"MaskImage"]=p,a[o+"MaskRepeat"]="no-repeat");var m=g.x,u=g.y;m===r.maskX&&u===r.maskY||(r.maskX=m,r.maskY=u,a[o+"MaskPosition"]=m+i+" "+u+i)}}},cacheStateIfChanged:function(e,t,a){var r,o,i,n,s=!1;for(r=0,o=t.length;r= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -259,7 +259,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; diff --git a/build/commonjs/tween/Tween.min.js b/build/commonjs/tween/Tween.min.js index a128e27b..04a6ec13 100644 --- a/build/commonjs/tween/Tween.min.js +++ b/build/commonjs/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for commonjs + * hilojs 2.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -var Class=require("../core/Class"),Tween=function(){function e(){return+new Date}return Class.create({constructor:function(e,t,r,n){var a=this;a.target=e,a._startTime=0,a._seekTime=0,a._pausedTime=0,a._pausedStartTime=0,a._reverseFlag=1,a._repeatCount=0,3==arguments.length&&(n=r,r=t,t=null);for(var s in n)a[s]=n[s];a._fromProps=t,a._toProps=r,!n.duration&&n.time&&(a.duration=n.time||0,a.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,n=r.target,a=e||t,s=r._fromProps={},i=r._toProps={};e=e||n,t=t||n;for(var o in a)i[o]=t[o]||0,n[o]=s[o]=e[o]||0;return r},start:function(){var t=this;return t._startTime=e()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,Tween.add(t),t},stop:function(){return Tween.remove(this),this},pause:function(){var t=this;return t.paused=!0,t._pausedStartTime=e(),t},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=e()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,r){var n=this,a=e();return n._startTime=a,n._seekTime=t,n._pausedTime=0,void 0!==r&&(n.paused=r),n._update(a,!0),Tween.add(n),n},link:function(e){var t,r,n=this,a=e.delay,s=n._startTime;return"string"==typeof a&&(t=0==a.indexOf("+"),r=0==a.indexOf("-"),a=t||r?Number(a.substr(1))*(t?1:-1):Number(a)),e.delay=a,e._startTime=t||r?s+n.duration+a:s+a,n._next=e,Tween.remove(e),e},_render:function(e){var t,r=this,n=r.target,a=r._fromProps;for(t in a)n[t]=a[t]+(r._toProps[t]-a[t])*e},_update:function(t,r){var n=this;if(!n.paused||r){if(n.isComplete)return!0;var a=t-n._startTime-n._pausedTime+n._seekTime;if(!(a<0)){var s,i=a/n.duration,o=!1;i=i<=0?0:i>=1?1:i;var u=n.ease?n.ease(i):i;n.reverse&&n.isStart&&(n._reverseFlag<0&&(i=1-i,u=1-u),i<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?o=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(u),(s=n.onUpdate)&&s.call(n,u,n),i>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&l<=t?(p._render(i),p.time=a,Tween.add(p)):n.isComplete&&(l<0||l>t)&&p.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,n=Tween._tweens,a=n.length;for(r=0;r-1&&n.splice(t,1);else for(t=0;t=1?1:i;var o=n.ease?n.ease(i):i;n.reverse&&n.isStart&&(n._reverseFlag<0&&(i=1-i,o=1-o),i<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(o),(s=n.onUpdate)&&s.call(n,o,n),i>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&p<=t?(u._render(i),u.time=a,Tween.add(u)):n.isComplete&&(p<0||p>t)&&u.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,r,n=Tween._tweens,a=n.length;for(r=0;r-1&&n.splice(t,1);else for(t=0;t= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -6082,7 +6082,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; @@ -6280,7 +6280,7 @@ return Tween; requires: ['hilo/core/Class'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6552,7 +6552,7 @@ return Ease; }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6602,7 +6602,7 @@ return ImageLoader; requires: ['hilo/core/Class'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6671,7 +6671,7 @@ return ScriptLoader; requires: ['hilo/core/Class'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6940,7 +6940,7 @@ return LoadQueue; requires: ['hilo/core/Class', 'hilo/event/EventMixin', 'hilo/loader/ImageLoader', 'hilo/loader/ScriptLoader'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7145,7 +7145,7 @@ return HTMLAudio; requires: ['hilo/core/Class', 'hilo/util/util', 'hilo/event/EventMixin'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7471,7 +7471,7 @@ return WebAudio; requires: ['hilo/core/Class', 'hilo/util/util', 'hilo/event/EventMixin'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7576,7 +7576,7 @@ return WebSound; requires: ['hilo/media/HTMLAudio', 'hilo/media/WebAudio', 'hilo/util/util'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7671,7 +7671,7 @@ return Camera; requires: ['hilo/core/Class', 'hilo/util/util'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7860,7 +7860,7 @@ return Camera3d; requires: ['hilo/core/Class', 'hilo/util/util'] }); /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo-kissy.min.js b/build/kissy/hilo-kissy.min.js index 3ac33e92..1f820dfb 100644 --- a/build/kissy/hilo-kissy.min.js +++ b/build/kissy/hilo-kissy.min.js @@ -1,8 +1,8 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ -KISSY.add("hilo/util/browser",function(t){var e=function(){var t=navigator.userAgent,e=document,i=window,r=e.documentElement,n={iphone:/iphone/i.test(t),ipad:/ipad/i.test(t),ipod:/ipod/i.test(t),ios:/iphone|ipad|ipod/i.test(t),android:/android/i.test(t),webkit:/webkit/i.test(t),chrome:/chrome/i.test(t),safari:/safari/i.test(t),firefox:/firefox/i.test(t),ie:/msie/i.test(t),opera:/opera/i.test(t),supportTouch:"ontouchstart"in i,supportCanvas:null!=e.createElement("canvas").getContext,supportStorage:!1,supportOrientation:"orientation"in i||"orientation"in i.screen,supportDeviceMotion:"ondevicemotion"in i};try{var a="hilo";localStorage.setItem(a,a),localStorage.removeItem(a),n.supportStorage=!0}catch(o){}var s=n.jsVendor=n.webkit?"webkit":n.firefox?"webkit":n.opera?"o":n.ie?"ms":"",h=n.cssVendor="-"+s+"-",l=e.createElement("div"),c=l.style,u=void 0!=c[s+"Transform"],d=void 0!=c[s+"Perspective"];d&&(l.id="test3d",c=e.createElement("style"),c.textContent="@media ("+h+"transform-3d){#test3d{height:3px}}",e.head.appendChild(c),r.appendChild(l),d=3==l.offsetHeight,e.head.removeChild(c),r.removeChild(l)),n.supportTransform=u,n.supportTransform3D=d;var f=n.supportTouch,p=f?"touchstart":"mousedown",v=f?"touchmove":"mousemove",m=f?"touchend":"mouseup";return n.POINTER_START=p,n.POINTER_MOVE=v,n.POINTER_END=m,n}();return e}),KISSY.add("hilo/util/util",function(t){var e={copy:function(t,e,i){for(var r in e)i&&!t.hasOwnProperty(r)&&void 0===t[r]||(t[r]=e[r]);return t}};return e}),KISSY.add("hilo/core/Hilo",function(t,e,i){var r=window,n=document,a=n.documentElement,o=0,s={},h={version:"2.0.0",getUid:function(t){var e=++o;if(t){var i=t.charCodeAt(t.length-1);return i>=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,r){return i.copy(t,e,r),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var n=(r.pageXOffset||a.scrollLeft)-(a.clientLeft||0)||0,o=(r.pageYOffset||a.scrollTop)-(a.clientTop||0)||0,s=r.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(s.paddingLeft)+h(s.borderLeftWidth)||0,c=h(s.paddingTop)+h(s.borderTopWidth)||0,u=h(s.paddingRight)+h(s.borderRightWidth)||0,d=h(s.paddingBottom)+h(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+n+l,top:f+o+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,r,a,o=n.createElement(t);for(i in e)if(r=e[i],"style"===i)for(a in r)o.style[a]=r[a];else o[i]=r;return o},getElement:function(t){return n.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=h.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var l=e.image;if(l){var c=l.src;c!==r.image&&(r.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,g=p.y;m===r.maskX&&g===r.maskY||(r.maskX=m,r.maskY=g,i[n+"MaskPosition"]=m+a+" "+g+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return i},{requires:["hilo/core/Class"]}),KISSY.add("hilo/event/EventMixin",function(t,e){var i={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[n],!0}return!1}},r=e.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),n=window.Event;if(n){var a=n.prototype,o=a.stopImmediatePropagation;a.stopImmediatePropagation=function(){o&&o.call(this),this._stopped=!0}}return i},{requires:["hilo/core/Class"]}),KISSY.add("hilo/view/Drawable",function(t,e,i){var r=e.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,n=e.image;r.isDrawable(t)?e.image=t:i.copy(e,t,!0);var a=e.image;if("string"==typeof a){if(!n||a!==n.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=a)}a=e.image=n}a&&!e.rect&&(e.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return r},{requires:["hilo/core/Class","hilo/util/util"]}),KISSY.add("hilo/renderer/Renderer",function(t,e,i){var r=e.create({constructor:function(t){t=t||{},i.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return r},{requires:["hilo/core/Class","hilo/util/util"]}),KISSY.add("hilo/renderer/CanvasRenderer",function(t,e,i,r){var n=e.create({Extends:r,constructor:function(t){n.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var r=this.context,n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),r.clip());var g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.y}v?r.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||r.translate(c,u),0!=p&&r.rotate(p*Math.PI/180),1==n&&1==a||r.scale(n,a),0==d&&0==f||r.translate(-d,-f))}t.alpha>0&&(r.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return n},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"]}),KISSY.add("hilo/renderer/DOMRenderer",function(t,e,i,r,n){var a=function(){function t(t,e){var r=t.tagName||"div",n=e.image,a=t.width||n&&n.width,o=t.height||n&&n.height,s=i.createElement(r),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==r){if(s.width=a,s.height=o,n){var l=s.getContext("2d"),c=e.rect||[0,0,a,o];l.drawImage(n,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),n&&n.src){h.backgroundImage="url("+n.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return e.create({Extends:r,constructor:function(t){a.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new n;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(i.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,r=t._scaleX,n=t._scaleY,a=t.scaleX,o=t.scaleY;(!r&&1!=a||r&&r!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!n&&1!=o||n&&n!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return a},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/view/Drawable"]}),KISSY.add("hilo/renderer/WebGLRenderer",function(t,e,i,r,n){var a=Math.PI/180,o=e.create({Extends:r,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){o.superclass.constructor.call(this,t);var e=this,i=o.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var r=this.maxBatchNum*o.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var a=0,s=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new s(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,n=0,o=t.rotation%360,s=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*a;r=Math.cos(d),n=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=n*l,i.c=-n*c,i.d=r*c,i.tx=f.x-i.a*s-i.c*h,i.ty=f.y-i.b*s-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),s=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return s.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},o},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"]}),KISSY.add("hilo/view/View",function(t,e,i,r,n,a){var o=function(){function t(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return i.create({Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("View"),a.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(e,i,r){var n=this.getBounds(),a=e>=n.x&&e<=n.x+n.width&&i>=n.y&&i<=n.y+n.height;return a&&r&&(a=t(e,i,n)),a},hitTestObject:function(t,e){var i=this.getBounds(),r=t.getBounds(),n=i.x<=r.x+r.width&&r.x<=i.x+i.width&&i.y<=r.y+r.height&&r.y<=i.y+i.height;return n&&e&&(n=o(i,r)),!!n},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=a.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return e.viewToString(this)}})}();return o},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/event/EventMixin","hilo/geom/Matrix","hilo/util/util"]}),KISSY.add("hilo/view/CacheMixin",function(t,e,i){var r,n,a={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){i.supportCanvas&&(r||(r=document.createElement("canvas"),n=r.getContext("2d")),r.width=this.width,r.height=this.height,this._draw(n),this.drawable=this.drawable||new e,this.drawable.init({image:r.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return a},{requires:["hilo/view/Drawable","hilo/util/browser"]}),KISSY.add("hilo/view/Container",function(t,e,i,r){var n=i.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Container"),n.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){n.superclass.render.call(this,t,e);var i,r,a,o=this.children.slice(0);for(i=0,r=o.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var n=this._frames[i].callback;n&&n.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),a.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"]}),KISSY.add("hilo/view/DOMElement",function(t,e,i,r,n){var a=i.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("DOMElement"),a.superclass.constructor.call(this,t),this.drawable=new n;var i=this.drawable.domElement=t.element||e.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,i){if("dom"!==t.renderType){var r=t.canvas,n=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=e.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),r.parentNode.insertBefore(t._domElementContainer,r.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else t.draw(this)}});return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"]}),KISSY.add("hilo/view/Graphics",function(t,e,i,r,n){var a=function(){var t=document.createElement("canvas"),o=t.getContext&&t.getContext("2d");return i.create({Extends:r,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Graphics"),a.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,r,n,a){for(var s=this,h=o.createLinearGradient(t,e,i,r),l=0,c=n.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/CacheMixin"]}),KISSY.add("hilo/view/Text",function(t,e,i,r,n){var a=e.create({Extends:r,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),a.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=a.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=a.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l>1;break;case"bottom":_=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var e,r=document.documentElement,n=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return r.appendChild(n),e=n.offsetHeight,r.removeChild(n),e}}});return a},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"]}),KISSY.add("hilo/view/BitmapText",function(t,e,i,r,n){var a=e.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("BitmapText"),a.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return a._pool.length?(e=a._pool.pop(),e.setImage(t.image,t.rect)):e=new n({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){a._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var l=n.ease?n.ease(s):s;n.reverse&&n.isStart&&(n._reverseFlag<0&&(s=1-s,l=1-l),s<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?h=!0:(n._startTime=t(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(l),(o=n.onUpdate)&&o.call(n,l,n),s>=1&&(n.reverse?(n._startTime=t(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=e?(c._render(s),c.time=a,i.add(c)):n.isComplete&&(u<0||u>e)&&c.start()}return n.isComplete?((o=n.onComplete)&&o.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,r,n=i._tweens,a=n.length;for(r=0;r-1&&n.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndex=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,r){return i.copy(t,e,r),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var n=(r.pageXOffset||a.scrollLeft)-(a.clientLeft||0)||0,o=(r.pageYOffset||a.scrollTop)-(a.clientTop||0)||0,s=r.getComputedStyle?getComputedStyle(t):t.currentStyle,h=parseInt,l=h(s.paddingLeft)+h(s.borderLeftWidth)||0,c=h(s.paddingTop)+h(s.borderTopWidth)||0,u=h(s.paddingRight)+h(s.borderRightWidth)||0,d=h(s.paddingBottom)+h(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+n+l,top:f+o+c,width:v-u-p-l,height:m-d-f-c}},createElement:function(t,e){var i,r,a,o=n.createElement(t);for(i in e)if(r=e[i],"style"===i)for(a in r)o.style[a]=r[a];else o[i]=r;return o},getElement:function(t){return n.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,r=t._stateCache||(t._stateCache={}),n=h.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],r)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],r)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]="0 0"),i[n+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(i[n+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||o)&&(i[n+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var l=e.image;if(l){var c=l.src;c!==r.image&&(r.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==r.sx&&(r.sx=d,i.backgroundPositionX=-d+a),f!==r.sy&&(r.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==r.maskImage&&(r.maskImage=v,i[n+"MaskImage"]=v,i[n+"MaskRepeat"]="no-repeat");var m=p.x,g=p.y;m===r.maskX&&g===r.maskY||(r.maskX=m,r.maskY=g,i[n+"MaskPosition"]=m+a+" "+g+a)}}},cacheStateIfChanged:function(t,e,i){var r,n,a,o,s=!1;for(r=0,n=e.length;r=6?(e=s[0],i=s[1],r=s[2],n=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,r=t.c,n=t.d,a=t.tx,o=t.ty),this.a=h*e+l*r,this.b=h*i+l*n,this.c=c*e+u*r,this.d=c*i+u*n,this.tx=d*e+f*r+a,this.ty=d*i+f*n+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b,a=this.c,o=this.d,s=this.tx,h=this.ty;return this.a=r*i-n*e,this.b=r*e+n*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-h*e,this.ty=s*e+h*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this},transformPoint:function(t,e,i){var r=t.x*this.a+t.y*this.c+this.tx,n=t.x*this.b+t.y*this.d+this.ty;return e&&(r=r+.5>>0,n=n+.5>>0),i?{x:r,y:n}:(t.x=r,t.y=n,t)}});return i},{requires:["hilo/core/Class"]}),KISSY.add("hilo/event/EventMixin",function(t,e){var i={_listeners:null,on:function(t,e,i){for(var r=this._listeners=this._listeners||{},n=r[t]=r[t]||[],a=0,o=n.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[n],!0}return!1}},r=e.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),n=window.Event;if(n){var a=n.prototype,o=a.stopImmediatePropagation;a.stopImmediatePropagation=function(){o&&o.call(this),this._stopped=!0}}return i},{requires:["hilo/core/Class"]}),KISSY.add("hilo/view/Drawable",function(t,e,i){var r=e.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,n=e.image;r.isDrawable(t)?e.image=t:i.copy(e,t,!0);var a=e.image;if("string"==typeof a){if(!n||a!==n.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=a)}a=e.image=n}a&&!e.rect&&(e.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});return r},{requires:["hilo/core/Class","hilo/util/util"]}),KISSY.add("hilo/renderer/Renderer",function(t,e,i){var r=e.create({constructor:function(t){t=t||{},i.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,r){},resize:function(t,e){}});return r},{requires:["hilo/core/Class","hilo/util/util"]}),KISSY.add("hilo/renderer/CanvasRenderer",function(t,e,i,r){var n=e.create({Extends:r,constructor:function(t){n.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,r=t.height,n=t.background;n&&(e.fillStyle=n,e.fillRect(0,0,i,r));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,h=s[2],l=s[3],c=s[4],u=s[5];if(!h||!l)return;i||r||(i=t.width=h,r=t.height=l),(c||u)&&e.translate(c-.5*h,u-.5*l),e.drawImage(o,s[0],s[1],h,l,0,0,i,r)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var r=this.context,n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),r.clip());var g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.y}v?r.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||r.translate(c,u),0!=p&&r.rotate(p*Math.PI/180),1==n&&1==a||r.scale(n,a),0==d&&0==f||r.translate(-d,-f))}t.alpha>0&&(r.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.context.clearRect(t,e,i,r)},resize:function(t,e){var i=this.canvas,r=this.stage,n=i.style;i.width=t,i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px"}});return n},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"]}),KISSY.add("hilo/renderer/DOMRenderer",function(t,e,i,r,n){var a=function(){function t(t,e){var r=t.tagName||"div",n=e.image,a=t.width||n&&n.width,o=t.height||n&&n.height,s=i.createElement(r),h=s.style;if(t.id&&(s.id=t.id),h.position="absolute",h.left=(t.left||0)+"px",h.top=(t.top||0)+"px",h.width=a+"px",h.height=o+"px","canvas"==r){if(s.width=a,s.height=o,n){var l=s.getContext("2d"),c=e.rect||[0,0,a,o];l.drawImage(n,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(h.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(h.overflow="hidden"),n&&n.src){h.backgroundImage="url("+n.src+")";var u=t.rectX||0,d=t.rectY||0;h.backgroundPosition=-u+"px "+-d+"px"}return s}return e.create({Extends:r,constructor:function(t){a.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new n;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,r=i.parentNode;if(e){var n=e.drawable.domElement;if(n!=r&&n.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||r||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(i.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,r=t._scaleX,n=t._scaleY,a=t.scaleX,o=t.scaleY;(!r&&1!=a||r&&r!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!n&&1!=o||n&&n!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();return a},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/view/Drawable"]}),KISSY.add("hilo/renderer/WebGLRenderer",function(t,e,i,r,n){var a=Math.PI/180,o=e.create({Extends:r,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){o.superclass.constructor.call(this,t);var e=this,i=o.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var r=this.maxBatchNum*o.ATTRIBUTE_NUM*4,n=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*r),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(n);for(var a=0,s=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,r=(t.background,t.drawable),n=r&&r.image;if(n){var a=r.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(n,a[0],a[1],o,s,0,0,e,i),l=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[l+0]=h[0],c[l+1]=h[1],c[l+2]=h[2],c[l+3]=h[3],u[l+4]=d,c[l+5]=h[4],c[l+6]=h[5],c[l+7]=h[6],c[l+8]=h[7],u[l+9]=d,c[l+10]=h[8],c[l+11]=h[9],c[l+12]=h[10],c[l+13]=h[11],u[l+14]=d,c[l+15]=h[12],c[l+16]=h[13],c[l+17]=h[14],c[l+18]=h[15],u[l+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[l+5*p],m=c[l+5*p+1];c[l+5*p]=f.a*v+f.c*m+f.tx,c[l+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=n,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,h=t._scaleY,l=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",l=!0),(!h&&1!=a||h&&h!=a)&&(t._scaleY=a,o.height=a*t.height+"px",l=!0),l&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var r=i.parentNode;r&&r.removeChild(i)}},clear:function(t,e,i,r){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,r=this.stage,n=i.style;this.width=i.width=t,this.height=i.height=e,n.width=r.width*r.scaleX+"px",n.height=r.height*r.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,r=null,n=0;n0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*r,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new s(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,r,n,a,o,s,h){var l=this.__tempVertexs||[],c=t.width,u=t.height;r/=c,n/=u,e/=c,i/=u,s=s,h=h,a=a,o=o,r+e>1&&(r=1-e),n+i>1&&(n=1-i);var d=0;return l[d++]=a,l[d++]=o,l[d++]=e,l[d++]=i,l[d++]=a+s,l[d++]=o,l[d++]=e+r,l[d++]=i,l[d++]=a,l[d++]=o+h,l[d++]=e,l[d++]=i+n,l[d++]=a+s,l[d++]=o+h,l[d++]=e+r,l[d++]=i+n,l},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,r=1,n=0,o=t.rotation%360,s=t.pivotX,h=t.pivotY,l=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*a;r=Math.cos(d),n=Math.sin(d)}var f=t.getAlignPosition();i.a=r*l,i.b=n*l,i.c=-n*c,i.d=r*c,i.tx=f.x-i.a*s-i.c*h,i.ty=f.y-i.b*s-i.d*h}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),s=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};return s.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,r=t.program;r&&i&&(e.activeShader=t,i.useProgram(r),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(r,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(r,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,r=e.createTexture(),n=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(n,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=r,r},_createProgram:function(t,e,i){var r=this._createShader(t,t.VERTEX_SHADER,e),n=this._createShader(t,t.FRAGMENT_SHADER,i);if(!r||!n)return null;var a=t.createProgram();if(a){t.attachShader(a,r),t.attachShader(a,n),t.linkProgram(a),t.deleteShader(n),t.deleteShader(r);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var r=t.createShader(e);if(r){t.shaderSource(r,i),t.compileShader(r);var n=t.getShaderParameter(r,t.COMPILE_STATUS);if(!n){var a=t.getShaderInfoLog(r);return console.log("Failed to compile shader: "+a),t.deleteShader(r),null}}return r}},o},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"]}),KISSY.add("hilo/view/View",function(t,e,i,r,n,a){var o=function(){function t(t,e,i){for(var r,n,a,o,s=0,h=!1,l=0,c=i.length;ld.x?(r=d.x,n=u.x):(r=u.x,n=d.x),t>=r&&t<=n))h=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(h=!0),u.x>t&&u.y==e){var p=i[(c+l-1)%c];(p.ye||p.y>e&&d.ys?s=c:cl?l=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return i.create({Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("View"),a.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,r,n,a,o,s=this.width,h=this.height,l=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:h},{x:0,y:h}],u=[],d=0,f=c.length;de?r=e:ni?a=i:o>1,r=0;break;case"TR":i=o-n,r=0;break;case"L":i=0,r=s-a>>1;break;case"C":i=o-n>>1,r=s-a>>1;break;case"R":i=o-n,r=s-a>>1;break;case"BL":i=0,r=s-a;break;case"B":i=o-n>>1,r=s-a;break;case"BR":i=o-n,r=s-a}}return{x:i,y:r}},hitTestPoint:function(e,i,r){var n=this.getBounds(),a=e>=n.x&&e<=n.x+n.width&&i>=n.y&&i<=n.y+n.height;return a&&r&&(a=t(e,i,n)),a},hitTestObject:function(t,e){var i=this.getBounds(),r=t.getBounds(),n=i.x<=r.x+r.width&&r.x<=i.x+i.width&&i.y<=r.y+r.height&&r.y<=i.y+i.height;return n&&e&&(n=o(i,r)),!!n},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=a.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return e.viewToString(this)}})}();return o},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/event/EventMixin","hilo/geom/Matrix","hilo/util/util"]}),KISSY.add("hilo/view/CacheMixin",function(t,e,i){var r,n,a={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){i.supportCanvas&&(r||(r=document.createElement("canvas"),n=r.getContext("2d")),r.width=this.width,r.height=this.height,this._draw(n),this.drawable=this.drawable||new e,this.drawable.init({image:r.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};return a},{requires:["hilo/view/Drawable","hilo/util/browser"]}),KISSY.add("hilo/view/Container",function(t,e,i,r){var n=i.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Container"),n.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,r=i.length,n=t.parent;e=e<0?0:e>r?r:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==r?r-1:e):n&&n.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var r=i;r=r.parent;){if(r.renderer){i.__renderer=r.renderer;break}if(r.__renderer){i.__renderer=r.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,r=0,n=i.length;r=0&&r!=e){var n=i.length;e=e<0?0:e>=n?n-1:e,i.splice(r,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,r=this.getChildIndex(t),n=this.getChildIndex(e);t.depth=n,i[n]=t,e.depth=r,i[r]=e},swapChildrenAt:function(t,e){var i=this.children,r=this.getChildAt(t),n=this.getChildAt(e);r.depth=e,i[e]=r,n.depth=t,i[t]=n},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var r=e;e=function(t,e){return e[r]-t[r]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,r=this.children;t=t||0,e=e||r.length;for(var n=t;n=0;l--)if(a=h[l],!(!a||!a.visible||a.alpha<=0||n&&!a.pointerEnabled))if(a.children&&a.children.length&&(!n||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,r,n)),o){if(!r)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!r)return a;s.push(a)}return r&&s.length?s:null},render:function(t,e){n.superclass.render.call(this,t,e);var i,r,a,o=this.children.slice(0);for(i=0,r=o.length;ir?r:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,r=-1;if("number"==typeof t)r=t;else{var n="string"==typeof t?this._frameNames[t]:t;if(n)for(var a=0;a=i?i-1:r,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,r=this.currentFrame;if(this._firstRender?(i=r,this._firstRender=!1):i=this._nextFrame(e),i!=r){this.currentFrame=i;var n=this._frames[i].callback;n&&n.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),a.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,r=this.currentFrame,n=e[r],a=n.duration||this.interval,o=this._frameElapsed,s=0!=r||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=n.next?r=this.getFrameIndex(n.next):r>=i-1?r=0:this.drawable&&r++),r},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"]}),KISSY.add("hilo/view/DOMElement",function(t,e,i,r,n){var a=i.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("DOMElement"),a.superclass.constructor.call(this,t),this.drawable=new n;var i=this.drawable.domElement=t.element||e.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,i){if("dom"!==t.renderType){var r=t.canvas,n=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=e.createElement("div",{style:{position:"absolute",transform:"scale3d("+n.scaleX+","+n.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),r.parentNode.insertBefore(t._domElementContainer,r.nextSibling));var o,s=this.drawable.domElement,h=this.depth,l=a.childNodes[0];if(s.parentNode)return;for(;l&&3!=l.nodeType&&(o=parseInt(l.style.zIndex)||0,!(o<=0||o>h));)l=l.nextSibling;a.insertBefore(this.drawable.domElement,l)}else t.draw(this)}});return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Drawable"]}),KISSY.add("hilo/view/Graphics",function(t,e,i,r,n){var a=function(){var t=document.createElement("canvas"),o=t.getContext&&t.getContext("2d");return i.create({Extends:r,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Graphics"),a.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,r,n,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=r&&s.call(o,["lineCap",o.lineCap=r]),void 0!=n&&s.call(o,["lineJoin",o.lineJoin=n]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,r=i._addAction;return r.call(i,["fillStyle",i.fillStyle=t]),r.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,r,n,a){for(var s=this,h=o.createLinearGradient(t,e,i,r),l=0,c=n.length;l1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return a},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/CacheMixin"]}),KISSY.add("hilo/view/Text",function(t,e,i,r,n){var a=e.create({Extends:r,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),a.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=a.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=a.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var r=i.drawable,n=r.domElement,a=n.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",n.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var r,n,a,o,s,h=i.split(/\r\n|\r|\n|/),l=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(r=0,o=h.length;re.maxWidth?(d.push({text:m,y:c}),l>1;break;case"bottom":_=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,r=0;r>1;break;case"right":case"end":n=a}r.outline?t.strokeText(e,n,i):t.fillText(e,n,i)},Statics:{measureFontHeight:function(t){var e,r=document.documentElement,n=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return r.appendChild(n),e=n.offsetHeight,r.removeChild(n),e}}});return a},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"]}),KISSY.add("hilo/view/BitmapText",function(t,e,i,r,n){var a=e.create({Extends:r,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("BitmapText"),a.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),r=i.length;if(e.text!=i){e.text=i;var n,a,o,s,h=0,l=0,c=0;for(n=0;n0?e.letterSpacing:0),e.children[n]?(s=e.children[n],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,h=c+o.rect[2],l=Math.max(l,o.rect[3]));for(n=e.children.length-1;n>=r;n--)e._releaseBitmap(e.children[n]),e.children[n].removeFromParent();return e.width=h,e.height=l,this.setTextAlign(),e}},_createBitmap:function(t){var e;return a._pool.length?(e=a._pool.pop(),e.setImage(t.image,t.rect)):e=new n({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){a._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,r=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=i.slice(0),n=0,a=r.length;n=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(r){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var e=(new Date).getTime(),a=e-r;a>=0&&(i.removeTick(n),t())}};return i.addTick(n),n},interval:function(t,e){var i=this,r=(new Date).getTime()+e,n={tick:function(){var i=(new Date).getTime(),n=i-r;n>=0&&(n=r)return-1;for(e<0&&(e=r+e),i=e;i=1?1:s;var h=n.ease?n.ease(s):s;n.reverse&&n.isStart&&(n._reverseFlag<0&&(s=1-s,h=1-h),s<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=t(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=a,n._render(h),(o=n.onUpdate)&&o.call(n,h,n),s>=1&&(n.reverse?(n._startTime=t(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&c<=e?(l._render(s),l.time=a,i.add(l)):n.isComplete&&(c<0||c>e)&&l.start()}return n.isComplete?((o=n.onComplete)&&o.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,r,n=i._tweens,a=n.length;for(r=0;r-1&&n.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndexe.z})},tick:function(){this.sortZ()}});return o}();return r},{requires:["hilo/core/Class","hilo/util/util"]}),KISSY.add("hilo/game/ParticleSystem",function(t,e,i,r,n,a,o){var s=function(){function t(t,e){return e?t+2*(Math.random()-.5)*e:t}for(var s=["x","y","vx","vy","ax","ay","rotation","rotationV","scale","scaleV","alpha","alphaV","life"],h=[],l=0,c=s.length;l=this._emitTime&&(this._currentRunTime=0,this._emitTime=t(this.emitTime,this.emitTimeVar),this._emit()),this._totalRunTime>=this.totalTime&&this.stop())},_emit:function(){for(var e=t(this.emitNum,this.emitNumVar)>>0,i=0;i=0;e--)this.children[e].destroy()}}),v=i.create({Extends:r,constructor:function(t){this.id=this.id||t.id||e.getUid("Particle"),v.superclass.constructor.call(this,t),this.init(t)},onUpdate:function(t){if(t*=.001,this._died)return!1;var e=this.ax+this.system.gx,i=this.ay+this.system.gy;return this.vx+=e*t,this.vy+=i*t,this.x+=this.vx*t,this.y+=this.vy*t,this.rotation+=this.rotationV,this._time>.1&&(this.alpha+=this.alphaV),this.scale+=this.scaleV,this.scaleX=this.scaleY=this.scale,this._time+=t,this._time>=this.life||this.alpha<=0?(this.destroy(),!1):void 0},setImage:function(t,e){this.drawable=this.drawable||new a,e=e||[0,0,t.width,t.height],this.width=e[2],this.height=e[3],this.drawable.rect=e,this.drawable.image=t},destroy:function(){this._died=!0,this.alpha=0,this.removeFromParent(),f.push(this)},init:function(e){this.system=e.system,this._died=!1,this._time=0,this.alpha=1;for(var i=0,r=h.length;i>0]),this.setImage(e.image,o),void 0!==e.pivotX&&(this.pivotX=e.pivotX*o[2]),void 0!==e.pivotY&&(this.pivotY=e.pivotY*o[3])}},Statics:{create:function(t){if(f.length>0){var e=f.pop();return e.init(t),e}return new v(t)}}});return p}();return s},{requires:["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/Container","hilo/view/Drawable","hilo/util/util"]}); \ No newline at end of file diff --git a/build/kissy/hilo-kissy.zip b/build/kissy/hilo-kissy.zip index bcc20ca9..454b0988 100644 Binary files a/build/kissy/hilo-kissy.zip and b/build/kissy/hilo-kissy.zip differ diff --git a/build/kissy/hilo/core/Class.js b/build/kissy/hilo/core/Class.js index 543f6b39..3a1963cc 100644 --- a/build/kissy/hilo/core/Class.js +++ b/build/kissy/hilo/core/Class.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/core/Class.min.js b/build/kissy/hilo/core/Class.min.js index 82143632..9eac35f4 100644 --- a/build/kissy/hilo/core/Class.min.js +++ b/build/kissy/hilo/core/Class.min.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/core/Hilo.js b/build/kissy/hilo/core/Hilo.js index c00ffeb7..878cb724 100644 --- a/build/kissy/hilo/core/Hilo.js +++ b/build/kissy/hilo/core/Hilo.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -27,7 +27,7 @@ var Hilo = { * Hilo version * @type String */ - version: '2.0.0', + version: '2.0.1', /** * @language=en * Gets a globally unique id. Such as Stage1, Bitmap2 etc. diff --git a/build/kissy/hilo/core/Hilo.min.js b/build/kissy/hilo/core/Hilo.min.js index 6453b256..5f2074c5 100644 --- a/build/kissy/hilo/core/Hilo.min.js +++ b/build/kissy/hilo/core/Hilo.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ -KISSY.add("hilo/core/Hilo",function(t,e,a){var r=window,o=document,i=o.documentElement,n=0,s={},c={version:"2.0.0",getUid:function(t){var e=++n;if(t){var a=t.charCodeAt(t.length-1);return a>=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,r){return a.copy(t,e,r),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var o=(r.pageXOffset||i.scrollLeft)-(i.clientLeft||0)||0,n=(r.pageYOffset||i.scrollTop)-(i.clientTop||0)||0,s=r.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(s.paddingLeft)+c(s.borderLeftWidth)||0,d=c(s.paddingTop)+c(s.borderTopWidth)||0,f=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+o+h,top:g+n+d,width:m-f-p-h,height:T-l-g-d}},createElement:function(t,e){var a,r,i,n=o.createElement(t);for(a in e)if(r=e[a],"style"===a)for(i in r)n.style[i]=r[i];else n[a]=r;return n},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,r=t._stateCache||(t._stateCache={}),o=c.browser.jsVendor,i="px",n=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(a.width=t.width+i),this.cacheStateIfChanged(t,["height"],r)&&(a.height=t.height+i),this.cacheStateIfChanged(t,["depth"],r)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(n=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(n=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=t.pivotX+i+" "+t.pivotY+i),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||n)&&(a[o+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var h=e.image;if(h){var d=h.src;d!==r.image&&(r.image=d,a.backgroundImage="url("+d+")");var f=e.rect;if(f){var l=f[0],g=f[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+i),g!==r.sy&&(r.sy=g,a.backgroundPositionY=-g+i)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==r.maskImage&&(r.maskImage=m,a[o+"MaskImage"]=m,a[o+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===r.maskX&&u===r.maskY||(r.maskX=T,r.maskY=u,a[o+"MaskPosition"]=T+i+" "+u+i)}}},cacheStateIfChanged:function(t,e,a){var r,o,i,n,s=!1;for(r=0,o=e.length;r=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,r){return a.copy(t,e,r),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var o=(r.pageXOffset||i.scrollLeft)-(i.clientLeft||0)||0,n=(r.pageYOffset||i.scrollTop)-(i.clientTop||0)||0,s=r.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,h=c(s.paddingLeft)+c(s.borderLeftWidth)||0,d=c(s.paddingTop)+c(s.borderTopWidth)||0,f=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+o+h,top:g+n+d,width:m-f-p-h,height:T-l-g-d}},createElement:function(t,e){var a,r,i,n=o.createElement(t);for(a in e)if(r=e[a],"style"===a)for(i in r)n.style[i]=r[i];else n[a]=r;return n},getElement:function(t){return o.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,r=t._stateCache||(t._stateCache={}),o=c.browser.jsVendor,i="px",n=!1;if(this.cacheStateIfChanged(t,["visible"],r)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],r)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],r)&&(a.width=t.width+i),this.cacheStateIfChanged(t,["height"],r)&&(a.height=t.height+i),this.cacheStateIfChanged(t,["depth"],r)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(n=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]="0 0"),a[o+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(n=this.cacheStateIfChanged(t,["pivotX","pivotY"],r))&&(a[o+"TransformOrigin"]=t.pivotX+i+" "+t.pivotY+i),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],r)||n)&&(a[o+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],r)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var h=e.image;if(h){var d=h.src;d!==r.image&&(r.image=d,a.backgroundImage="url("+d+")");var f=e.rect;if(f){var l=f[0],g=f[1];l!==r.sx&&(r.sx=l,a.backgroundPositionX=-l+i),g!==r.sy&&(r.sy=g,a.backgroundPositionY=-g+i)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==r.maskImage&&(r.maskImage=m,a[o+"MaskImage"]=m,a[o+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===r.maskX&&u===r.maskY||(r.maskX=T,r.maskY=u,a[o+"MaskPosition"]=T+i+" "+u+i)}}},cacheStateIfChanged:function(t,e,a){var r,o,i,n,s=!1;for(r=0,o=e.length;r= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -259,7 +259,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; diff --git a/build/kissy/hilo/tween/Tween.min.js b/build/kissy/hilo/tween/Tween.min.js index f10223fe..efce4129 100644 --- a/build/kissy/hilo/tween/Tween.min.js +++ b/build/kissy/hilo/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for kissy + * hilojs 2.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ -KISSY.add("hilo/tween/Tween",function(e,t){var r=function(){function e(){return+new Date}return t.create({constructor:function(e,t,r,a){var n=this;n.target=e,n._startTime=0,n._seekTime=0,n._pausedTime=0,n._pausedStartTime=0,n._reverseFlag=1,n._repeatCount=0,3==arguments.length&&(a=r,r=t,t=null);for(var i in a)n[i]=a[i];n._fromProps=t,n._toProps=r,!a.duration&&a.time&&(n.duration=a.time||0,n.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,a=r.target,n=e||t,i=r._fromProps={},s=r._toProps={};e=e||a,t=t||a;for(var o in n)s[o]=t[o]||0,a[o]=i[o]=e[o]||0;return r},start:function(){var t=this;return t._startTime=e()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,r.add(t),t},stop:function(){return r.remove(this),this},pause:function(){var t=this;return t.paused=!0,t._pausedStartTime=e(),t},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=e()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,a){var n=this,i=e();return n._startTime=i,n._seekTime=t,n._pausedTime=0,void 0!==a&&(n.paused=a),n._update(i,!0),r.add(n),n},link:function(e){var t,a,n=this,i=e.delay,s=n._startTime;return"string"==typeof i&&(t=0==i.indexOf("+"),a=0==i.indexOf("-"),i=t||a?Number(i.substr(1))*(t?1:-1):Number(i)),e.delay=i,e._startTime=t||a?s+n.duration+i:s+i,n._next=e,r.remove(e),e},_render:function(e){var t,r=this,a=r.target,n=r._fromProps;for(t in n)a[t]=n[t]+(r._toProps[t]-n[t])*e},_update:function(t,a){var n=this;if(!n.paused||a){if(n.isComplete)return!0;var i=t-n._startTime-n._pausedTime+n._seekTime;if(!(i<0)){var s,o=i/n.duration,u=!1;o=o<=0?0:o>=1?1:o;var p=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,p=1-p),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?u=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(p),(s=n.onUpdate)&&s.call(n,p,n),o>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&m<=t?(l._render(o),l.time=i,r.add(l)):n.isComplete&&(m<0||m>t)&&l.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,a,n=r._tweens,i=n.length;for(a=0;a-1&&n.splice(t,1);else for(t=0;t=1?1:o;var u=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,u=1-u),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(u),(s=n.onUpdate)&&s.call(n,u,n),o>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&l<=t?(p._render(o),p.time=i,r.add(p)):n.isComplete&&(l<0||l>t)&&p.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,a,n=r._tweens,i=n.length;for(a=0;a-1&&n.splice(t,1);else for(t=0;t= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -6045,7 +6045,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; @@ -6239,7 +6239,7 @@ return Class.create(/** @lends Tween.prototype */{ window.Hilo.Tween = Tween; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6509,7 +6509,7 @@ return { window.Hilo.Ease = Ease; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6556,7 +6556,7 @@ var ImageLoader = Class.create({ window.Hilo.ImageLoader = ImageLoader; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6622,7 +6622,7 @@ var ScriptLoader = Class.create({ window.Hilo.ScriptLoader = ScriptLoader; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6891,7 +6891,7 @@ function getExtension(src){ window.Hilo.LoadQueue = LoadQueue; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7095,7 +7095,7 @@ var HTMLAudio = Class.create(/** @lends HTMLAudio.prototype */{ window.Hilo.HTMLAudio = HTMLAudio; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7420,7 +7420,7 @@ return Class.create(/** @lends WebAudio.prototype */{ window.Hilo.WebAudio = WebAudio; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7524,7 +7524,7 @@ var WebSound = { window.Hilo.WebSound = WebSound; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7617,7 +7617,7 @@ var Camera = Class.create(/** @lends Camera.prototype */{ window.Hilo.Camera = Camera; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7804,7 +7804,7 @@ var Camera3d = (function(){ window.Hilo.Camera3d = Camera3d; })(window); /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo-standalone.min.js b/build/standalone/hilo-standalone.min.js index 02dfcb19..050d0408 100644 --- a/build/standalone/hilo-standalone.min.js +++ b/build/standalone/hilo-standalone.min.js @@ -1,8 +1,8 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(t){t.Hilo||(t.Hilo={});var e=function(){var e=navigator.userAgent,i=document,n=t,r=i.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in n,supportCanvas:null!=i.createElement("canvas").getContext,supportStorage:!1,supportOrientation:"orientation"in n||"orientation"in n.screen,supportDeviceMotion:"ondevicemotion"in n};try{var o="hilo";localStorage.setItem(o,o),localStorage.removeItem(o),a.supportStorage=!0}catch(s){}var l=a.jsVendor=a.webkit?"webkit":a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",h=a.cssVendor="-"+l+"-",c=i.createElement("div"),u=c.style,d=void 0!=u[l+"Transform"],f=void 0!=u[l+"Perspective"];f&&(c.id="test3d",u=i.createElement("style"),u.textContent="@media ("+h+"transform-3d){#test3d{height:3px}}",i.head.appendChild(u),r.appendChild(c),f=3==c.offsetHeight,i.head.removeChild(u),r.removeChild(c)),a.supportTransform=d,a.supportTransform3D=f;var p=a.supportTouch,v=p?"touchstart":"mousedown",m=p?"touchmove":"mousemove",_=p?"touchend":"mouseup";return a.POINTER_START=v,a.POINTER_MOVE=m,a.POINTER_END=_,a}();t.Hilo.browser=e}(window),function(t){t.Hilo||(t.Hilo={});var e={copy:function(t,e,i){for(var n in e)i&&!t.hasOwnProperty(n)&&void 0===t[n]||(t[n]=e[n]);return t}};t.Hilo.util=e}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.browser,i=t.Hilo.util,n=t,r=document,a=r.documentElement,o=0,s={},l={version:"2.0.0",getUid:function(t){var e=++o;if(t){var i=t.charCodeAt(t.length-1);return i>=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,n){return i.copy(t,e,n),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(n.pageXOffset||a.scrollLeft)-(a.clientLeft||0)||0,o=(n.pageYOffset||a.scrollTop)-(a.clientTop||0)||0,s=n.getComputedStyle?getComputedStyle(t):t.currentStyle,l=parseInt,h=l(s.paddingLeft)+l(s.borderLeftWidth)||0,c=l(s.paddingTop)+l(s.borderTopWidth)||0,u=l(s.paddingRight)+l(s.borderRightWidth)||0,d=l(s.paddingBottom)+l(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+r+h,top:f+o+c,width:v-u-p-h,height:m-d-f-c}},createElement:function(t,e){var i,n,a,o=r.createElement(t);for(i in e)if(n=e[i],"style"===i)for(a in n)o.style[a]=n[a];else o[i]=n;return o},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,n=t._stateCache||(t._stateCache={}),r=l.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],n)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],n)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],n)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],n)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],n)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],n))&&(i[r+"TransformOrigin"]="0 0"),i[r+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],n))&&(i[r+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],n)||o)&&(i[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],n)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var h=e.image;if(h){var c=h.src;c!==n.image&&(n.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==n.sx&&(n.sx=d,i.backgroundPositionX=-d+a),f!==n.sy&&(n.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==n.maskImage&&(n.maskImage=v,i[r+"MaskImage"]=v,i[r+"MaskRepeat"]="no-repeat");var m=p.x,_=p.y;m===n.maskX&&_===n.maskY||(n.maskX=m,n.maskY=_,i[r+"MaskPosition"]=m+a+" "+_+a)}}},cacheStateIfChanged:function(t,e,i){var n,r,a,o,s=!1;for(n=0,r=e.length;n=6?(e=s[0],i=s[1],n=s[2],r=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,n=t.c,r=t.d,a=t.tx,o=t.ty),this.a=l*e+h*n,this.b=l*i+h*r,this.c=c*e+u*n,this.d=c*i+u*r,this.tx=d*e+f*n+a,this.ty=d*i+f*r+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.a,r=this.b,a=this.c,o=this.d,s=this.tx,l=this.ty;return this.a=n*i-r*e,this.b=n*e+r*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-l*e,this.ty=s*e+l*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,a=t*n-e*i;return this.a=n/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-n*r)/a,this.ty=-(t*this.ty-e*r)/a,this},transformPoint:function(t,e,i){var n=t.x*this.a+t.y*this.c+this.tx,r=t.x*this.b+t.y*this.d+this.ty;return e&&(n=n+.5>>0,r=r+.5>>0),i?{x:n,y:r}:(t.x=n,t.y=r,t)}});t.Hilo.Matrix=i}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i={_listeners:null,on:function(t,e,i){for(var n=this._listeners=this._listeners||{},r=n[t]=n[t]||[],a=0,o=r.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[r],!0}return!1}},n=e.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),r=t.Event;if(r){var a=r.prototype,o=a.stopImmediatePropagation;a.stopImmediatePropagation=function(){o&&o.call(this),this._stopped=!0}}t.Hilo.EventMixin=i}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo.util,n=e.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,r=e.image;n.isDrawable(t)?e.image=t:i.copy(e,t,!0);var a=e.image;if("string"==typeof a){if(!r||a!==r.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=a)}a=e.image=r}a&&!e.rect&&(e.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});t.Hilo.Drawable=n}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo.util,n=e.create({constructor:function(t){t=t||{},i.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,n){},resize:function(t,e){}});t.Hilo.Renderer=n}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=e.create({Extends:n,constructor:function(t){r.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,n=t.height,r=t.background;r&&(e.fillStyle=r,e.fillRect(0,0,i,n));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,l=s[2],h=s[3],c=s[4],u=s[5];if(!l||!h)return;i||n||(i=t.width=l,n=t.height=h),(c||u)&&e.translate(c-.5*l,u-.5*h),e.drawImage(o,s[0],s[1],l,h,0,0,i,n)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var n=this.context,r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,l=t._scaleY,h=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",h=!0),(!l&&1!=a||l&&l!=a)&&(t._scaleY=a,o.height=a*t.height+"px",h=!0),h&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),n.clip());var _=t.align;if(_){var g=t.getAlignPosition();c=g.x,u=g.y}v?n.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||n.translate(c,u),0!=p&&n.rotate(p*Math.PI/180),1==r&&1==a||n.scale(r,a),0==d&&0==f||n.translate(-d,-f))}t.alpha>0&&(n.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},clear:function(t,e,i,n){this.context.clearRect(t,e,i,n)},resize:function(t,e){var i=this.canvas,n=this.stage,r=i.style;i.width=t,i.height=e,r.width=n.width*n.scaleX+"px",r.height=n.height*n.scaleY+"px"}});t.Hilo.CanvasRenderer=r}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=t.Hilo.Drawable,a=function(){function t(t,e){var n=t.tagName||"div",r=e.image,a=t.width||r&&r.width,o=t.height||r&&r.height,s=i.createElement(n),l=s.style;if(t.id&&(s.id=t.id),l.position="absolute",l.left=(t.left||0)+"px",l.top=(t.top||0)+"px",l.width=a+"px",l.height=o+"px","canvas"==n){if(s.width=a,s.height=o,r){var h=s.getContext("2d"),c=e.rect||[0,0,a,o];h.drawImage(r,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(l.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(l.overflow="hidden"),r&&r.src){l.backgroundImage="url("+r.src+")";var u=t.rectX||0,d=t.rectY||0;l.backgroundPosition=-u+"px "+-d+"px"}return s}return e.create({Extends:n,constructor:function(t){a.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new r;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,n=i.parentNode;if(e){var r=e.drawable.domElement;if(r!=n&&r.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||n||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(i.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,n=t._scaleX,r=t._scaleY,a=t.scaleX,o=t.scaleY;(!n&&1!=a||n&&n!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!r&&1!=o||r&&r!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();t.Hilo.DOMRenderer=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=t.Hilo.Matrix,a=Math.PI/180,o=e.create({Extends:n,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){o.superclass.constructor.call(this,t);var e=this,i=o.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var n=this.maxBatchNum*o.ATTRIBUTE_NUM*4,r=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*n),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(r);for(var a=0,s=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,n=(t.background,t.drawable),r=n&&n.image;if(r){var a=n.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var l=this._createVertexs(r,a[0],a[1],o,s,0,0,e,i),h=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[h+0]=l[0],c[h+1]=l[1],c[h+2]=l[2],c[h+3]=l[3],u[h+4]=d,c[h+5]=l[4],c[h+6]=l[5],c[h+7]=l[6],c[h+8]=l[7],u[h+9]=d,c[h+10]=l[8],c[h+11]=l[9],c[h+12]=l[10],c[h+13]=l[11],u[h+14]=d,c[h+15]=l[12],c[h+16]=l[13],c[h+17]=l[14],c[h+18]=l[15],u[h+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[h+5*p],m=c[h+5*p+1];c[h+5*p]=f.a*v+f.c*m+f.tx,c[h+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=r,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,l=t._scaleY,h=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",h=!0),(!l&&1!=a||l&&l!=a)&&(t._scaleY=a,o.height=a*t.height+"px",h=!0),h&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},clear:function(t,e,i,n){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,n=this.stage,r=i.style;this.width=i.width=t,this.height=i.height=e,r.width=n.width*n.scaleX+"px",r.height=n.height*n.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,n=null,r=0;r0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*n,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new s(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,n,r,a,o,s,l){var h=this.__tempVertexs||[],c=t.width,u=t.height;n/=c,r/=u,e/=c,i/=u,s=s,l=l,a=a,o=o,n+e>1&&(n=1-e),r+i>1&&(r=1-i);var d=0;return h[d++]=a,h[d++]=o,h[d++]=e,h[d++]=i,h[d++]=a+s,h[d++]=o,h[d++]=e+n,h[d++]=i,h[d++]=a,h[d++]=o+l,h[d++]=e,h[d++]=i+r,h[d++]=a+s,h[d++]=o+l,h[d++]=e+n,h[d++]=i+r,h},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,n=1,r=0,o=t.rotation%360,s=t.pivotX,l=t.pivotY,h=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*a;n=Math.cos(d),r=Math.sin(d)}var f=t.getAlignPosition();i.a=n*h,i.b=r*h,i.c=-r*c,i.d=n*c,i.tx=f.x-i.a*s-i.c*l,i.ty=f.y-i.b*s-i.d*l}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),s=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};s.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,n=t.program;n&&i&&(e.activeShader=t,i.useProgram(n),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(n,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(n,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,n=e.createTexture(),r=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(r,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=n,n},_createProgram:function(t,e,i){var n=this._createShader(t,t.VERTEX_SHADER,e),r=this._createShader(t,t.FRAGMENT_SHADER,i);if(!n||!r)return null;var a=t.createProgram();if(a){t.attachShader(a,n),t.attachShader(a,r),t.linkProgram(a),t.deleteShader(r),t.deleteShader(n);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var n=t.createShader(e);if(n){t.shaderSource(n,i),t.compileShader(n);var r=t.getShaderParameter(n,t.COMPILE_STATUS);if(!r){var a=t.getShaderInfoLog(n);return console.log("Failed to compile shader: "+a),t.deleteShader(n),null}}return n}},t.Hilo.WebGLRenderer=o}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.EventMixin,r=t.Hilo.Matrix,a=t.Hilo.util,o=function(){function t(t,e,i){for(var n,r,a,o,s=0,l=!1,h=0,c=i.length;hd.x?(n=d.x,r=u.x):(n=u.x,r=d.x),t>=n&&t<=r))l=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(l=!0),u.x>t&&u.y==e){var p=i[(c+h-1)%c];(p.ye||p.y>e&&d.ys?s=c:ch?h=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return i.create({Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("View"),a.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,n,r,a,o,s=this.width,l=this.height,h=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:l},{x:0,y:l}],u=[],d=0,f=c.length;de?n=e:ri?a=i:o>1,n=0;break;case"TR":i=o-r,n=0;break;case"L":i=0,n=s-a>>1;break;case"C":i=o-r>>1,n=s-a>>1;break;case"R":i=o-r,n=s-a>>1;break;case"BL":i=0,n=s-a;break;case"B":i=o-r>>1,n=s-a;break;case"BR":i=o-r,n=s-a}}return{x:i,y:n}},hitTestPoint:function(e,i,n){var r=this.getBounds(),a=e>=r.x&&e<=r.x+r.width&&i>=r.y&&i<=r.y+r.height;return a&&n&&(a=t(e,i,r)),a},hitTestObject:function(t,e){var i=this.getBounds(),n=t.getBounds(),r=i.x<=n.x+n.width&&n.x<=i.x+i.width&&i.y<=n.y+n.height&&n.y<=i.y+i.height;return r&&e&&(r=o(i,n)),!!r},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=a.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return e.viewToString(this)}})}();t.Hilo.View=o}(window),function(t){t.Hilo||(t.Hilo={});var e,i,n=t.Hilo.Drawable,r=t.Hilo.browser,a={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){r.supportCanvas&&(e||(e=document.createElement("canvas"),i=e.getContext("2d")),e.width=this.width,e.height=this.height,this._draw(i),this.drawable=this.drawable||new n,this.drawable.init({image:e.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};t.Hilo.CacheMixin=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=i.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Container"),r.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,n=i.length,r=t.parent;e=e<0?0:e>n?n:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==n?n-1:e):r&&r.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var n=i;n=n.parent;){if(n.renderer){i.__renderer=n.renderer;break}if(n.__renderer){i.__renderer=n.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,n=0,r=i.length;n=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,n=0,r=i.length;n=0&&n!=e){var r=i.length;e=e<0?0:e>=r?r-1:e,i.splice(n,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,n=this.getChildIndex(t),r=this.getChildIndex(e);t.depth=r,i[r]=t,e.depth=n,i[n]=e},swapChildrenAt:function(t,e){var i=this.children,n=this.getChildAt(t),r=this.getChildAt(e);n.depth=e,i[e]=n,r.depth=t,i[t]=r},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var n=e;e=function(t,e){return e[n]-t[n]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,n=this.children;t=t||0,e=e||n.length;for(var r=t;r=0;h--)if(a=l[h],!(!a||!a.visible||a.alpha<=0||r&&!a.pointerEnabled))if(a.children&&a.children.length&&(!r||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,n,r)),o){if(!n)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!n)return a;s.push(a)}return n&&s.length?s:null},render:function(t,e){r.superclass.render.call(this,t,e);var i,n,a,o=this.children.slice(0);for(i=0,n=o.length;in?n:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,n=-1;if("number"==typeof t)n=t;else{var r="string"==typeof t?this._frameNames[t]:t;if(r)for(var a=0;a=i?i-1:n,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,n=this.currentFrame;if(this._firstRender?(i=n,this._firstRender=!1):i=this._nextFrame(e),i!=n){this.currentFrame=i;var r=this._frames[i].callback;r&&r.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),a.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,n=this.currentFrame,r=e[n],a=r.duration||this.interval,o=this._frameElapsed,s=0!=n||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=r.next?n=this.getFrameIndex(r.next):n>=i-1?n=0:this.drawable&&n++),n},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});t.Hilo.Sprite=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=t.Hilo.Drawable,a=i.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("DOMElement"),a.superclass.constructor.call(this,t),this.drawable=new r;var i=this.drawable.domElement=t.element||e.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,i){if("dom"!==t.renderType){var n=t.canvas,r=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=e.createElement("div",{style:{position:"absolute",transform:"scale3d("+r.scaleX+","+r.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),n.parentNode.insertBefore(t._domElementContainer,n.nextSibling));var o,s=this.drawable.domElement,l=this.depth,h=a.childNodes[0];if(s.parentNode)return;for(;h&&3!=h.nodeType&&(o=parseInt(h.style.zIndex)||0,!(o<=0||o>l));)h=h.nextSibling;a.insertBefore(this.drawable.domElement,h)}else t.draw(this)}});t.Hilo.DOMElement=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=t.Hilo.CacheMixin,a=function(){var t=document.createElement("canvas"),o=t.getContext&&t.getContext("2d");return i.create({Extends:n,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Graphics"),a.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,n,r,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=n&&s.call(o,["lineCap",o.lineCap=n]),void 0!=r&&s.call(o,["lineJoin",o.lineJoin=r]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,n=i._addAction;return n.call(i,["fillStyle",i.fillStyle=t]),n.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,n,r,a){for(var s=this,l=o.createLinearGradient(t,e,i,n),h=0,c=r.length;h1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();t.Hilo.Graphics=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.View,r=t.Hilo.CacheMixin,a=e.create({Extends:n,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),a.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=a.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=a.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var n=i.drawable,r=n.domElement,a=r.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",r.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var n,r,a,o,s,l=i.split(/\r\n|\r|\n|/),h=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(n=0,o=l.length;ne.maxWidth?(d.push({text:m,y:c}),h<_&&(h=_),c+=u,m=v):(_=f,m+=v),p==s-1&&(d.push({text:m,y:c}),m!==v&&h>1;break;case"bottom":g=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,n=0;n>1;break;case"right":case"end":r=a}n.outline?t.strokeText(e,r,i):t.fillText(e,r,i)},Statics:{measureFontHeight:function(t){var e,n=document.documentElement,r=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(r),e=r.offsetHeight,n.removeChild(r),e}}});t.Hilo.Text=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Container,r=t.Hilo.Bitmap,a=e.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("BitmapText"),a.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),n=i.length;if(e.text!=i){e.text=i;var r,a,o,s,l=0,h=0,c=0;for(r=0;r0?e.letterSpacing:0),e.children[r]?(s=e.children[r],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,l=c+o.rect[2],h=Math.max(h,o.rect[3]));for(r=e.children.length-1;r>=n;r--)e._releaseBitmap(e.children[r]),e.children[r].removeFromParent();return e.width=l,e.height=h,this.setTextAlign(),e}},_createBitmap:function(t){var e;return a._pool.length?(e=a._pool.pop(),e.setImage(t.image,t.rect)):e=new r({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){a._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,n=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var n=i.slice(0),r=0,a=n.length;r=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(n){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,n=(new Date).getTime()+e,r={tick:function(){var e=(new Date).getTime(),a=e-n;a>=0&&(i.removeTick(r),t())}};return i.addTick(r),r},interval:function(t,e){var i=this,n=(new Date).getTime()+e,r={tick:function(){var i=(new Date).getTime(),r=i-n;r>=0&&(r=n)return-1;for(e<0&&(e=n+e),i=e;i=1?1:s;var h=r.ease?r.ease(s):s;r.reverse&&r.isStart&&(r._reverseFlag<0&&(s=1-s,h=1-h),s<1e-7&&(r.repeat>0&&r._repeatCount++>=r.repeat||0==r.repeat&&!r.loop?l=!0:(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1))),r.isStart||(r.setProps(r._fromProps,r._toProps),r.isStart=!0,r.onStart&&r.onStart.call(r,r)),r.time=a,r._render(h),(o=r.onUpdate)&&o.call(r,h,r),s>=1&&(r.reverse?(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1):r.loop||r.repeat>0&&r._repeatCount++0&&u<=e?(c._render(s),c.time=a,i.add(c)):r.isComplete&&(u<0||u>e)&&c.start()}return r.isComplete?((o=r.onComplete)&&o.call(r,r),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,n,r=i._tweens,a=r.length;for(n=0;n-1&&r.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndex=48&&i<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,i=t;i;)e=e?i.id+"."+e:i.id,i=i.parent;return e},copy:function(t,e,n){return i.copy(t,e,n),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(i){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(n.pageXOffset||a.scrollLeft)-(a.clientLeft||0)||0,o=(n.pageYOffset||a.scrollTop)-(a.clientTop||0)||0,s=n.getComputedStyle?getComputedStyle(t):t.currentStyle,l=parseInt,h=l(s.paddingLeft)+l(s.borderLeftWidth)||0,c=l(s.paddingTop)+l(s.borderTopWidth)||0,u=l(s.paddingRight)+l(s.borderRightWidth)||0,d=l(s.paddingBottom)+l(s.borderBottomWidth)||0,f=e.top||0,p=e.left||0,v=e.right||0,m=e.bottom||0;return{left:p+r+h,top:f+o+c,width:v-u-p-h,height:m-d-f-c}},createElement:function(t,e){var i,n,a,o=r.createElement(t);for(i in e)if(n=e[i],"style"===i)for(a in n)o.style[a]=n[a];else o[i]=n;return o},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,i=e.domElement.style,n=t._stateCache||(t._stateCache={}),r=l.browser.jsVendor,a="px",o=!1;if(this.cacheStateIfChanged(t,["visible"],n)&&(i.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],n)&&(i.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],n)&&(i.width=t.width+a),this.cacheStateIfChanged(t,["height"],n)&&(i.height=t.height+a),this.cacheStateIfChanged(t,["depth"],n)&&(i.zIndex=t.depth+1),t.transform){var s=t.transform;(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],n))&&(i[r+"TransformOrigin"]="0 0"),i[r+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(o=this.cacheStateIfChanged(t,["pivotX","pivotY"],n))&&(i[r+"TransformOrigin"]=t.pivotX+a+" "+t.pivotY+a),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],n)||o)&&(i[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],n)&&(i.backgroundColor=t.background),i.pointerEvents||(i.pointerEvents="none");var h=e.image;if(h){var c=h.src;c!==n.image&&(n.image=c,i.backgroundImage="url("+c+")");var u=e.rect;if(u){var d=u[0],f=u[1];d!==n.sx&&(n.sx=d,i.backgroundPositionX=-d+a),f!==n.sy&&(n.sy=f,i.backgroundPositionY=-f+a)}}var p=t.mask;if(p){var v=p.drawable.domElement.style.backgroundImage;v!==n.maskImage&&(n.maskImage=v,i[r+"MaskImage"]=v,i[r+"MaskRepeat"]="no-repeat");var m=p.x,_=p.y;m===n.maskX&&_===n.maskY||(n.maskX=m,n.maskY=_,i[r+"MaskPosition"]=m+a+" "+_+a)}}},cacheStateIfChanged:function(t,e,i){var n,r,a,o,s=!1;for(n=0,r=e.length;n=6?(e=s[0],i=s[1],n=s[2],r=s[3],a=s[4],o=s[5]):(e=t.a,i=t.b,n=t.c,r=t.d,a=t.tx,o=t.ty),this.a=l*e+h*n,this.b=l*i+h*r,this.c=c*e+u*n,this.d=c*i+u*r,this.tx=d*e+f*n+a,this.ty=d*i+f*r+o,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.a,r=this.b,a=this.c,o=this.d,s=this.tx,l=this.ty;return this.a=n*i-r*e,this.b=n*e+r*i,this.c=a*i-o*e,this.d=a*e+o*i,this.tx=s*i-l*e,this.ty=s*e+l*i,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},translate:function(t,e){return this.tx+=t,this.ty+=e,this},identity:function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},invert:function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,a=t*n-e*i;return this.a=n/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-n*r)/a,this.ty=-(t*this.ty-e*r)/a,this},transformPoint:function(t,e,i){var n=t.x*this.a+t.y*this.c+this.tx,r=t.x*this.b+t.y*this.d+this.ty;return e&&(n=n+.5>>0,r=r+.5>>0),i?{x:n,y:r}:(t.x=n,t.y=r,t)}});t.Hilo.Matrix=i}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i={_listeners:null,on:function(t,e,i){for(var n=this._listeners=this._listeners||{},r=n[t]=n[t]||[],a=0,o=r.length;a-1&&o.splice(c,1)}}return 0==o.length&&delete a[r],!0}return!1}},n=e.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),r=t.Event;if(r){var a=r.prototype,o=a.stopImmediatePropagation;a.stopImmediatePropagation=function(){o&&o.call(this),this._stopped=!0}}t.Hilo.EventMixin=i}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo.util,n=e.create({constructor:function(t){this.init(t)},image:null,rect:null,init:function(t){var e=this,r=e.image;n.isDrawable(t)?e.image=t:i.copy(e,t,!0);var a=e.image;if("string"==typeof a){if(!r||a!==r.getAttribute("src")){e.image=null;var o=new Image;return t.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,e.init(o)},void(o.src=a)}a=e.image=r}a&&!e.rect&&(e.rect=[0,0,a.width,a.height])},Statics:{isDrawable:function(t){if(!t||!t.tagName)return!1;var e=t.tagName.toLowerCase();return"img"===e||"canvas"===e||"video"===e}}});t.Hilo.Drawable=n}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo.util,n=e.create({constructor:function(t){t=t||{},i.copy(this,t,!0)},renderType:null,canvas:null,stage:null,blendMode:"source-over",startDraw:function(t){},draw:function(t){},endDraw:function(t){},transform:function(){},hide:function(){},remove:function(t){},clear:function(t,e,i,n){},resize:function(t,e){}});t.Hilo.Renderer=n}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=e.create({Extends:n,constructor:function(t){r.superclass.constructor.call(this,t),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(t){return!!(t.visible&&t.alpha>0)&&(t===this.stage&&this.context.clearRect(0,0,t.width,t.height),t.blendMode!==this.blendMode&&(this.context.globalCompositeOperation=this.blendMode=t.blendMode),this.context.save(),!0)},draw:function(t){var e=this.context,i=t.width,n=t.height,r=t.background;r&&(e.fillStyle=r,e.fillRect(0,0,i,n));var a=t.drawable,o=a&&a.image;if(o){var s=a.rect,l=s[2],h=s[3],c=s[4],u=s[5];if(!l||!h)return;i||n||(i=t.width=l,n=t.height=h),(c||u)&&e.translate(c-.5*l,u-.5*h),e.drawImage(o,s[0],s[1],l,h,0,0,i,n)}},endDraw:function(t){this.context.restore()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var n=this.context,r=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,l=t._scaleY,h=!1;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,o.width=r*t.width+"px",h=!0),(!l&&1!=a||l&&l!=a)&&(t._scaleY=a,o.height=a*t.height+"px",h=!0),h&&t.updateViewport()}else{var c=t.x,u=t.y,d=t.pivotX,f=t.pivotY,p=t.rotation%360,v=t.transform,m=t.mask;m&&(m._render(this),n.clip());var _=t.align;if(_){var g=t.getAlignPosition();c=g.x,u=g.y}v?n.transform(v.a,v.b,v.c,v.d,v.tx,v.ty):(0==c&&0==u||n.translate(c,u),0!=p&&n.rotate(p*Math.PI/180),1==r&&1==a||n.scale(r,a),0==d&&0==f||n.translate(-d,-f))}t.alpha>0&&(n.globalAlpha*=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},clear:function(t,e,i,n){this.context.clearRect(t,e,i,n)},resize:function(t,e){var i=this.canvas,n=this.stage,r=i.style;i.width=t,i.height=e,r.width=n.width*n.scaleX+"px",r.height=n.height*n.scaleY+"px"}});t.Hilo.CanvasRenderer=r}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=t.Hilo.Drawable,a=function(){function t(t,e){var n=t.tagName||"div",r=e.image,a=t.width||r&&r.width,o=t.height||r&&r.height,s=i.createElement(n),l=s.style;if(t.id&&(s.id=t.id),l.position="absolute",l.left=(t.left||0)+"px",l.top=(t.top||0)+"px",l.width=a+"px",l.height=o+"px","canvas"==n){if(s.width=a,s.height=o,r){var h=s.getContext("2d"),c=e.rect||[0,0,a,o];h.drawImage(r,c[0],c[1],c[2],c[3],t.x||0,t.y||0,t.width||c[2],t.height||c[3])}}else if(l.opacity=void 0!=t.alpha?t.alpha:1,(t===this.stage||t.clipChildren)&&(l.overflow="hidden"),r&&r.src){l.backgroundImage="url("+r.src+")";var u=t.rectX||0,d=t.rectY||0;l.backgroundPosition=-u+"px "+-d+"px"}return s}return e.create({Extends:n,constructor:function(t){a.superclass.constructor.call(this,t)},renderType:"dom",startDraw:function(e){var i=e.drawable=e.drawable||new r;return i.domElement=i.domElement||t(e,i),!0},draw:function(t){var e=t.parent,i=t.drawable.domElement,n=i.parentNode;if(e){var r=e.drawable.domElement;if(r!=n&&r.appendChild(i),!t.width&&!t.height){var a=t.drawable.rect;a&&(a[2]||a[3])&&(t.width=a[2],t.height=a[3])}}else t!==this.stage||n||(i.style.overflow="hidden",this.canvas.appendChild(i))},transform:function(t){if(i.setElementStyleByView(t),t===this.stage){var e=this.canvas.style,n=t._scaleX,r=t._scaleY,a=t.scaleX,o=t.scaleY;(!n&&1!=a||n&&n!=a)&&(t._scaleX=a,e.width=a*t.width+"px"),(!r&&1!=o||r&&r!=o)&&(t._scaleY=o,e.height=o*t.height+"px")}},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},hide:function(t){var e=t.drawable&&t.drawable.domElement;e&&(e.style.display="none")},resize:function(t,e){var i=this.canvas.style;i.width=t+"px",i.height=e+"px","absolute"!=i.position&&(i.position="relative")}})}();t.Hilo.DOMRenderer=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Renderer,r=t.Hilo.Matrix,a=Math.PI/180,o=e.create({Extends:n,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var t=document.createElement("canvas");t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){o.superclass.constructor.call(this,t);var e=this,i=o.contextOptions||{};this.gl=this.canvas.getContext("webgl",i)||this.canvas.getContext("experimental-webgl",i),this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var n=this.maxBatchNum*o.ATTRIBUTE_NUM*4,r=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*n),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(r);for(var a=0,s=0;a0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,i=t.height,n=(t.background,t.drawable),r=n&&n.image;if(r){var a=n.rect,o=a[2],s=a[3];e||i||(e=t.width=o,i=t.height=s),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var l=this._createVertexs(r,a[0],a[1],o,s,0,0,e,i),h=this.batchIndex*this.positionStride,c=this.float32Array,u=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);c[h+0]=l[0],c[h+1]=l[1],c[h+2]=l[2],c[h+3]=l[3],u[h+4]=d,c[h+5]=l[4],c[h+6]=l[5],c[h+7]=l[6],c[h+8]=l[7],u[h+9]=d,c[h+10]=l[8],c[h+11]=l[9],c[h+12]=l[10],c[h+13]=l[11],u[h+14]=d,c[h+15]=l[12],c[h+16]=l[13],c[h+17]=l[14],c[h+18]=l[15],u[h+19]=d;for(var f=t.__webglWorldMatrix,p=0;p<4;p++){var v=c[h+5*p],m=c[h+5*p+1];c[h+5*p]=f.a*v+f.c*m+f.tx,c[h+5*p+1]=f.b*v+f.d*m+f.ty}t.__textureImage=r,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void i.setElementStyleByView(t);var n=t.scaleX,a=t.scaleY;if(t===this.stage){var o=this.canvas.style,s=t._scaleX,l=t._scaleY,h=!1;(!s&&1!=n||s&&s!=n)&&(t._scaleX=n,o.width=n*t.width+"px",h=!0),(!l&&1!=a||l&&l!=a)&&(t._scaleY=a,o.height=a*t.height+"px",h=!0),h&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent));t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,i=e&&e.domElement;if(i){var n=i.parentNode;n&&n.removeChild(i)}},clear:function(t,e,i,n){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var i=this.canvas,n=this.stage,r=i.style;this.width=i.width=t,this.height=i.height=e,r.width=n.width*n.scaleX+"px",r.height=n.height*n.scaleY+"px",this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var e=0,i=0,n=null,r=0;r0&&(i.bindTexture(i.TEXTURE_2D,this._getTexture(this.sprites[t])),i.drawElements(i.TRIANGLES,6*n,i.UNSIGNED_SHORT,6*t*2))},_uploadProjectionTransform:function(t){this._projectionTransformElements&&!t||(this._projectionTransformElements=new Float32Array([1/this.canvasHalfWidth,0,0,0,-1/this.canvasHalfHeight,0,-1,1,1])),this.gl.uniformMatrix3fv(this.u_projectionTransform,!1,this._projectionTransformElements)},_initShaders:function(){var t=" attribute vec2 a_position;\n attribute vec2 a_TexCoord;\n attribute vec4 a_tint;\n uniform mat3 u_projectionTransform;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_Position = vec4((u_projectionTransform * vec3(a_position, 1.0)).xy, 1.0, 1.0);\n v_TexCoord = a_TexCoord;\n v_tint = vec4(a_tint.rgb * a_tint.a, a_tint.a);\n }\n ",e="\n precision mediump float;\n uniform sampler2D u_Sampler;\n varying vec2 v_TexCoord;\n varying vec4 v_tint;\n void main(){\n gl_FragColor = texture2D(u_Sampler, v_TexCoord) * v_tint;\n }\n ";this.defaultShader=new s(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,i,n,r,a,o,s,l){var h=this.__tempVertexs||[],c=t.width,u=t.height;n/=c,r/=u,e/=c,i/=u,s=s,l=l,a=a,o=o,n+e>1&&(n=1-e),r+i>1&&(r=1-i);var d=0;return h[d++]=a,h[d++]=o,h[d++]=e,h[d++]=i,h[d++]=a+s,h[d++]=o,h[d++]=e+n,h[d++]=i,h[d++]=a,h[d++]=o+l,h[d++]=e,h[d++]=i+r,h[d++]=a+s,h[d++]=o+l,h[d++]=e+n,h[d++]=i+r,h},_setConcatenatedMatrix:function(t,e){var i=t.__webglWorldMatrix,n=1,r=0,o=t.rotation%360,s=t.pivotX,l=t.pivotY,h=t.scaleX,c=t.scaleY,u=t.transform;if(u)i.copy(u);else{if(o){var d=o*a;n=Math.cos(d),r=Math.sin(d)}var f=t.getAlignPosition();i.a=n*h,i.b=r*h,i.c=-r*c,i.d=n*c,i.tx=f.x-i.a*s-i.c*l,i.ty=f.y-i.b*s-i.d*l}i.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,i=this._cacheTexture[e.src];return i||(i=this.activeShader.uploadTexture(e)),i}}),s=function(t,e,i){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),i=i||{},this.attributes=i.attributes||[],this.uniforms=i.uniforms||[]};s.prototype={active:function(){var t=this,e=t.renderer,i=t.gl,n=t.program;n&&i&&(e.activeShader=t,i.useProgram(n),t.attributes.forEach(function(t){e[t]=i.getAttribLocation(n,t),i.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=i.getUniformLocation(n,t)}),t.width===e.width&&t.height===e.height||(t.width=e.width,t.height=e.height,e._uploadProjectionTransform()))},uploadTexture:function(t){var e=this.gl,i=this.renderer,n=e.createTexture(),r=i.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(r,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=n,n},_createProgram:function(t,e,i){var n=this._createShader(t,t.VERTEX_SHADER,e),r=this._createShader(t,t.FRAGMENT_SHADER,i);if(!n||!r)return null;var a=t.createProgram();if(a){t.attachShader(a,n),t.attachShader(a,r),t.linkProgram(a),t.deleteShader(r),t.deleteShader(n);var o=t.getProgramParameter(a,t.LINK_STATUS);if(!o){var s=t.getProgramInfoLog(a);return console.log("Failed to link program: "+s),t.deleteProgram(a),null}}return a},_createShader:function(t,e,i){var n=t.createShader(e);if(n){t.shaderSource(n,i),t.compileShader(n);var r=t.getShaderParameter(n,t.COMPILE_STATUS);if(!r){var a=t.getShaderInfoLog(n);return console.log("Failed to compile shader: "+a),t.deleteShader(n),null}}return n}},t.Hilo.WebGLRenderer=o}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.EventMixin,r=t.Hilo.Matrix,a=t.Hilo.util,o=function(){function t(t,e,i){for(var n,r,a,o,s=0,l=!1,h=0,c=i.length;hd.x?(n=d.x,r=u.x):(n=u.x,r=d.x),t>=n&&t<=r))l=!0;else if(u.y>d.y?(a=d.y,o=u.y):(a=u.y,o=d.y),!(eo)){var f=(e-u.y)*(d.x-u.x)/(d.y-u.y)+u.x;if(f>t?s++:f==t&&(l=!0),u.x>t&&u.y==e){var p=i[(c+h-1)%c];(p.ye||p.y>e&&d.ys?s=c:ch?h=c:c=0)return!1;u>i.overlap&&(i.overlap=u,i.normal.x=p.x,i.normal.y=p.y)}return i}return i.create({Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("View"),a.copy(this,t,!0)},tint:16777215,id:null,x:0,y:0,width:0,height:0,alpha:1,rotation:0,visible:!0,pivotX:0,pivotY:0,scaleX:1,scaleY:1,pointerEnabled:!0,background:null,mask:null,align:null,drawable:null,boundsArea:null,parent:null,depth:-1,transform:null,blendMode:"source-over",getStage:function(){for(var t,e=this;t=e.parent;)e=t;return e.canvas?e:null},getScaledWidth:function(){return this.width*this.scaleX},getScaledHeight:function(){return this.height*this.scaleY},addTo:function(t,e){return"number"==typeof e?t.addChildAt(this,e):t.addChild(this),this},removeFromParent:function(){var t=this.parent;return t&&t.removeChild(this),this},getBounds:function(){for(var t,e,i,n,r,a,o,s=this.width,l=this.height,h=this.getConcatenatedMatrix(),c=this.boundsArea||[{x:0,y:0},{x:s,y:0},{x:s,y:l},{x:0,y:l}],u=[],d=0,f=c.length;de?n=e:ri?a=i:o>1,n=0;break;case"TR":i=o-r,n=0;break;case"L":i=0,n=s-a>>1;break;case"C":i=o-r>>1,n=s-a>>1;break;case"R":i=o-r,n=s-a>>1;break;case"BL":i=0,n=s-a;break;case"B":i=o-r>>1,n=s-a;break;case"BR":i=o-r,n=s-a}}return{x:i,y:n}},hitTestPoint:function(e,i,n){var r=this.getBounds(),a=e>=r.x&&e<=r.x+r.width&&i>=r.y&&i<=r.y+r.height;return a&&n&&(a=t(e,i,r)),a},hitTestObject:function(t,e){var i=this.getBounds(),n=t.getBounds(),r=i.x<=n.x+n.width&&n.x<=i.x+i.width&&i.y<=n.y+n.height&&n.y<=i.y+i.height;return r&&e&&(r=o(i,n)),!!r},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||!t.startDraw(this)||(t.transform(this),this.render(t,e),t.endDraw(this))},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"==t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=a.copy({},t);e.type="mouseover",this.fire(e)}}else"mouseout"==t.type&&(this.__mouseOver=!1);var i=this.parent;t._stopped||t._stopPropagationed||!i||("mouseout"==t.type||"touchout"==t.type?i.hitTestPoint(t.stageX,t.stageY,!0)||i._fireMouseEvent(t):i._fireMouseEvent(t))},onUpdate:null,render:function(t,e){t.draw(this)},toString:function(){return e.viewToString(this)}})}();t.Hilo.View=o}(window),function(t){t.Hilo||(t.Hilo={});var e,i,n=t.Hilo.Drawable,r=t.Hilo.browser,a={_cacheDirty:!0,cache:function(t){(t||this._cacheDirty||!this.drawable)&&this.updateCache()},updateCache:function(){r.supportCanvas&&(e||(e=document.createElement("canvas"),i=e.getContext("2d")),e.width=this.width,e.height=this.height,this._draw(i),this.drawable=this.drawable||new n,this.drawable.init({image:e.toDataURL()}),this._cacheDirty=!1)},setCacheDirty:function(t){this._cacheDirty=t}};t.Hilo.CacheMixin=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=i.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Container"),r.superclass.constructor.call(this,t),this.children?this._updateChildren():this.children=[]},children:null,pointerChildren:!0,clipChildren:!1,getNumChildren:function(){return this.children.length},addChildAt:function(t,e){var i=this.children,n=i.length,r=t.parent;e=e<0?0:e>n?n:e;var a=this.getChildIndex(t);if(a==e)return this;if(a>=0?(i.splice(a,1),e=e==n?n-1:e):r&&r.removeChild(t),i.splice(e,0,t),a<0)this._updateChildren(e);else{var o=a=e.length)return null;var i=e[t];if(i){if(!i.__renderer)for(var n=i;n=n.parent;){if(n.renderer){i.__renderer=n.renderer;break}if(n.__renderer){i.__renderer=n.__renderer;break}}i.__renderer&&i.__renderer.remove(i),i.parent=null,i.depth=-1}return e.splice(t,1),this._updateChildren(t),i},removeChild:function(t){return this.removeChildAt(this.getChildIndex(t))},removeChildById:function(t){for(var e,i=this.children,n=0,r=i.length;n=e.length?null:e[t]},getChildById:function(t){for(var e,i=this.children,n=0,r=i.length;n=0&&n!=e){var r=i.length;e=e<0?0:e>=r?r-1:e,i.splice(n,1),i.splice(e,0,t),this._updateChildren()}return this},swapChildren:function(t,e){var i=this.children,n=this.getChildIndex(t),r=this.getChildIndex(e);t.depth=r,i[r]=t,e.depth=n,i[n]=e},swapChildrenAt:function(t,e){var i=this.children,n=this.getChildAt(t),r=this.getChildAt(e);n.depth=e,i[e]=n,r.depth=t,i[t]=r},sortChildren:function(t){var e=t,i=this.children;if("string"==typeof e){var n=e;e=function(t,e){return e[n]-t[n]}}i.sort(e),this._updateChildren()},_updateChildren:function(t,e){var i,n=this.children;t=t||0,e=e||n.length;for(var r=t;r=0;h--)if(a=l[h],!(!a||!a.visible||a.alpha<=0||r&&!a.pointerEnabled))if(a.children&&a.children.length&&(!r||a.pointerChildren)&&(o=a.getViewAtPoint(t,e,i,n,r)),o){if(!n)return o;o.length&&(s=s.concat(o))}else if(a.hitTestPoint(t,e,i)){if(!n)return a;s.push(a)}return n&&s.length?s:null},render:function(t,e){r.superclass.render.call(this,t,e);var i,n,a,o=this.children.slice(0);for(i=0,n=o.length;in?n:e,i[e]=t,t.name&&(this._frameNames[t.name]=t),(0!=e||this.width)&&this.height||(this.width=t.rect[2],this.height=t.rect[3]),this},getFrame:function(t){if("number"==typeof t){var e=this._frames;return t<0||t>=e.length?null:e[t]}return this._frameNames[t]},getFrameIndex:function(t){var e=this._frames,i=e.length,n=-1;if("number"==typeof t)n=t;else{var r="string"==typeof t?this._frameNames[t]:t;if(r)for(var a=0;a=i?i-1:n,this.paused=e,this._firstRender=!0,this},_render:function(t,e){var i,n=this.currentFrame;if(this._firstRender?(i=n,this._firstRender=!1):i=this._nextFrame(e),i!=n){this.currentFrame=i;var r=this._frames[i].callback;r&&r.call(this)}this.onEnterFrame&&this.onEnterFrame(i),this.drawable.init(this._frames[i]),a.superclass._render.call(this,t,e)},_nextFrame:function(t){var e=this._frames,i=e.length,n=this.currentFrame,r=e[n],a=r.duration||this.interval,o=this._frameElapsed,s=0!=n||this.drawable?o+(this.timeBased?t:1):0;return o=this._frameElapsed=s=i-1)&&this.stop(),this.paused||0!=o||(null!=r.next?n=this.getFrameIndex(r.next):n>=i-1?n=0:this.drawable&&n++),n},setFrameCallback:function(t,e){return t=this.getFrame(t),t&&(t.callback=e),this},onEnterFrame:null});t.Hilo.Sprite=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=t.Hilo.Drawable,a=i.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("DOMElement"),a.superclass.constructor.call(this,t),this.drawable=new r;var i=this.drawable.domElement=t.element||e.createElement("div");i.id=this.id,this.pointerEnabled&&!i.style.pointerEvents&&(i.style.pointerEvents="visible")},_render:function(t,e){this.onUpdate&&this.onUpdate(e)===!1||(t.transform(this),this.visible&&this.alpha>0&&this.render(t,e))},render:function(t,i){if("dom"!==t.renderType){var n=t.canvas,r=this.parent,a=t._domElementContainer;t._domElementContainer||(a=t._domElementContainer=e.createElement("div",{style:{position:"absolute",transform:"scale3d("+r.scaleX+","+r.scaleY+", 1)",transformOrigin:"0 0",zIndex:"1"}}),n.parentNode.insertBefore(t._domElementContainer,n.nextSibling));var o,s=this.drawable.domElement,l=this.depth,h=a.childNodes[0];if(s.parentNode)return;for(;h&&3!=h.nodeType&&(o=parseInt(h.style.zIndex)||0,!(o<=0||o>l));)h=h.nextSibling;a.insertBefore(this.drawable.domElement,h)}else t.draw(this)}});t.Hilo.DOMElement=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=t.Hilo.CacheMixin,a=function(){var t=document.createElement("canvas"),o=t.getContext&&t.getContext("2d");return i.create({Extends:n,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Graphics"),a.superclass.constructor.call(this,t),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,n,r,a){var o=this,s=o._addAction;return s.call(o,["lineWidth",o.lineWidth=t||1]),s.call(o,["strokeStyle",o.strokeStyle=e||"0"]),s.call(o,["lineAlpha",o.lineAlpha=i||1]),void 0!=n&&s.call(o,["lineCap",o.lineCap=n]),void 0!=r&&s.call(o,["lineJoin",o.lineJoin=r]),void 0!=a&&s.call(o,["miterLimit",o.miterLimit=a]),o.hasStroke=!0,o},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,n=i._addAction;return n.call(i,["fillStyle",i.fillStyle=t]),n.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,n,r,a){for(var s=this,l=o.createLinearGradient(t,e,i,n),h=0,c=r.length;h1?a.slice(1):null;"function"==typeof t[o]?t[o].apply(t,s):t[o]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();t.Hilo.Graphics=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.View,r=t.Hilo.CacheMixin,a=e.create({Extends:n,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),a.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=a.measureFontHeight(this.font)},text:"",color:"#000",textAlign:null,textVAlign:null,outline:!1,lineSpacing:0,maxWidth:200,font:null,textWidth:0,textHeight:0,setFont:function(t){var e=this;return e.font!==t&&(e.font=t,e._fontHeight=a.measureFontHeight(t)),e},render:function(t,e){var i=this;if("canvas"===t.renderType)this.drawable?t.draw(i):i._draw(t.context);else if("dom"===t.renderType){var n=i.drawable,r=n.domElement,a=r.style;a.font=i.font,a.textAlign=i.textAlign,a.color=i.color,a.width=i.width+"px",a.height=i.height+"px",a.lineHeight=i._fontHeight+i.lineSpacing+"px",r.innerHTML=i.text,t.draw(this)}else i.cache(),t.draw(i)},_draw:function(t){var e=this,i=e.text.toString();if(i){t.font=e.font,t.textAlign=e.textAlign,t.textBaseline="top";var n,r,a,o,s,l=i.split(/\r\n|\r|\n|/),h=0,c=0,u=e._fontHeight+e.lineSpacing,d=[];for(n=0,o=l.length;ne.maxWidth?(d.push({text:m,y:c}),h<_&&(h=_),c+=u,m=v):(_=f,m+=v),p==s-1&&(d.push({text:m,y:c}),m!==v&&h>1;break;case"bottom":g=e.height-e.textHeight}var x=e.background;for(x&&(t.fillStyle=x,t.fillRect(0,0,e.width,e.height)),e.outline?t.strokeStyle=e.color:t.fillStyle=e.color,n=0;n>1;break;case"right":case"end":r=a}n.outline?t.strokeText(e,r,i):t.fillText(e,r,i)},Statics:{measureFontHeight:function(t){var e,n=document.documentElement,r=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(r),e=r.offsetHeight,n.removeChild(r),e}}});t.Hilo.Text=a}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.Class,i=t.Hilo,n=t.Hilo.Container,r=t.Hilo.Bitmap,a=e.create({Extends:n,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("BitmapText"),a.superclass.constructor.call(this,t);var e=t.text+"";e&&(this.text="",this.setText(e)),this.pointerChildren=!1},glyphs:null,letterSpacing:0,text:"",textAlign:"left",setText:function(t){var e=this,i=t.toString(),n=i.length;if(e.text!=i){e.text=i;var r,a,o,s,l=0,h=0,c=0;for(r=0;r0?e.letterSpacing:0),e.children[r]?(s=e.children[r],s.setImage(o.image,o.rect)):(s=e._createBitmap(o),e.addChild(s)),s.x=c,l=c+o.rect[2],h=Math.max(h,o.rect[3]));for(r=e.children.length-1;r>=n;r--)e._releaseBitmap(e.children[r]),e.children[r].removeFromParent();return e.width=l,e.height=h,this.setTextAlign(),e}},_createBitmap:function(t){var e;return a._pool.length?(e=a._pool.pop(),e.setImage(t.image,t.rect)):e=new r({image:t.image,rect:t.rect}),e},_releaseBitmap:function(t){a._pool.push(t)},setTextAlign:function(t){switch(this.textAlign=t||this.textAlign,this.textAlign){case"center":this.pivotX=.5*this.width;break;case"right":this.pivotX=this.width;break;case"left":default:this.pivotX=0}return this},hasGlyphs:function(t){var e=this.glyphs;if(!e)return!1;t=t.toString();var i,n=t.length;for(i=0;i=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var n=i.slice(0),r=0,a=n.length;r=0&&e.splice(i,1)},nextTick:function(t){var e=this,i={tick:function(n){e.removeTick(i),t()}};return e.addTick(i),i},timeout:function(t,e){var i=this,n=(new Date).getTime()+e,r={tick:function(){var e=(new Date).getTime(),a=e-n;a>=0&&(i.removeTick(r),t())}};return i.addTick(r),r},interval:function(t,e){var i=this,n=(new Date).getTime()+e,r={tick:function(){var i=(new Date).getTime(),r=i-n;r>=0&&(r=n)return-1;for(e<0&&(e=n+e),i=e;i=1?1:s;var l=r.ease?r.ease(s):s;r.reverse&&r.isStart&&(r._reverseFlag<0&&(s=1-s,l=1-l),s<1e-7&&(r.repeat>0&&r._repeatCount++>=r.repeat||0==r.repeat&&!r.loop?r.isComplete=!0:(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1))),r.isStart||(r.setProps(r._fromProps,r._toProps),r.isStart=!0,r.onStart&&r.onStart.call(r,r)),r.time=a,r._render(l),(o=r.onUpdate)&&o.call(r,l,r),s>=1&&(r.reverse?(r._startTime=t(),r._pausedTime=0,r._reverseFlag*=-1):r.loop||r.repeat>0&&r._repeatCount++0&&c<=e?(h._render(s),h.time=a,i.add(h)):r.isComplete&&(c<0||c>e)&&h.start()}return r.isComplete?((o=r.onComplete)&&o.call(r,r),!0):void 0}}},Statics:{_tweens:[],tick:function(){var e,n,r=i._tweens,a=r.length;for(n=0;n-1&&r.splice(e,1);else for(e=0;e=i)return void t.fire("complete");if(t._currentIndexe.z})},tick:function(){this.sortZ()}});return o}();t.Hilo.Camera3d=n}(window),function(t){t.Hilo||(t.Hilo={});var e=t.Hilo,i=t.Hilo.Class,n=t.Hilo.View,r=t.Hilo.Container,a=t.Hilo.Drawable,o=t.Hilo.util,s=function(){function t(t,e){return e?t+2*(Math.random()-.5)*e:t}for(var s=["x","y","vx","vy","ax","ay","rotation","rotationV","scale","scaleV","alpha","alphaV","life"],l=[],h=0,c=s.length;h=this._emitTime&&(this._currentRunTime=0,this._emitTime=t(this.emitTime,this.emitTimeVar),this._emit()),this._totalRunTime>=this.totalTime&&this.stop())},_emit:function(){for(var e=t(this.emitNum,this.emitNumVar)>>0,i=0;i=0;e--)this.children[e].destroy()}}),v=i.create({Extends:n,constructor:function(t){this.id=this.id||t.id||e.getUid("Particle"),v.superclass.constructor.call(this,t),this.init(t)},onUpdate:function(t){if(t*=.001,this._died)return!1;var e=this.ax+this.system.gx,i=this.ay+this.system.gy;return this.vx+=e*t,this.vy+=i*t,this.x+=this.vx*t,this.y+=this.vy*t,this.rotation+=this.rotationV,this._time>.1&&(this.alpha+=this.alphaV),this.scale+=this.scaleV,this.scaleX=this.scaleY=this.scale,this._time+=t,this._time>=this.life||this.alpha<=0?(this.destroy(),!1):void 0},setImage:function(t,e){this.drawable=this.drawable||new a,e=e||[0,0,t.width,t.height],this.width=e[2],this.height=e[3],this.drawable.rect=e,this.drawable.image=t},destroy:function(){this._died=!0,this.alpha=0,this.removeFromParent(),f.push(this)},init:function(e){this.system=e.system,this._died=!1,this._time=0,this.alpha=1;for(var i=0,n=l.length;i>0]),this.setImage(e.image,o),void 0!==e.pivotX&&(this.pivotX=e.pivotX*o[2]),void 0!==e.pivotY&&(this.pivotY=e.pivotY*o[3])}},Statics:{create:function(t){if(f.length>0){var e=f.pop();return e.init(t),e}return new v(t)}}});return p}();t.Hilo.ParticleSystem=s}(window); \ No newline at end of file diff --git a/build/standalone/hilo-standalone.zip b/build/standalone/hilo-standalone.zip index 9f6c9dab..f6be5c84 100644 Binary files a/build/standalone/hilo-standalone.zip and b/build/standalone/hilo-standalone.zip differ diff --git a/build/standalone/hilo/core/Class.js b/build/standalone/hilo/core/Class.js index 4ff88d11..856f0ee5 100644 --- a/build/standalone/hilo/core/Class.js +++ b/build/standalone/hilo/core/Class.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/core/Class.min.js b/build/standalone/hilo/core/Class.min.js index 497c3315..94ced659 100644 --- a/build/standalone/hilo/core/Class.min.js +++ b/build/standalone/hilo/core/Class.min.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/core/Hilo.js b/build/standalone/hilo/core/Hilo.js index 6415c33e..cf826a82 100644 --- a/build/standalone/hilo/core/Hilo.js +++ b/build/standalone/hilo/core/Hilo.js @@ -1,5 +1,5 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -29,7 +29,7 @@ var Hilo = { * Hilo version * @type String */ - version: '2.0.0', + version: '2.0.1', /** * @language=en * Gets a globally unique id. Such as Stage1, Bitmap2 etc. diff --git a/build/standalone/hilo/core/Hilo.min.js b/build/standalone/hilo/core/Hilo.min.js index a3bf7e6f..09bf8068 100644 --- a/build/standalone/hilo/core/Hilo.min.js +++ b/build/standalone/hilo/core/Hilo.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(t){t.Hilo||(t.Hilo={});var e=t.Hilo.browser,a=t.Hilo.util,o=t,r=document,n=r.documentElement,i=0,s={},c={version:"2.0.0",getUid:function(t){var e=++i;if(t){var a=t.charCodeAt(t.length-1);return a>=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,o){return a.copy(t,e,o),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(o.pageXOffset||n.scrollLeft)-(n.clientLeft||0)||0,i=(o.pageYOffset||n.scrollTop)-(n.clientTop||0)||0,s=o.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,f=c(s.paddingLeft)+c(s.borderLeftWidth)||0,h=c(s.paddingTop)+c(s.borderTopWidth)||0,d=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+r+f,top:g+i+h,width:m-d-p-f,height:T-l-g-h}},createElement:function(t,e){var a,o,n,i=r.createElement(t);for(a in e)if(o=e[a],"style"===a)for(n in o)i.style[n]=o[n];else i[a]=o;return i},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,o=t._stateCache||(t._stateCache={}),r=c.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],o)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],o)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],o)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],o)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],o)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]="0 0"),a[r+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],o)||i)&&(a[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],o)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var f=e.image;if(f){var h=f.src;h!==o.image&&(o.image=h,a.backgroundImage="url("+h+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==o.sx&&(o.sx=l,a.backgroundPositionX=-l+n),g!==o.sy&&(o.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==o.maskImage&&(o.maskImage=m,a[r+"MaskImage"]=m,a[r+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===o.maskX&&u===o.maskY||(o.maskX=T,o.maskY=u,a[r+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var o,r,n,i,s=!1;for(o=0,r=e.length;o=48&&a<=57&&(t+="_"),t+e}return e},viewToString:function(t){for(var e,a=t;a;)e=e?a.id+"."+e:a.id,a=a.parent;return e},copy:function(t,e,o){return a.copy(t,e,o),s.copy||(s.copy=!0,console.warn("Hilo.copy has been Deprecated! Use Hilo.util.copy instead.")),t},browser:e,event:{POINTER_START:e.POINTER_START,POINTER_MOVE:e.POINTER_MOVE,POINTER_END:e.POINTER_END},align:{TOP_LEFT:"TL",TOP:"T",TOP_RIGHT:"TR",LEFT:"L",CENTER:"C",RIGHT:"R",BOTTOM_LEFT:"BL",BOTTOM:"B",BOTTOM_RIGHT:"BR"},getElementRect:function(t){var e;try{e=t.getBoundingClientRect()}catch(a){e={top:t.offsetTop,left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,bottom:t.offsetTop+t.offsetHeight}}var r=(o.pageXOffset||n.scrollLeft)-(n.clientLeft||0)||0,i=(o.pageYOffset||n.scrollTop)-(n.clientTop||0)||0,s=o.getComputedStyle?getComputedStyle(t):t.currentStyle,c=parseInt,f=c(s.paddingLeft)+c(s.borderLeftWidth)||0,h=c(s.paddingTop)+c(s.borderTopWidth)||0,d=c(s.paddingRight)+c(s.borderRightWidth)||0,l=c(s.paddingBottom)+c(s.borderBottomWidth)||0,g=e.top||0,p=e.left||0,m=e.right||0,T=e.bottom||0;return{left:p+r+f,top:g+i+h,width:m-d-p-f,height:T-l-g-h}},createElement:function(t,e){var a,o,n,i=r.createElement(t);for(a in e)if(o=e[a],"style"===a)for(n in o)i.style[n]=o[n];else i[a]=o;return i},getElement:function(t){return r.getElementById(t)},setElementStyleByView:function(t){var e=t.drawable,a=e.domElement.style,o=t._stateCache||(t._stateCache={}),r=c.browser.jsVendor,n="px",i=!1;if(this.cacheStateIfChanged(t,["visible"],o)&&(a.display=t.visible?"":"none"),this.cacheStateIfChanged(t,["alpha"],o)&&(a.opacity=t.alpha),t.visible&&!(t.alpha<=0)){if(this.cacheStateIfChanged(t,["width"],o)&&(a.width=t.width+n),this.cacheStateIfChanged(t,["height"],o)&&(a.height=t.height+n),this.cacheStateIfChanged(t,["depth"],o)&&(a.zIndex=t.depth+1),t.transform){var s=t.transform;(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]="0 0"),a[r+"Transform"]="matrix3d("+s.a+", "+s.b+", 0, 0, "+s.c+", "+s.d+", 0, 0, 0, 0, 1, 0, "+s.tx+", "+s.ty+", 0, 1)"}else(i=this.cacheStateIfChanged(t,["pivotX","pivotY"],o))&&(a[r+"TransformOrigin"]=t.pivotX+n+" "+t.pivotY+n),(this.cacheStateIfChanged(t,["x","y","rotation","scaleX","scaleY"],o)||i)&&(a[r+"Transform"]=this.getTransformCSS(t));this.cacheStateIfChanged(t,["background"],o)&&(a.backgroundColor=t.background),a.pointerEvents||(a.pointerEvents="none");var f=e.image;if(f){var h=f.src;h!==o.image&&(o.image=h,a.backgroundImage="url("+h+")");var d=e.rect;if(d){var l=d[0],g=d[1];l!==o.sx&&(o.sx=l,a.backgroundPositionX=-l+n),g!==o.sy&&(o.sy=g,a.backgroundPositionY=-g+n)}}var p=t.mask;if(p){var m=p.drawable.domElement.style.backgroundImage;m!==o.maskImage&&(o.maskImage=m,a[r+"MaskImage"]=m,a[r+"MaskRepeat"]="no-repeat");var T=p.x,u=p.y;T===o.maskX&&u===o.maskY||(o.maskX=T,o.maskY=u,a[r+"MaskPosition"]=T+n+" "+u+n)}}},cacheStateIfChanged:function(t,e,a){var o,r,n,i,s=!1;for(o=0,r=e.length;o= 1 ? 1 : ratio; var easeRatio = me.ease ? me.ease(ratio) : ratio; @@ -260,7 +260,7 @@ return Class.create(/** @lends Tween.prototype */{ if(ratio < 1e-7){ //repeat complete or not loop if((me.repeat > 0 && me._repeatCount++ >= me.repeat) || (me.repeat == 0 && !me.loop)){ - complete = true; + me.isComplete = true; }else{ me._startTime = now(); me._pausedTime = 0; diff --git a/build/standalone/hilo/tween/Tween.min.js b/build/standalone/hilo/tween/Tween.min.js index d9c0eb02..d54a17e2 100644 --- a/build/standalone/hilo/tween/Tween.min.js +++ b/build/standalone/hilo/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * hilojs 2.0.0 for standalone + * hilojs 2.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(e){e.Hilo||(e.Hilo={});var t=e.Hilo.Class,r=function(){function e(){return+new Date}return t.create({constructor:function(e,t,r,a){var n=this;n.target=e,n._startTime=0,n._seekTime=0,n._pausedTime=0,n._pausedStartTime=0,n._reverseFlag=1,n._repeatCount=0,3==arguments.length&&(a=r,r=t,t=null);for(var i in a)n[i]=a[i];n._fromProps=t,n._toProps=r,!a.duration&&a.time&&(n.duration=a.time||0,n.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,a=r.target,n=e||t,i=r._fromProps={},s=r._toProps={};e=e||a,t=t||a;for(var o in n)s[o]=t[o]||0,a[o]=i[o]=e[o]||0;return r},start:function(){var t=this;return t._startTime=e()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,r.add(t),t},stop:function(){return r.remove(this),this},pause:function(){var t=this;return t.paused=!0,t._pausedStartTime=e(),t},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=e()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,a){var n=this,i=e();return n._startTime=i,n._seekTime=t,n._pausedTime=0,void 0!==a&&(n.paused=a),n._update(i,!0),r.add(n),n},link:function(e){var t,a,n=this,i=e.delay,s=n._startTime;return"string"==typeof i&&(t=0==i.indexOf("+"),a=0==i.indexOf("-"),i=t||a?Number(i.substr(1))*(t?1:-1):Number(i)),e.delay=i,e._startTime=t||a?s+n.duration+i:s+i,n._next=e,r.remove(e),e},_render:function(e){var t,r=this,a=r.target,n=r._fromProps;for(t in n)a[t]=n[t]+(r._toProps[t]-n[t])*e},_update:function(t,a){var n=this;if(!n.paused||a){if(n.isComplete)return!0;var i=t-n._startTime-n._pausedTime+n._seekTime;if(!(i<0)){var s,o=i/n.duration,u=!1;o=o<=0?0:o>=1?1:o;var p=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,p=1-p),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?u=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(p),(s=n.onUpdate)&&s.call(n,p,n),o>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&m<=t?(l._render(o),l.time=i,r.add(l)):n.isComplete&&(m<0||m>t)&&l.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,a,n=r._tweens,i=n.length;for(a=0;a-1&&n.splice(t,1);else for(t=0;t=1?1:o;var u=n.ease?n.ease(o):o;n.reverse&&n.isStart&&(n._reverseFlag<0&&(o=1-o,u=1-u),o<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=i,n._render(u),(s=n.onUpdate)&&s.call(n,u,n),o>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&l<=t?(p._render(o),p.time=i,r.add(p)):n.isComplete&&(l<0||l>t)&&p.start()}return n.isComplete?((s=n.onComplete)&&s.call(n,n),!0):void 0}}},Statics:{_tweens:[],tick:function(){var t,a,n=r._tweens,i=n.length;for(a=0;a-1&&n.splice(t,1);else for(t=0;t