diff --git a/build/amd/hilo-amd.js b/build/amd/hilo-amd.js
index b609dd63..0a040648 100644
--- a/build/amd/hilo-amd.js
+++ b/build/amd/hilo-amd.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -192,7 +192,7 @@ return browser;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -229,7 +229,7 @@ return util;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -257,7 +257,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @language=en
* Gets a globally unique id. Such as Stage1, Bitmap2 etc.
@@ -565,7 +565,7 @@ return Hilo;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -748,7 +748,7 @@ return Class;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -972,7 +972,7 @@ return Matrix;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1125,7 +1125,7 @@ return EventMixin;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1206,7 +1206,7 @@ return Drawable;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1300,7 +1300,7 @@ return Renderer;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1511,7 +1511,7 @@ return CanvasRenderer;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1693,7 +1693,7 @@ return DOMRenderer;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1750,7 +1750,13 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
}
}
return this._isSupported;
- }
+ },
+ /**
+ * WebGL context Options
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
+ * @type {Object}
+ */
+ contextOptions: null
},
renderType:'webgl',
gl:null,
@@ -1759,7 +1765,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
- this.gl = this.canvas.getContext("webgl")||this.canvas.getContext('experimental-webgl');
+ var contextOptions = WebGLRenderer.contextOptions || {};
+ this.gl = this.canvas.getContext("webgl", contextOptions)||this.canvas.getContext('experimental-webgl', contextOptions);
this.maxBatchNum = WebGLRenderer.MAX_BATCH_NUM;
this.positionStride = WebGLRenderer.ATTRIBUTE_NUM * 4;
@@ -2270,7 +2277,7 @@ return WebGLRenderer;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2767,7 +2774,7 @@ return View;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2833,7 +2840,7 @@ return CacheMixin;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3207,7 +3214,7 @@ return Container;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3474,7 +3481,7 @@ return Stage;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3552,7 +3559,7 @@ return Bitmap;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3823,7 +3830,7 @@ return Sprite;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3938,7 +3945,7 @@ return DOMElement;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3948,7 +3955,7 @@ define('hilo/view/Graphics', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/Vi
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
@@ -4500,7 +4507,7 @@ return Graphics;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4548,7 +4555,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
@@ -4753,7 +4760,7 @@ return Text;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4937,7 +4944,7 @@ return BitmapText;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5116,7 +5123,7 @@ return Button;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5353,7 +5360,7 @@ return TextureAtlas;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5582,7 +5589,7 @@ return Ticker;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5630,7 +5637,7 @@ if (!fnProto.bind) {
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5769,7 +5776,7 @@ return drag;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6219,7 +6226,7 @@ return Tween;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6491,7 +6498,7 @@ return Ease;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6539,7 +6546,7 @@ return ImageLoader;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6606,7 +6613,7 @@ return ScriptLoader;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6856,7 +6863,7 @@ return LoadQueue;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7059,7 +7066,7 @@ return HTMLAudio;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7376,7 +7383,7 @@ return WebAudio;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7479,7 +7486,7 @@ return WebSound;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7572,7 +7579,7 @@ return Camera;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7759,7 +7766,7 @@ return Camera3d;
});
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 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 6487ea21..6c5a467c 100644
--- a/build/amd/hilo-amd.min.js
+++ b/build/amd/hilo-amd.min.js
@@ -1,8 +1,8 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 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:"1.3.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=t.crossOrigin),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}},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){a.superclass.constructor.call(this,t);var e=this;this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl"),this.maxBatchNum=a.MAX_BATCH_NUM,this.positionStride=4*a.ATTRIBUTE_NUM;var i=this.maxBatchNum*a.ATTRIBUTE_NUM*4,r=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(r);for(var n=0,o=0;n0)&&(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:null,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._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,s,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)):h&&(u<0||u>t)&&c.start()}return h?((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
+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:"1.4.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=t.crossOrigin),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._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,s,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)):h&&(u<0||u>t)&&c.start()}return h?((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 baf0b5bf..06dbea6c 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 a6b9b3c2..ef34945f 100644
--- a/build/amd/hilo/core/Class.js
+++ b/build/amd/hilo/core/Class.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 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 04de6472..092152dc 100644
--- a/build/amd/hilo/core/Class.min.js
+++ b/build/amd/hilo/core/Class.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 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 ea1a3e45..b72b71e0 100644
--- a/build/amd/hilo/core/Hilo.js
+++ b/build/amd/hilo/core/Hilo.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -27,7 +27,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @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 c5d9fd99..2a4ee37f 100644
--- a/build/amd/hilo/core/Hilo.min.js
+++ b/build/amd/hilo/core/Hilo.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 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:"1.3.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;o0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],T=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*T+u.tx,_[c+5*f+1]=u.b*g+u.d*T+u.ty}t.__textureImage=a,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var r=t.drawable;if(r&&r.domElement)return void e.setElementStyleByView(t);var a=t.scaleX,n=t.scaleY;if(t===this.stage){var s=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=a||o&&o!=a)&&(t._scaleX=a,s.width=a*t.width+"px",c=!0),(!h&&1!=n||h&&h!=n)&&(t._scaleY=n,s.height=n*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new i(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new i(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,n=0,s=t.rotation%360,o=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(s){var d=s*a;i=Math.cos(d),n=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=n*c,r.c=-n*_,r.d=i*_,r.tx=u.x-r.a*o-r.c*h,r.ty=u.y-r.b*o-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),s=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return s.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},n});
\ No newline at end of file
+define("hilo/renderer/WebGLRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"],function(t,e,r,i){var a=Math.PI/180,n=t.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){n.superclass.constructor.call(this,t);var e=this,r=n.contextOptions||{};this.gl=this.canvas.getContext("webgl",r)||this.canvas.getContext("experimental-webgl",r),this.maxBatchNum=n.MAX_BATCH_NUM,this.positionStride=4*n.ATTRIBUTE_NUM;var i=this.maxBatchNum*n.ATTRIBUTE_NUM*4,a=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(a);for(var s=0,o=0;s0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],x=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*x+u.tx,_[c+5*f+1]=u.b*g+u.d*x+u.ty}t.__textureImage=a,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var r=t.drawable;if(r&&r.domElement)return void e.setElementStyleByView(t);var a=t.scaleX,n=t.scaleY;if(t===this.stage){var s=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=a||o&&o!=a)&&(t._scaleX=a,s.width=a*t.width+"px",c=!0),(!h&&1!=n||h&&h!=n)&&(t._scaleY=n,s.height=n*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new i(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new i(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,n=0,s=t.rotation%360,o=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(s){var d=s*a;i=Math.cos(d),n=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=n*c,r.c=-n*_,r.d=i*_,r.tx=u.x-r.a*o-r.c*h,r.ty=u.y-r.b*o-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),s=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return s.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},n});
\ No newline at end of file
diff --git a/build/amd/hilo/tween/Ease.js b/build/amd/hilo/tween/Ease.js
index c116f6cc..ee6ee03a 100644
--- a/build/amd/hilo/tween/Ease.js
+++ b/build/amd/hilo/tween/Ease.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/tween/Ease.min.js b/build/amd/hilo/tween/Ease.min.js
index 88b267de..f8cf1fcd 100644
--- a/build/amd/hilo/tween/Ease.min.js
+++ b/build/amd/hilo/tween/Ease.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/tween/Tween.js b/build/amd/hilo/tween/Tween.js
index cd8ba4d2..be1849fc 100644
--- a/build/amd/hilo/tween/Tween.js
+++ b/build/amd/hilo/tween/Tween.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/tween/Tween.min.js b/build/amd/hilo/tween/Tween.min.js
index 88cda3ed..c64dd506 100644
--- a/build/amd/hilo/tween/Tween.min.js
+++ b/build/amd/hilo/tween/Tween.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/TextureAtlas.js b/build/amd/hilo/util/TextureAtlas.js
index 7d310c2f..0662ab6c 100644
--- a/build/amd/hilo/util/TextureAtlas.js
+++ b/build/amd/hilo/util/TextureAtlas.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/TextureAtlas.min.js b/build/amd/hilo/util/TextureAtlas.min.js
index d22ac898..bdf594f8 100644
--- a/build/amd/hilo/util/TextureAtlas.min.js
+++ b/build/amd/hilo/util/TextureAtlas.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/Ticker.js b/build/amd/hilo/util/Ticker.js
index cc82713b..3ca114bd 100644
--- a/build/amd/hilo/util/Ticker.js
+++ b/build/amd/hilo/util/Ticker.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/Ticker.min.js b/build/amd/hilo/util/Ticker.min.js
index e067f980..d104abf5 100644
--- a/build/amd/hilo/util/Ticker.min.js
+++ b/build/amd/hilo/util/Ticker.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/browser.js b/build/amd/hilo/util/browser.js
index 06c887bd..fa8d9cee 100644
--- a/build/amd/hilo/util/browser.js
+++ b/build/amd/hilo/util/browser.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/browser.min.js b/build/amd/hilo/util/browser.min.js
index 9429296a..e783667b 100644
--- a/build/amd/hilo/util/browser.min.js
+++ b/build/amd/hilo/util/browser.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/drag.js b/build/amd/hilo/util/drag.js
index 2b5d1219..5bc7ef7e 100644
--- a/build/amd/hilo/util/drag.js
+++ b/build/amd/hilo/util/drag.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/drag.min.js b/build/amd/hilo/util/drag.min.js
index 926d8770..40969d19 100644
--- a/build/amd/hilo/util/drag.min.js
+++ b/build/amd/hilo/util/drag.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/polyfill.js b/build/amd/hilo/util/polyfill.js
index 7521779c..36c8ad2f 100644
--- a/build/amd/hilo/util/polyfill.js
+++ b/build/amd/hilo/util/polyfill.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/polyfill.min.js b/build/amd/hilo/util/polyfill.min.js
index 14c06a6b..80a189d9 100644
--- a/build/amd/hilo/util/polyfill.min.js
+++ b/build/amd/hilo/util/polyfill.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/util.js b/build/amd/hilo/util/util.js
index d348296a..ea67d3d1 100644
--- a/build/amd/hilo/util/util.js
+++ b/build/amd/hilo/util/util.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/util/util.min.js b/build/amd/hilo/util/util.min.js
index 7840e77b..10213a81 100644
--- a/build/amd/hilo/util/util.min.js
+++ b/build/amd/hilo/util/util.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Bitmap.js b/build/amd/hilo/view/Bitmap.js
index d5c6cb29..7682d91a 100644
--- a/build/amd/hilo/view/Bitmap.js
+++ b/build/amd/hilo/view/Bitmap.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Bitmap.min.js b/build/amd/hilo/view/Bitmap.min.js
index 07f8eab9..5295f4b7 100644
--- a/build/amd/hilo/view/Bitmap.min.js
+++ b/build/amd/hilo/view/Bitmap.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/BitmapText.js b/build/amd/hilo/view/BitmapText.js
index 354c95df..b8f9bc3d 100644
--- a/build/amd/hilo/view/BitmapText.js
+++ b/build/amd/hilo/view/BitmapText.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/BitmapText.min.js b/build/amd/hilo/view/BitmapText.min.js
index ecb21687..3642d4b9 100644
--- a/build/amd/hilo/view/BitmapText.min.js
+++ b/build/amd/hilo/view/BitmapText.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Button.js b/build/amd/hilo/view/Button.js
index 7c360958..48a97e78 100644
--- a/build/amd/hilo/view/Button.js
+++ b/build/amd/hilo/view/Button.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Button.min.js b/build/amd/hilo/view/Button.min.js
index a9b3c981..f3f8b709 100644
--- a/build/amd/hilo/view/Button.min.js
+++ b/build/amd/hilo/view/Button.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/CacheMixin.js b/build/amd/hilo/view/CacheMixin.js
index e167b928..80d81c8c 100644
--- a/build/amd/hilo/view/CacheMixin.js
+++ b/build/amd/hilo/view/CacheMixin.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/CacheMixin.min.js b/build/amd/hilo/view/CacheMixin.min.js
index 81e7c465..fa53d8c2 100644
--- a/build/amd/hilo/view/CacheMixin.min.js
+++ b/build/amd/hilo/view/CacheMixin.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Container.js b/build/amd/hilo/view/Container.js
index 10a78f29..37585651 100644
--- a/build/amd/hilo/view/Container.js
+++ b/build/amd/hilo/view/Container.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Container.min.js b/build/amd/hilo/view/Container.min.js
index 1fbba521..36285715 100644
--- a/build/amd/hilo/view/Container.min.js
+++ b/build/amd/hilo/view/Container.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/DOMElement.js b/build/amd/hilo/view/DOMElement.js
index 3e5fa466..6ecb9c5e 100644
--- a/build/amd/hilo/view/DOMElement.js
+++ b/build/amd/hilo/view/DOMElement.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/DOMElement.min.js b/build/amd/hilo/view/DOMElement.min.js
index c4a86f15..9a7c7f52 100644
--- a/build/amd/hilo/view/DOMElement.min.js
+++ b/build/amd/hilo/view/DOMElement.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Drawable.js b/build/amd/hilo/view/Drawable.js
index e5c5e06c..b4c5e233 100644
--- a/build/amd/hilo/view/Drawable.js
+++ b/build/amd/hilo/view/Drawable.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Drawable.min.js b/build/amd/hilo/view/Drawable.min.js
index a51d2bbf..45987ea7 100644
--- a/build/amd/hilo/view/Drawable.min.js
+++ b/build/amd/hilo/view/Drawable.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Graphics.js b/build/amd/hilo/view/Graphics.js
index 162b2a9c..d5795d78 100644
--- a/build/amd/hilo/view/Graphics.js
+++ b/build/amd/hilo/view/Graphics.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -9,7 +9,7 @@ define('hilo/view/Graphics', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/Vi
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
diff --git a/build/amd/hilo/view/Graphics.min.js b/build/amd/hilo/view/Graphics.min.js
index b9e9f9bf..654c4cb4 100644
--- a/build/amd/hilo/view/Graphics.min.js
+++ b/build/amd/hilo/view/Graphics.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Sprite.js b/build/amd/hilo/view/Sprite.js
index 89af2b00..fe5d4552 100644
--- a/build/amd/hilo/view/Sprite.js
+++ b/build/amd/hilo/view/Sprite.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Sprite.min.js b/build/amd/hilo/view/Sprite.min.js
index 7156a2d7..944a963e 100644
--- a/build/amd/hilo/view/Sprite.min.js
+++ b/build/amd/hilo/view/Sprite.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Stage.js b/build/amd/hilo/view/Stage.js
index d1262823..77684a38 100644
--- a/build/amd/hilo/view/Stage.js
+++ b/build/amd/hilo/view/Stage.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Stage.min.js b/build/amd/hilo/view/Stage.min.js
index 7b62827b..a5ab675c 100644
--- a/build/amd/hilo/view/Stage.min.js
+++ b/build/amd/hilo/view/Stage.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/Text.js b/build/amd/hilo/view/Text.js
index a60bee37..1c72e477 100644
--- a/build/amd/hilo/view/Text.js
+++ b/build/amd/hilo/view/Text.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -47,7 +47,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
diff --git a/build/amd/hilo/view/Text.min.js b/build/amd/hilo/view/Text.min.js
index c08e92d8..ab5280a2 100644
--- a/build/amd/hilo/view/Text.min.js
+++ b/build/amd/hilo/view/Text.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
-define("hilo/view/Text",["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,n){var o=t.create({Extends:i,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Text"),o.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=o.measureFontHeight(this.font)},text:null,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=o.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,o=n.domElement,h=o.style;h.font=i.font,h.textAlign=i.textAlign,h.color=i.color,h.width=i.width+"px",h.height=i.height+"px",h.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,h,l,r,a=i.split(/\r\n|\r|\n|
/),s=0,c=0,d=e._fontHeight+e.lineSpacing,x=[];for(n=0,l=a.length;ne.maxWidth?(x.push({text:w,y:c}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=h}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var i,n=document.documentElement,o=e.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(o),i=o.offsetHeight,n.removeChild(o),i}}});return o});
\ No newline at end of file
+define("hilo/view/Text",["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,n){var o=t.create({Extends:i,Mixes:n,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Text"),o.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=o.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=o.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,o=n.domElement,h=o.style;h.font=i.font,h.textAlign=i.textAlign,h.color=i.color,h.width=i.width+"px",h.height=i.height+"px",h.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,h,r,l,a=i.split(/\r\n|\r|\n|
/),s=0,c=0,d=e._fontHeight+e.lineSpacing,x=[];for(n=0,r=a.length;ne.maxWidth?(x.push({text:w,y:c}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=h}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var i,n=document.documentElement,o=e.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(o),i=o.offsetHeight,n.removeChild(o),i}}});return o});
\ No newline at end of file
diff --git a/build/amd/hilo/view/View.js b/build/amd/hilo/view/View.js
index 63e8d660..995f6533 100644
--- a/build/amd/hilo/view/View.js
+++ b/build/amd/hilo/view/View.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/amd/hilo/view/View.min.js b/build/amd/hilo/view/View.min.js
index bc609364..d62ecbaf 100644
--- a/build/amd/hilo/view/View.min.js
+++ b/build/amd/hilo/view/View.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for amd
+ * Hilo 1.4.0 for amd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo-cmd.js b/build/cmd/hilo-cmd.js
index 2a51d92c..1b8fbf01 100644
--- a/build/cmd/hilo-cmd.js
+++ b/build/cmd/hilo-cmd.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -192,7 +192,7 @@ return browser;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -229,7 +229,7 @@ return util;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -260,7 +260,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @language=en
* Gets a globally unique id. Such as Stage1, Bitmap2 etc.
@@ -568,7 +568,7 @@ return Hilo;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -751,7 +751,7 @@ return Class;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -977,7 +977,7 @@ return Matrix;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1132,7 +1132,7 @@ return EventMixin;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1216,7 +1216,7 @@ return Drawable;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1313,7 +1313,7 @@ return Renderer;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1528,7 +1528,7 @@ return CanvasRenderer;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1715,7 +1715,7 @@ return DOMRenderer;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1777,7 +1777,13 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
}
}
return this._isSupported;
- }
+ },
+ /**
+ * WebGL context Options
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
+ * @type {Object}
+ */
+ contextOptions: null
},
renderType:'webgl',
gl:null,
@@ -1786,7 +1792,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
- this.gl = this.canvas.getContext("webgl")||this.canvas.getContext('experimental-webgl');
+ var contextOptions = WebGLRenderer.contextOptions || {};
+ this.gl = this.canvas.getContext("webgl", contextOptions)||this.canvas.getContext('experimental-webgl', contextOptions);
this.maxBatchNum = WebGLRenderer.MAX_BATCH_NUM;
this.positionStride = WebGLRenderer.ATTRIBUTE_NUM * 4;
@@ -2297,7 +2304,7 @@ return WebGLRenderer;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2800,7 +2807,7 @@ return View;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2869,7 +2876,7 @@ return CacheMixin;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3247,7 +3254,7 @@ return Container;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3523,7 +3530,7 @@ return Stage;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3606,7 +3613,7 @@ return Bitmap;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3882,7 +3889,7 @@ return Sprite;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4002,7 +4009,7 @@ return DOMElement;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4017,7 +4024,7 @@ var CacheMixin = require('hilo/view/CacheMixin');
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
@@ -4569,7 +4576,7 @@ return Graphics;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4622,7 +4629,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
@@ -4827,7 +4834,7 @@ return Text;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5016,7 +5023,7 @@ return BitmapText;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5201,7 +5208,7 @@ return Button;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5440,7 +5447,7 @@ return TextureAtlas;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5672,7 +5679,7 @@ return Ticker;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5720,7 +5727,7 @@ if (!fnProto.bind) {
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5861,7 +5868,7 @@ return drag;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6313,7 +6320,7 @@ return Tween;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6585,7 +6592,7 @@ return Ease;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6635,7 +6642,7 @@ return ImageLoader;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6704,7 +6711,7 @@ return ScriptLoader;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6959,7 +6966,7 @@ return LoadQueue;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7166,7 +7173,7 @@ return HTMLAudio;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7487,7 +7494,7 @@ return WebAudio;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7594,7 +7601,7 @@ return WebSound;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7690,7 +7697,7 @@ return Camera;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7880,7 +7887,7 @@ return Camera3d;
});
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 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 e91414cd..b8f93a60 100644
--- a/build/cmd/hilo-cmd.min.js
+++ b/build/cmd/hilo-cmd.min.js
@@ -1,8 +1,8 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 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:"1.3.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,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 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=t.crossOrigin),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 g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.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}},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){h.superclass.constructor.call(this,t);var e=this;this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl"),this.maxBatchNum=h.MAX_BATCH_NUM,this.positionStride=4*h.ATTRIBUTE_NUM;var i=this.maxBatchNum*h.ATTRIBUTE_NUM*4,r=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(r);for(var n=0,a=0;n0)&&(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:null,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>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,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._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,s,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)):h&&(u<0||u>e)&&c.start()}return h?((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,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 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=t.crossOrigin),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 g=t.align;if(g){var _=t.getAlignPosition();c=_.x,u=_.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>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,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._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,s,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)):h&&(u<0||u>e)&&c.start()}return h?((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 fe2ab959..11e076d5 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 611e7079..342819cc 100644
--- a/build/cmd/hilo/core/Class.js
+++ b/build/cmd/hilo/core/Class.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 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 85c94d55..79e3bdf7 100644
--- a/build/cmd/hilo/core/Class.min.js
+++ b/build/cmd/hilo/core/Class.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 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 8d6fea7b..e9d3ca9f 100644
--- a/build/cmd/hilo/core/Hilo.js
+++ b/build/cmd/hilo/core/Hilo.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -30,7 +30,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @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 5ed09175..577530b8 100644
--- a/build/cmd/hilo/core/Hilo.min.js
+++ b/build/cmd/hilo/core/Hilo.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 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:"1.3.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;r0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],T=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*T+u.tx,_[c+5*f+1]=u.b*g+u.d*T+u.ty}t.__textureImage=a,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 a.setElementStyleByView(t);var r=t.scaleX,i=t.scaleY;if(t===this.stage){var n=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=r||o&&o!=r)&&(t._scaleX=r,n.width=r*t.width+"px",c=!0),(!h&&1!=i||h&&h!=i)&&(t._scaleY=i,n.height=i*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new s(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new s(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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 c(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,a=0,n=t.rotation%360,s=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(n){var d=n*o;i=Math.cos(d),a=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=a*c,r.c=-a*_,r.d=i*_,r.tx=u.x-r.a*s-r.c*h,r.ty=u.y-r.b*s-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),c=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return c.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},h});
\ No newline at end of file
+define(function(t,e,r){var i=t("hilo/core/Class"),a=t("hilo/core/Hilo"),n=t("hilo/renderer/Renderer"),s=t("hilo/geom/Matrix"),o=Math.PI/180,h=i.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){h.superclass.constructor.call(this,t);var e=this,r=h.contextOptions||{};this.gl=this.canvas.getContext("webgl",r)||this.canvas.getContext("experimental-webgl",r),this.maxBatchNum=h.MAX_BATCH_NUM,this.positionStride=4*h.ATTRIBUTE_NUM;var i=this.maxBatchNum*h.ATTRIBUTE_NUM*4,a=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(a);for(var n=0,s=0;n0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],x=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*x+u.tx,_[c+5*f+1]=u.b*g+u.d*x+u.ty}t.__textureImage=a,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 a.setElementStyleByView(t);var r=t.scaleX,i=t.scaleY;if(t===this.stage){var n=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=r||o&&o!=r)&&(t._scaleX=r,n.width=r*t.width+"px",c=!0),(!h&&1!=i||h&&h!=i)&&(t._scaleY=i,n.height=i*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new s(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new s(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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 c(this,{v:t,f:e},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(t,e,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,a=0,n=t.rotation%360,s=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(n){var d=n*o;i=Math.cos(d),a=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=a*c,r.c=-a*_,r.d=i*_,r.tx=u.x-r.a*s-r.c*h,r.ty=u.y-r.b*s-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),c=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return c.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},h});
\ No newline at end of file
diff --git a/build/cmd/hilo/tween/Ease.js b/build/cmd/hilo/tween/Ease.js
index 81c927d5..f3374090 100644
--- a/build/cmd/hilo/tween/Ease.js
+++ b/build/cmd/hilo/tween/Ease.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/tween/Ease.min.js b/build/cmd/hilo/tween/Ease.min.js
index 0fb258ac..e0bfb5c9 100644
--- a/build/cmd/hilo/tween/Ease.min.js
+++ b/build/cmd/hilo/tween/Ease.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/tween/Tween.js b/build/cmd/hilo/tween/Tween.js
index 1936d9f0..fe201295 100644
--- a/build/cmd/hilo/tween/Tween.js
+++ b/build/cmd/hilo/tween/Tween.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/tween/Tween.min.js b/build/cmd/hilo/tween/Tween.min.js
index ab50d8cc..a2cecbe9 100644
--- a/build/cmd/hilo/tween/Tween.min.js
+++ b/build/cmd/hilo/tween/Tween.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/TextureAtlas.js b/build/cmd/hilo/util/TextureAtlas.js
index e07d4680..7d69d27b 100644
--- a/build/cmd/hilo/util/TextureAtlas.js
+++ b/build/cmd/hilo/util/TextureAtlas.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/TextureAtlas.min.js b/build/cmd/hilo/util/TextureAtlas.min.js
index 6de54279..ee25abb9 100644
--- a/build/cmd/hilo/util/TextureAtlas.min.js
+++ b/build/cmd/hilo/util/TextureAtlas.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/Ticker.js b/build/cmd/hilo/util/Ticker.js
index 717bd0e4..9c7ee7c8 100644
--- a/build/cmd/hilo/util/Ticker.js
+++ b/build/cmd/hilo/util/Ticker.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/Ticker.min.js b/build/cmd/hilo/util/Ticker.min.js
index d1d4f051..b79eba1a 100644
--- a/build/cmd/hilo/util/Ticker.min.js
+++ b/build/cmd/hilo/util/Ticker.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/browser.js b/build/cmd/hilo/util/browser.js
index 735124ec..75c4f538 100644
--- a/build/cmd/hilo/util/browser.js
+++ b/build/cmd/hilo/util/browser.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/browser.min.js b/build/cmd/hilo/util/browser.min.js
index 8b8fc3d8..8a41c70a 100644
--- a/build/cmd/hilo/util/browser.min.js
+++ b/build/cmd/hilo/util/browser.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/drag.js b/build/cmd/hilo/util/drag.js
index 3e439a5c..43653a36 100644
--- a/build/cmd/hilo/util/drag.js
+++ b/build/cmd/hilo/util/drag.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/drag.min.js b/build/cmd/hilo/util/drag.min.js
index 23a284b2..0183231c 100644
--- a/build/cmd/hilo/util/drag.min.js
+++ b/build/cmd/hilo/util/drag.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/polyfill.js b/build/cmd/hilo/util/polyfill.js
index cc6529a6..f70f2495 100644
--- a/build/cmd/hilo/util/polyfill.js
+++ b/build/cmd/hilo/util/polyfill.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/polyfill.min.js b/build/cmd/hilo/util/polyfill.min.js
index b8623dad..8df7e197 100644
--- a/build/cmd/hilo/util/polyfill.min.js
+++ b/build/cmd/hilo/util/polyfill.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/util.js b/build/cmd/hilo/util/util.js
index ba922061..c9061937 100644
--- a/build/cmd/hilo/util/util.js
+++ b/build/cmd/hilo/util/util.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/util/util.min.js b/build/cmd/hilo/util/util.min.js
index bc7fad4f..bf12b704 100644
--- a/build/cmd/hilo/util/util.min.js
+++ b/build/cmd/hilo/util/util.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Bitmap.js b/build/cmd/hilo/view/Bitmap.js
index 162efe1b..c267f716 100644
--- a/build/cmd/hilo/view/Bitmap.js
+++ b/build/cmd/hilo/view/Bitmap.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Bitmap.min.js b/build/cmd/hilo/view/Bitmap.min.js
index 655b1896..de753753 100644
--- a/build/cmd/hilo/view/Bitmap.min.js
+++ b/build/cmd/hilo/view/Bitmap.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/BitmapText.js b/build/cmd/hilo/view/BitmapText.js
index ce41a6b6..9e5495c7 100644
--- a/build/cmd/hilo/view/BitmapText.js
+++ b/build/cmd/hilo/view/BitmapText.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/BitmapText.min.js b/build/cmd/hilo/view/BitmapText.min.js
index 4c5d9604..d6e207c3 100644
--- a/build/cmd/hilo/view/BitmapText.min.js
+++ b/build/cmd/hilo/view/BitmapText.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Button.js b/build/cmd/hilo/view/Button.js
index 26d050c0..4c595d9d 100644
--- a/build/cmd/hilo/view/Button.js
+++ b/build/cmd/hilo/view/Button.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Button.min.js b/build/cmd/hilo/view/Button.min.js
index e21a1386..ec80877a 100644
--- a/build/cmd/hilo/view/Button.min.js
+++ b/build/cmd/hilo/view/Button.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/CacheMixin.js b/build/cmd/hilo/view/CacheMixin.js
index b4c92415..7302adee 100644
--- a/build/cmd/hilo/view/CacheMixin.js
+++ b/build/cmd/hilo/view/CacheMixin.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/CacheMixin.min.js b/build/cmd/hilo/view/CacheMixin.min.js
index 233db2f8..7fc1ee96 100644
--- a/build/cmd/hilo/view/CacheMixin.min.js
+++ b/build/cmd/hilo/view/CacheMixin.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Container.js b/build/cmd/hilo/view/Container.js
index ae80ab3e..4cd6cc46 100644
--- a/build/cmd/hilo/view/Container.js
+++ b/build/cmd/hilo/view/Container.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Container.min.js b/build/cmd/hilo/view/Container.min.js
index 08ff10e0..610becb5 100644
--- a/build/cmd/hilo/view/Container.min.js
+++ b/build/cmd/hilo/view/Container.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/DOMElement.js b/build/cmd/hilo/view/DOMElement.js
index 445bed72..90d8c9dc 100644
--- a/build/cmd/hilo/view/DOMElement.js
+++ b/build/cmd/hilo/view/DOMElement.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/DOMElement.min.js b/build/cmd/hilo/view/DOMElement.min.js
index a0a4942d..f521fc0a 100644
--- a/build/cmd/hilo/view/DOMElement.min.js
+++ b/build/cmd/hilo/view/DOMElement.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Drawable.js b/build/cmd/hilo/view/Drawable.js
index 70ae86c3..9af7c647 100644
--- a/build/cmd/hilo/view/Drawable.js
+++ b/build/cmd/hilo/view/Drawable.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Drawable.min.js b/build/cmd/hilo/view/Drawable.min.js
index 6c867477..0bd403c7 100644
--- a/build/cmd/hilo/view/Drawable.min.js
+++ b/build/cmd/hilo/view/Drawable.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Graphics.js b/build/cmd/hilo/view/Graphics.js
index 9c6eabfd..bc021800 100644
--- a/build/cmd/hilo/view/Graphics.js
+++ b/build/cmd/hilo/view/Graphics.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -14,7 +14,7 @@ var CacheMixin = require('hilo/view/CacheMixin');
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
diff --git a/build/cmd/hilo/view/Graphics.min.js b/build/cmd/hilo/view/Graphics.min.js
index 531fa2a3..2655ad0d 100644
--- a/build/cmd/hilo/view/Graphics.min.js
+++ b/build/cmd/hilo/view/Graphics.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Sprite.js b/build/cmd/hilo/view/Sprite.js
index 5619676d..ca311cc8 100644
--- a/build/cmd/hilo/view/Sprite.js
+++ b/build/cmd/hilo/view/Sprite.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Sprite.min.js b/build/cmd/hilo/view/Sprite.min.js
index b598c4ee..c88413af 100644
--- a/build/cmd/hilo/view/Sprite.min.js
+++ b/build/cmd/hilo/view/Sprite.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Stage.js b/build/cmd/hilo/view/Stage.js
index 07174186..ad78f869 100644
--- a/build/cmd/hilo/view/Stage.js
+++ b/build/cmd/hilo/view/Stage.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Stage.min.js b/build/cmd/hilo/view/Stage.min.js
index 6c88e525..aec631e7 100644
--- a/build/cmd/hilo/view/Stage.min.js
+++ b/build/cmd/hilo/view/Stage.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/Text.js b/build/cmd/hilo/view/Text.js
index 6e42de5d..4697da49 100644
--- a/build/cmd/hilo/view/Text.js
+++ b/build/cmd/hilo/view/Text.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -52,7 +52,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
diff --git a/build/cmd/hilo/view/Text.min.js b/build/cmd/hilo/view/Text.min.js
index 09b182ea..a8484681 100644
--- a/build/cmd/hilo/view/Text.min.js
+++ b/build/cmd/hilo/view/Text.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
-define(function(t,e,i){var n=t("hilo/core/Class"),o=t("hilo/core/Hilo"),h=t("hilo/view/View"),r=t("hilo/view/CacheMixin"),l=n.create({Extends:h,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||o.getUid("Text"),l.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=l.measureFontHeight(this.font)},text:null,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=l.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,o=n.domElement,h=o.style;h.font=i.font,h.textAlign=i.textAlign,h.color=i.color,h.width=i.width+"px",h.height=i.height+"px",h.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,h,r,l,a=i.split(/\r\n|\r|\n|
/),s=0,c=0,d=e._fontHeight+e.lineSpacing,x=[];for(n=0,r=a.length;ne.maxWidth?(x.push({text:w,y:c}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=h}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,n=o.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(n),e=n.offsetHeight,i.removeChild(n),e}}});return l});
\ No newline at end of file
+define(function(t,e,i){var n=t("hilo/core/Class"),o=t("hilo/core/Hilo"),h=t("hilo/view/View"),r=t("hilo/view/CacheMixin"),l=n.create({Extends:h,Mixes:r,constructor:function(t){t=t||{},this.id=this.id||t.id||o.getUid("Text"),l.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=l.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=l.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,o=n.domElement,h=o.style;h.font=i.font,h.textAlign=i.textAlign,h.color=i.color,h.width=i.width+"px",h.height=i.height+"px",h.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,h,r,l,a=i.split(/\r\n|\r|\n|
/),s=0,c=0,d=e._fontHeight+e.lineSpacing,x=[];for(n=0,r=a.length;ne.maxWidth?(x.push({text:w,y:c}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=h}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,n=o.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(n),e=n.offsetHeight,i.removeChild(n),e}}});return l});
\ No newline at end of file
diff --git a/build/cmd/hilo/view/View.js b/build/cmd/hilo/view/View.js
index 48a427f6..6ab55f25 100644
--- a/build/cmd/hilo/view/View.js
+++ b/build/cmd/hilo/view/View.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/cmd/hilo/view/View.min.js b/build/cmd/hilo/view/View.min.js
index 15902e0a..42bcc8c9 100644
--- a/build/cmd/hilo/view/View.min.js
+++ b/build/cmd/hilo/view/View.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for cmd
+ * Hilo 1.4.0 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/core/Class.js b/build/commonjs/core/Class.js
index e13bc8f3..715292c0 100644
--- a/build/commonjs/core/Class.js
+++ b/build/commonjs/core/Class.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/core/Class.min.js b/build/commonjs/core/Class.min.js
index 5581b16c..22626bb5 100644
--- a/build/commonjs/core/Class.min.js
+++ b/build/commonjs/core/Class.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/core/Hilo.js b/build/commonjs/core/Hilo.js
index 1c93e397..ae8759c1 100644
--- a/build/commonjs/core/Hilo.js
+++ b/build/commonjs/core/Hilo.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -28,7 +28,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @language=en
* Gets a globally unique id. Such as Stage1, Bitmap2 etc.
diff --git a/build/commonjs/core/Hilo.min.js b/build/commonjs/core/Hilo.min.js
index ed44b7f3..c5e08613 100644
--- a/build/commonjs/core/Hilo.min.js
+++ b/build/commonjs/core/Hilo.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
-var browser=require("../util/browser"),util=require("../util/util"),win=window,doc=document,docElem=doc.documentElement,uid=0,hasWarnedDict={},Hilo={version:"1.3.0",getUid:function(e){var t=++uid;if(e){var a=e.charCodeAt(e.length-1);return a>=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;r0)&&(e===this.stage&&this.clear(),!0)},draw:function(e){var t=e.width,r=e.height,i=(e.background,e.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];t||r||(t=e.width=s,r=e.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,t,r),d=this.batchIndex*this.positionStride,_=this.float32Array,c=this.uint32Array,l=(e.tint>>16)+(65280&e.tint)+((255&e.tint)<<16)+(255*e.__webglRenderAlpha<<24);_[d+0]=h[0],_[d+1]=h[1],_[d+2]=h[2],_[d+3]=h[3],c[d+4]=l,_[d+5]=h[4],_[d+6]=h[5],_[d+7]=h[6],_[d+8]=h[7],c[d+9]=l,_[d+10]=h[8],_[d+11]=h[9],_[d+12]=h[10],_[d+13]=h[11],c[d+14]=l,_[d+15]=h[12],_[d+16]=h[13],_[d+17]=h[14],_[d+18]=h[15],c[d+19]=l;for(var u=e.__webglWorldMatrix,f=0;f<4;f++){var g=_[d+5*f],x=_[d+5*f+1];_[d+5*f]=u.a*g+u.c*x+u.tx,_[d+5*f+1]=u.b*g+u.d*x+u.ty}e.__textureImage=a,this.sprites[this.batchIndex++]=e}},endDraw:function(e){e===this.stage&&this._renderBatches()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void Hilo.setElementStyleByView(e);var r=e.scaleX,i=e.scaleY;if(e===this.stage){var a=this.canvas.style,n=e._scaleX,s=e._scaleY,o=!1;(!n&&1!=r||n&&n!=r)&&(e._scaleX=r,a.width=r*e.width+"px",o=!0),(!s&&1!=i||s&&s!=i)&&(e._scaleY=i,a.height=i*e.height+"px",o=!0),o&&e.updateViewport(),e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0)}else e.parent&&(e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0),this._setConcatenatedMatrix(e,e.parent));e.alpha>0&&(e.parent&&e.parent.__webglRenderAlpha?e.__webglRenderAlpha=e.alpha*e.parent.__webglRenderAlpha:e.__webglRenderAlpha=e.alpha)},remove:function(e){var t=e.drawable,r=t&&t.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(e,t,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(e,t){if(this.width!==e||this.height!==t){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=e,this.height=r.height=t,a.width=i.width*i.scaleX+"px",a.height=i.height*i.scaleY+"px",this.gl.viewport(0,0,e,t),this.canvasHalfWidth=.5*e,this.canvasHalfHeight=.5*t,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var e=this.gl;e.bufferSubData(e.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var t=0,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[e])),r.drawElements(r.TRIANGLES,6*i,r.UNSIGNED_SHORT,6*e*2))},_uploadProjectionTransform:function(e){this._projectionTransformElements&&!e||(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 e=" 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 ",t="\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 Shader(this,{v:e,f:t},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(e,t,r,i,a,n,s,o,h){var d=this.__tempVertexs||[],_=e.width,c=e.height;i/=_,a/=c,t/=_,r/=c,o=o,h=h,n=n,s=s,i+t>1&&(i=1-t),a+r>1&&(a=1-r);var l=0;return d[l++]=n,d[l++]=s,d[l++]=t,d[l++]=r,d[l++]=n+o,d[l++]=s,d[l++]=t+i,d[l++]=r,d[l++]=n,d[l++]=s+h,d[l++]=t,d[l++]=r+a,d[l++]=n+o,d[l++]=s+h,d[l++]=t+i,d[l++]=r+a,d},_setConcatenatedMatrix:function(e,t){var r=e.__webglWorldMatrix,i=1,a=0,n=e.rotation%360,s=e.pivotX,o=e.pivotY,h=e.scaleX,d=e.scaleY,_=e.transform;if(_)r.copy(_);else{if(n){var c=n*DEG2RAD;i=Math.cos(c),a=Math.sin(c)}var l=e.getAlignPosition();r.a=i*h,r.b=a*h,r.c=-a*d,r.d=i*d,r.tx=l.x-r.a*s-r.c*o,r.ty=l.y-r.b*s-r.d*o}r.concat(t.__webglWorldMatrix)},_getTexture:function(e){var t=e.__textureImage,r=this._cacheTexture[t.src];return r||(r=this.activeShader.uploadTexture(t)),r}}),Shader=function(e,t,r){this.renderer=e,this.gl=e.gl,this.program=this._createProgram(this.gl,t.v,t.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};Shader.prototype={active:function(){var e=this,t=e.renderer,r=e.gl,i=e.program;i&&r&&(t.activeShader=e,r.useProgram(i),e.attributes.forEach(function(e){t[e]=r.getAttribLocation(i,e),r.enableVertexAttribArray(t[e])}),e.uniforms.forEach(function(e){t[e]=r.getUniformLocation(i,e)}),e.width===t.width&&e.height===t.height||(e.width=t.width,e.height=t.height,t._uploadProjectionTransform()))},uploadTexture:function(e){var t=this.gl,r=this.renderer,i=t.createTexture(),a=r.u_Sampler;return t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.uniform1i(a,0),t.bindTexture(t.TEXTURE_2D,null),this.renderer._cacheTexture[e.src]=i,i},_createProgram:function(e,t,r){var i=this._createShader(e,e.VERTEX_SHADER,t),a=this._createShader(e,e.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=e.createProgram();if(n){e.attachShader(n,i),e.attachShader(n,a),e.linkProgram(n),e.deleteShader(a),e.deleteShader(i);var s=e.getProgramParameter(n,e.LINK_STATUS);if(!s){var o=e.getProgramInfoLog(n);return console.log("Failed to link program: "+o),e.deleteProgram(n),null}}return n},_createShader:function(e,t,r){var i=e.createShader(t);if(i){e.shaderSource(i,r),e.compileShader(i);var a=e.getShaderParameter(i,e.COMPILE_STATUS);if(!a){var n=e.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),e.deleteShader(i),null}}return i}},module.exports=WebGLRenderer;
\ No newline at end of file
+var Class=require("../core/Class"),Hilo=require("../core/Hilo"),Renderer=require("./Renderer"),Matrix=require("../geom/Matrix"),DEG2RAD=Math.PI/180,WebGLRenderer=Class.create({Extends:Renderer,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:function(){if(void 0==this._isSupported){var e=document.createElement("canvas");e.getContext&&(e.getContext("webgl")||e.getContext("experimental-webgl"))?this._isSupported=!0:this._isSupported=!1}return this._isSupported},contextOptions:null},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(e){WebGLRenderer.superclass.constructor.call(this,e);var t=this,r=WebGLRenderer.contextOptions||{};this.gl=this.canvas.getContext("webgl",r)||this.canvas.getContext("experimental-webgl",r),this.maxBatchNum=WebGLRenderer.MAX_BATCH_NUM,this.positionStride=4*WebGLRenderer.ATTRIBUTE_NUM;var i=this.maxBatchNum*WebGLRenderer.ATTRIBUTE_NUM*4,a=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(a);for(var n=0,s=0;n0)&&(e===this.stage&&this.clear(),!0)},draw:function(e){var t=e.width,r=e.height,i=(e.background,e.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];t||r||(t=e.width=s,r=e.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,t,r),d=this.batchIndex*this.positionStride,c=this.float32Array,_=this.uint32Array,l=(e.tint>>16)+(65280&e.tint)+((255&e.tint)<<16)+(255*e.__webglRenderAlpha<<24);c[d+0]=h[0],c[d+1]=h[1],c[d+2]=h[2],c[d+3]=h[3],_[d+4]=l,c[d+5]=h[4],c[d+6]=h[5],c[d+7]=h[6],c[d+8]=h[7],_[d+9]=l,c[d+10]=h[8],c[d+11]=h[9],c[d+12]=h[10],c[d+13]=h[11],_[d+14]=l,c[d+15]=h[12],c[d+16]=h[13],c[d+17]=h[14],c[d+18]=h[15],_[d+19]=l;for(var u=e.__webglWorldMatrix,f=0;f<4;f++){var x=c[d+5*f],g=c[d+5*f+1];c[d+5*f]=u.a*x+u.c*g+u.tx,c[d+5*f+1]=u.b*x+u.d*g+u.ty}e.__textureImage=a,this.sprites[this.batchIndex++]=e}},endDraw:function(e){e===this.stage&&this._renderBatches()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void Hilo.setElementStyleByView(e);var r=e.scaleX,i=e.scaleY;if(e===this.stage){var a=this.canvas.style,n=e._scaleX,s=e._scaleY,o=!1;(!n&&1!=r||n&&n!=r)&&(e._scaleX=r,a.width=r*e.width+"px",o=!0),(!s&&1!=i||s&&s!=i)&&(e._scaleY=i,a.height=i*e.height+"px",o=!0),o&&e.updateViewport(),e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0)}else e.parent&&(e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0),this._setConcatenatedMatrix(e,e.parent));e.alpha>0&&(e.parent&&e.parent.__webglRenderAlpha?e.__webglRenderAlpha=e.alpha*e.parent.__webglRenderAlpha:e.__webglRenderAlpha=e.alpha)},remove:function(e){var t=e.drawable,r=t&&t.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(e,t,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(e,t){if(this.width!==e||this.height!==t){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=e,this.height=r.height=t,a.width=i.width*i.scaleX+"px",a.height=i.height*i.scaleY+"px",this.gl.viewport(0,0,e,t),this.canvasHalfWidth=.5*e,this.canvasHalfHeight=.5*t,this._uploadProjectionTransform(!0)}},_renderBatches:function(){var e=this.gl;e.bufferSubData(e.ARRAY_BUFFER,0,this.uint32Array.subarray(0,this.batchIndex*this.positionStride));for(var t=0,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[e])),r.drawElements(r.TRIANGLES,6*i,r.UNSIGNED_SHORT,6*e*2))},_uploadProjectionTransform:function(e){this._projectionTransformElements&&!e||(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 e=" 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 ",t="\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 Shader(this,{v:e,f:t},{attributes:["a_position","a_TexCoord","a_tint"],uniforms:["u_projectionTransform","u_Sampler"]})},_createVertexs:function(e,t,r,i,a,n,s,o,h){var d=this.__tempVertexs||[],c=e.width,_=e.height;i/=c,a/=_,t/=c,r/=_,o=o,h=h,n=n,s=s,i+t>1&&(i=1-t),a+r>1&&(a=1-r);var l=0;return d[l++]=n,d[l++]=s,d[l++]=t,d[l++]=r,d[l++]=n+o,d[l++]=s,d[l++]=t+i,d[l++]=r,d[l++]=n,d[l++]=s+h,d[l++]=t,d[l++]=r+a,d[l++]=n+o,d[l++]=s+h,d[l++]=t+i,d[l++]=r+a,d},_setConcatenatedMatrix:function(e,t){var r=e.__webglWorldMatrix,i=1,a=0,n=e.rotation%360,s=e.pivotX,o=e.pivotY,h=e.scaleX,d=e.scaleY,c=e.transform;if(c)r.copy(c);else{if(n){var _=n*DEG2RAD;i=Math.cos(_),a=Math.sin(_)}var l=e.getAlignPosition();r.a=i*h,r.b=a*h,r.c=-a*d,r.d=i*d,r.tx=l.x-r.a*s-r.c*o,r.ty=l.y-r.b*s-r.d*o}r.concat(t.__webglWorldMatrix)},_getTexture:function(e){var t=e.__textureImage,r=this._cacheTexture[t.src];return r||(r=this.activeShader.uploadTexture(t)),r}}),Shader=function(e,t,r){this.renderer=e,this.gl=e.gl,this.program=this._createProgram(this.gl,t.v,t.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};Shader.prototype={active:function(){var e=this,t=e.renderer,r=e.gl,i=e.program;i&&r&&(t.activeShader=e,r.useProgram(i),e.attributes.forEach(function(e){t[e]=r.getAttribLocation(i,e),r.enableVertexAttribArray(t[e])}),e.uniforms.forEach(function(e){t[e]=r.getUniformLocation(i,e)}),e.width===t.width&&e.height===t.height||(e.width=t.width,e.height=t.height,t._uploadProjectionTransform()))},uploadTexture:function(e){var t=this.gl,r=this.renderer,i=t.createTexture(),a=r.u_Sampler;return t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.uniform1i(a,0),t.bindTexture(t.TEXTURE_2D,null),this.renderer._cacheTexture[e.src]=i,i},_createProgram:function(e,t,r){var i=this._createShader(e,e.VERTEX_SHADER,t),a=this._createShader(e,e.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=e.createProgram();if(n){e.attachShader(n,i),e.attachShader(n,a),e.linkProgram(n),e.deleteShader(a),e.deleteShader(i);var s=e.getProgramParameter(n,e.LINK_STATUS);if(!s){var o=e.getProgramInfoLog(n);return console.log("Failed to link program: "+o),e.deleteProgram(n),null}}return n},_createShader:function(e,t,r){var i=e.createShader(t);if(i){e.shaderSource(i,r),e.compileShader(i);var a=e.getShaderParameter(i,e.COMPILE_STATUS);if(!a){var n=e.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),e.deleteShader(i),null}}return i}},module.exports=WebGLRenderer;
\ No newline at end of file
diff --git a/build/commonjs/tween/Ease.js b/build/commonjs/tween/Ease.js
index bc0aeb30..1efe1a6c 100644
--- a/build/commonjs/tween/Ease.js
+++ b/build/commonjs/tween/Ease.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/tween/Ease.min.js b/build/commonjs/tween/Ease.min.js
index 597d8a2e..30cac976 100644
--- a/build/commonjs/tween/Ease.min.js
+++ b/build/commonjs/tween/Ease.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/tween/Tween.js b/build/commonjs/tween/Tween.js
index 189869de..bffea20d 100644
--- a/build/commonjs/tween/Tween.js
+++ b/build/commonjs/tween/Tween.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/tween/Tween.min.js b/build/commonjs/tween/Tween.min.js
index 12ea7f84..294721d5 100644
--- a/build/commonjs/tween/Tween.min.js
+++ b/build/commonjs/tween/Tween.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/TextureAtlas.js b/build/commonjs/util/TextureAtlas.js
index 51e99197..c91b288f 100644
--- a/build/commonjs/util/TextureAtlas.js
+++ b/build/commonjs/util/TextureAtlas.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/TextureAtlas.min.js b/build/commonjs/util/TextureAtlas.min.js
index 8ccdb3fa..433e1352 100644
--- a/build/commonjs/util/TextureAtlas.min.js
+++ b/build/commonjs/util/TextureAtlas.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/Ticker.js b/build/commonjs/util/Ticker.js
index fb3fca6a..d102e8bf 100644
--- a/build/commonjs/util/Ticker.js
+++ b/build/commonjs/util/Ticker.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/Ticker.min.js b/build/commonjs/util/Ticker.min.js
index 8ff6f7f3..f8452252 100644
--- a/build/commonjs/util/Ticker.min.js
+++ b/build/commonjs/util/Ticker.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/browser.js b/build/commonjs/util/browser.js
index 3141d7d3..d27c1a83 100644
--- a/build/commonjs/util/browser.js
+++ b/build/commonjs/util/browser.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/browser.min.js b/build/commonjs/util/browser.min.js
index 11c42d29..3e92feb1 100644
--- a/build/commonjs/util/browser.min.js
+++ b/build/commonjs/util/browser.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/drag.js b/build/commonjs/util/drag.js
index ad453a40..12b1a9d9 100644
--- a/build/commonjs/util/drag.js
+++ b/build/commonjs/util/drag.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/drag.min.js b/build/commonjs/util/drag.min.js
index 020d0fd5..962b5f30 100644
--- a/build/commonjs/util/drag.min.js
+++ b/build/commonjs/util/drag.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/polyfill.js b/build/commonjs/util/polyfill.js
index bcc4dbec..37222b4e 100644
--- a/build/commonjs/util/polyfill.js
+++ b/build/commonjs/util/polyfill.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/polyfill.min.js b/build/commonjs/util/polyfill.min.js
index ddc13af6..f1845955 100644
--- a/build/commonjs/util/polyfill.min.js
+++ b/build/commonjs/util/polyfill.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/util.js b/build/commonjs/util/util.js
index f15522e4..80b42cd1 100644
--- a/build/commonjs/util/util.js
+++ b/build/commonjs/util/util.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/util/util.min.js b/build/commonjs/util/util.min.js
index b724ffd0..e404c5bd 100644
--- a/build/commonjs/util/util.min.js
+++ b/build/commonjs/util/util.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Bitmap.js b/build/commonjs/view/Bitmap.js
index b23c92be..efd4f598 100644
--- a/build/commonjs/view/Bitmap.js
+++ b/build/commonjs/view/Bitmap.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Bitmap.min.js b/build/commonjs/view/Bitmap.min.js
index 3cb08a0f..54fb808d 100644
--- a/build/commonjs/view/Bitmap.min.js
+++ b/build/commonjs/view/Bitmap.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/BitmapText.js b/build/commonjs/view/BitmapText.js
index 093a9cf8..138ae7ad 100644
--- a/build/commonjs/view/BitmapText.js
+++ b/build/commonjs/view/BitmapText.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/BitmapText.min.js b/build/commonjs/view/BitmapText.min.js
index c0ebdd75..045b3eb3 100644
--- a/build/commonjs/view/BitmapText.min.js
+++ b/build/commonjs/view/BitmapText.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Button.js b/build/commonjs/view/Button.js
index f6d9eb90..06b5a7e6 100644
--- a/build/commonjs/view/Button.js
+++ b/build/commonjs/view/Button.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Button.min.js b/build/commonjs/view/Button.min.js
index 445aeb48..240f603e 100644
--- a/build/commonjs/view/Button.min.js
+++ b/build/commonjs/view/Button.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/CacheMixin.js b/build/commonjs/view/CacheMixin.js
index 4272d09c..0feb1be3 100644
--- a/build/commonjs/view/CacheMixin.js
+++ b/build/commonjs/view/CacheMixin.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/CacheMixin.min.js b/build/commonjs/view/CacheMixin.min.js
index 30860217..1351393d 100644
--- a/build/commonjs/view/CacheMixin.min.js
+++ b/build/commonjs/view/CacheMixin.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Container.js b/build/commonjs/view/Container.js
index c83d3ef4..ba94e7ab 100644
--- a/build/commonjs/view/Container.js
+++ b/build/commonjs/view/Container.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Container.min.js b/build/commonjs/view/Container.min.js
index e182afb6..9c8477ec 100644
--- a/build/commonjs/view/Container.min.js
+++ b/build/commonjs/view/Container.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/DOMElement.js b/build/commonjs/view/DOMElement.js
index fa07229a..06d76762 100644
--- a/build/commonjs/view/DOMElement.js
+++ b/build/commonjs/view/DOMElement.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/DOMElement.min.js b/build/commonjs/view/DOMElement.min.js
index 9f6d6c16..206e28bc 100644
--- a/build/commonjs/view/DOMElement.min.js
+++ b/build/commonjs/view/DOMElement.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Drawable.js b/build/commonjs/view/Drawable.js
index cba36c8b..63777aa4 100644
--- a/build/commonjs/view/Drawable.js
+++ b/build/commonjs/view/Drawable.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Drawable.min.js b/build/commonjs/view/Drawable.min.js
index 4b03d66d..0cb815f2 100644
--- a/build/commonjs/view/Drawable.min.js
+++ b/build/commonjs/view/Drawable.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Graphics.js b/build/commonjs/view/Graphics.js
index d25e441f..903d30a5 100644
--- a/build/commonjs/view/Graphics.js
+++ b/build/commonjs/view/Graphics.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -12,7 +12,7 @@ var CacheMixin = require('./CacheMixin');
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
diff --git a/build/commonjs/view/Graphics.min.js b/build/commonjs/view/Graphics.min.js
index c184d9d7..0be513eb 100644
--- a/build/commonjs/view/Graphics.min.js
+++ b/build/commonjs/view/Graphics.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Sprite.js b/build/commonjs/view/Sprite.js
index d4ec9892..ecbee03d 100644
--- a/build/commonjs/view/Sprite.js
+++ b/build/commonjs/view/Sprite.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Sprite.min.js b/build/commonjs/view/Sprite.min.js
index 59eb2d64..553b4826 100644
--- a/build/commonjs/view/Sprite.min.js
+++ b/build/commonjs/view/Sprite.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Stage.js b/build/commonjs/view/Stage.js
index afcfa12b..b81b488c 100644
--- a/build/commonjs/view/Stage.js
+++ b/build/commonjs/view/Stage.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Stage.min.js b/build/commonjs/view/Stage.min.js
index 1f2d5d89..11eba98d 100644
--- a/build/commonjs/view/Stage.min.js
+++ b/build/commonjs/view/Stage.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/Text.js b/build/commonjs/view/Text.js
index aad19441..78f10aa3 100644
--- a/build/commonjs/view/Text.js
+++ b/build/commonjs/view/Text.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -50,7 +50,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
diff --git a/build/commonjs/view/Text.min.js b/build/commonjs/view/Text.min.js
index 5ecd8c3e..a84e17f2 100644
--- a/build/commonjs/view/Text.min.js
+++ b/build/commonjs/view/Text.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
-var Class=require("../core/Class"),Hilo=require("../core/Hilo"),View=require("./View"),CacheMixin=require("./CacheMixin"),Text=Class.create({Extends:View,Mixes:CacheMixin,constructor:function(t){t=t||{},this.id=this.id||t.id||Hilo.getUid("Text"),Text.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=Text.measureFontHeight(this.font)},text:null,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=Text.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,l=r.style;l.font=i.font,l.textAlign=i.textAlign,l.color=i.color,l.width=i.width+"px",l.height=i.height+"px",l.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,l,o,h,a=i.split(/\r\n|\r|\n|
/),s=0,x=0,c=e._fontHeight+e.lineSpacing,d=[];for(n=0,o=a.length;ne.maxWidth?(d.push({text:w,y:x}),s>1;break;case"bottom":p=e.height-e.textHeight}var H=e.background;for(H&&(t.fillStyle=H,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=l}n.outline?t.strokeText(e,r,i):t.fillText(e,r,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,n=Hilo.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(n),e=n.offsetHeight,i.removeChild(n),e}}});module.exports=Text;
\ No newline at end of file
+var Class=require("../core/Class"),Hilo=require("../core/Hilo"),View=require("./View"),CacheMixin=require("./CacheMixin"),Text=Class.create({Extends:View,Mixes:CacheMixin,constructor:function(t){t=t||{},this.id=this.id||t.id||Hilo.getUid("Text"),Text.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=Text.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=Text.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,o=r.style;o.font=i.font,o.textAlign=i.textAlign,o.color=i.color,o.width=i.width+"px",o.height=i.height+"px",o.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,o,l,h,a=i.split(/\r\n|\r|\n|
/),s=0,x=0,c=e._fontHeight+e.lineSpacing,d=[];for(n=0,l=a.length;ne.maxWidth?(d.push({text:w,y:x}),s>1;break;case"bottom":p=e.height-e.textHeight}var H=e.background;for(H&&(t.fillStyle=H,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=o}n.outline?t.strokeText(e,r,i):t.fillText(e,r,i)},Statics:{measureFontHeight:function(t){var e,i=document.documentElement,n=Hilo.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return i.appendChild(n),e=n.offsetHeight,i.removeChild(n),e}}});module.exports=Text;
\ No newline at end of file
diff --git a/build/commonjs/view/View.js b/build/commonjs/view/View.js
index 8427096d..2e789c4e 100644
--- a/build/commonjs/view/View.js
+++ b/build/commonjs/view/View.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/commonjs/view/View.min.js b/build/commonjs/view/View.min.js
index 47759a46..3ff4ca4e 100644
--- a/build/commonjs/view/View.min.js
+++ b/build/commonjs/view/View.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for commonjs
+ * Hilo 1.4.0 for commonjs
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/dragonbones/dragonbones.js b/build/dragonbones/dragonbones.js
index c0027fad..d0857d23 100644
--- a/build/dragonbones/dragonbones.js
+++ b/build/dragonbones/dragonbones.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for dragonbones
+ * Hilo 1.4.0 for dragonbones
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/dragonbones/dragonbones.min.js b/build/dragonbones/dragonbones.min.js
index 0de49ab4..b6e1f010 100644
--- a/build/dragonbones/dragonbones.min.js
+++ b/build/dragonbones/dragonbones.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for dragonbones
+ * Hilo 1.4.0 for dragonbones
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/flash/hilo-flash.js b/build/flash/hilo-flash.js
index c082d754..612d08fe 100644
--- a/build/flash/hilo-flash.js
+++ b/build/flash/hilo-flash.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for flashAdaptor
+ * Hilo 1.4.0 for flashAdaptor
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/flash/hilo-flash.min.js b/build/flash/hilo-flash.min.js
index 7909b81e..b32cc13c 100644
--- a/build/flash/hilo-flash.min.js
+++ b/build/flash/hilo-flash.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for flashAdaptor
+ * Hilo 1.4.0 for flashAdaptor
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo-kissy.js b/build/kissy/hilo-kissy.js
index 519834f4..71d95632 100644
--- a/build/kissy/hilo-kissy.js
+++ b/build/kissy/hilo-kissy.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -192,7 +192,7 @@ return browser;
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -229,7 +229,7 @@ return util;
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -257,7 +257,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @language=en
* Gets a globally unique id. Such as Stage1, Bitmap2 etc.
@@ -567,7 +567,7 @@ return Hilo;
requires: ['hilo/util/browser', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -750,7 +750,7 @@ return Class;
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -976,7 +976,7 @@ return Matrix;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1131,7 +1131,7 @@ return EventMixin;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1214,7 +1214,7 @@ return Drawable;
requires: ['hilo/core/Class', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1310,7 +1310,7 @@ return Renderer;
requires: ['hilo/core/Class', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1523,7 +1523,7 @@ return CanvasRenderer;
requires: ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/renderer/Renderer']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1707,7 +1707,7 @@ return DOMRenderer;
requires: ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/renderer/Renderer', 'hilo/view/Drawable']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1764,7 +1764,13 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
}
}
return this._isSupported;
- }
+ },
+ /**
+ * WebGL context Options
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
+ * @type {Object}
+ */
+ contextOptions: null
},
renderType:'webgl',
gl:null,
@@ -1773,7 +1779,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
- this.gl = this.canvas.getContext("webgl")||this.canvas.getContext('experimental-webgl');
+ var contextOptions = WebGLRenderer.contextOptions || {};
+ this.gl = this.canvas.getContext("webgl", contextOptions)||this.canvas.getContext('experimental-webgl', contextOptions);
this.maxBatchNum = WebGLRenderer.MAX_BATCH_NUM;
this.positionStride = WebGLRenderer.ATTRIBUTE_NUM * 4;
@@ -2286,7 +2293,7 @@ return WebGLRenderer;
requires: ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/renderer/Renderer', 'hilo/geom/Matrix']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2785,7 +2792,7 @@ return View;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/event/EventMixin', 'hilo/geom/Matrix', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2853,7 +2860,7 @@ return CacheMixin;
requires: ['hilo/view/Drawable', 'hilo/util/browser']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3229,7 +3236,7 @@ return Container;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3498,7 +3505,7 @@ return Stage;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/Container', 'hilo/renderer/CanvasRenderer', 'hilo/renderer/DOMRenderer', 'hilo/renderer/WebGLRenderer', 'hilo/util/browser', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3578,7 +3585,7 @@ return Bitmap;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3851,7 +3858,7 @@ return Sprite;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3968,7 +3975,7 @@ return DOMElement;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3978,7 +3985,7 @@ KISSY.add('hilo/view/Graphics', function(S, Hilo, Class, View, CacheMixin){
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
@@ -4532,7 +4539,7 @@ return Graphics;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/CacheMixin']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4580,7 +4587,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
@@ -4787,7 +4794,7 @@ return Text;
requires: ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/view/View', 'hilo/view/CacheMixin']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -4973,7 +4980,7 @@ return BitmapText;
requires: ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/view/Container', 'hilo/view/Bitmap']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5154,7 +5161,7 @@ return Button;
requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5393,7 +5400,7 @@ return TextureAtlas;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5624,7 +5631,7 @@ return Ticker;
requires: ['hilo/core/Class', 'hilo/util/browser']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5672,7 +5679,7 @@ if (!fnProto.bind) {
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -5813,7 +5820,7 @@ return drag;
requires: ['hilo/core/Hilo']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6265,7 +6272,7 @@ return Tween;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6537,7 +6544,7 @@ return Ease;
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6587,7 +6594,7 @@ return ImageLoader;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6656,7 +6663,7 @@ return ScriptLoader;
requires: ['hilo/core/Class']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -6908,7 +6915,7 @@ return LoadQueue;
requires: ['hilo/core/Class', 'hilo/event/EventMixin', 'hilo/loader/ImageLoader', 'hilo/loader/ScriptLoader']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7113,7 +7120,7 @@ return HTMLAudio;
requires: ['hilo/core/Class', 'hilo/util/util', 'hilo/event/EventMixin']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7432,7 +7439,7 @@ return WebAudio;
requires: ['hilo/core/Class', 'hilo/util/util', 'hilo/event/EventMixin']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7537,7 +7544,7 @@ return WebSound;
requires: ['hilo/media/HTMLAudio', 'hilo/media/WebAudio', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7632,7 +7639,7 @@ return Camera;
requires: ['hilo/core/Class', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -7821,7 +7828,7 @@ return Camera3d;
requires: ['hilo/core/Class', 'hilo/util/util']
});
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 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 412c2bd5..84d1c21b 100644
--- a/build/kissy/hilo-kissy.min.js
+++ b/build/kissy/hilo-kissy.min.js
@@ -1,8 +1,8 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 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:"1.3.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=t.crossOrigin),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}},renderType:"webgl",gl:null,_isContextLost:!1,_cacheTexture:{},constructor:function(t){o.superclass.constructor.call(this,t);var e=this;this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl"),this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var i=this.maxBatchNum*o.ATTRIBUTE_NUM*4,r=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(r);for(var n=0,a=0;n0)&&(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:null,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._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,s,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)):h&&(u<0||u>e)&&c.start()}return h?((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=t.crossOrigin),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._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,s,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)):h&&(u<0||u>e)&&c.start()}return h?((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 0e5585d2..c3c75519 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 50b11b43..25d6fb20 100644
--- a/build/kissy/hilo/core/Class.js
+++ b/build/kissy/hilo/core/Class.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 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 883e7b9c..37a38914 100644
--- a/build/kissy/hilo/core/Class.min.js
+++ b/build/kissy/hilo/core/Class.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 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 e53d3a95..43dbf4ed 100644
--- a/build/kissy/hilo/core/Hilo.js
+++ b/build/kissy/hilo/core/Hilo.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -27,7 +27,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @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 37c5206f..5fdf10f9 100644
--- a/build/kissy/hilo/core/Hilo.min.js
+++ b/build/kissy/hilo/core/Hilo.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 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:"1.3.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;r0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],T=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*T+u.tx,_[c+5*f+1]=u.b*g+u.d*T+u.ty}t.__textureImage=a,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 r.setElementStyleByView(t);var i=t.scaleX,n=t.scaleY;if(t===this.stage){var s=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=i||o&&o!=i)&&(t._scaleX=i,s.width=i*t.width+"px",c=!0),(!h&&1!=n||h&&h!=n)&&(t._scaleY=n,s.height=n*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new a(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new a(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,a=0,s=t.rotation%360,o=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(s){var d=s*n;i=Math.cos(d),a=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=a*c,r.c=-a*_,r.d=i*_,r.tx=u.x-r.a*o-r.c*h,r.ty=u.y-r.b*o-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),o=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return o.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},s},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"]});
\ No newline at end of file
+KISSY.add("hilo/renderer/WebGLRenderer",function(t,e,r,i,a){var n=Math.PI/180,s=e.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){s.superclass.constructor.call(this,t);var e=this,r=s.contextOptions||{};this.gl=this.canvas.getContext("webgl",r)||this.canvas.getContext("experimental-webgl",r),this.maxBatchNum=s.MAX_BATCH_NUM,this.positionStride=4*s.ATTRIBUTE_NUM;var i=this.maxBatchNum*s.ATTRIBUTE_NUM*4,a=6*this.maxBatchNum;this.arrayBuffer=new ArrayBuffer(4*i),this.float32Array=new Float32Array(this.arrayBuffer),this.uint32Array=new Uint32Array(this.arrayBuffer),this.indexs=new Uint16Array(a);for(var n=0,o=0;n0)&&(t===this.stage&&this.clear(),!0)},draw:function(t){var e=t.width,r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){var n=i.rect,s=n[2],o=n[3];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),c=this.batchIndex*this.positionStride,_=this.float32Array,l=this.uint32Array,d=(t.tint>>16)+(65280&t.tint)+((255&t.tint)<<16)+(255*t.__webglRenderAlpha<<24);_[c+0]=h[0],_[c+1]=h[1],_[c+2]=h[2],_[c+3]=h[3],l[c+4]=d,_[c+5]=h[4],_[c+6]=h[5],_[c+7]=h[6],_[c+8]=h[7],l[c+9]=d,_[c+10]=h[8],_[c+11]=h[9],_[c+12]=h[10],_[c+13]=h[11],l[c+14]=d,_[c+15]=h[12],_[c+16]=h[13],_[c+17]=h[14],_[c+18]=h[15],l[c+19]=d;for(var u=t.__webglWorldMatrix,f=0;f<4;f++){var g=_[c+5*f],x=_[c+5*f+1];_[c+5*f]=u.a*g+u.c*x+u.tx,_[c+5*f+1]=u.b*g+u.d*x+u.ty}t.__textureImage=a,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 r.setElementStyleByView(t);var i=t.scaleX,n=t.scaleY;if(t===this.stage){var s=this.canvas.style,o=t._scaleX,h=t._scaleY,c=!1;(!o&&1!=i||o&&o!=i)&&(t._scaleX=i,s.width=i*t.width+"px",c=!0),(!h&&1!=n||h&&h!=n)&&(t._scaleY=n,s.height=n*t.height+"px",c=!0),c&&t.updateViewport(),t.__webglWorldMatrix=t.__webglWorldMatrix||new a(1,0,0,1,0,0)}else t.parent&&(t.__webglWorldMatrix=t.__webglWorldMatrix||new a(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,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){if(this.width!==t||this.height!==e){var r=this.canvas,i=this.stage,a=r.style;this.width=r.width=t,this.height=r.height=e,a.width=i.width*i.scaleX+"px",a.height=i.height*i.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,r=0,i=null,a=0;a0&&(r.bindTexture(r.TEXTURE_2D,this._getTexture(this.sprites[t])),r.drawElements(r.TRIANGLES,6*i,r.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,r,i,a,n,s,o,h){var c=this.__tempVertexs||[],_=t.width,l=t.height;i/=_,a/=l,e/=_,r/=l,o=o,h=h,n=n,s=s,i+e>1&&(i=1-e),a+r>1&&(a=1-r);var d=0;return c[d++]=n,c[d++]=s,c[d++]=e,c[d++]=r,c[d++]=n+o,c[d++]=s,c[d++]=e+i,c[d++]=r,c[d++]=n,c[d++]=s+h,c[d++]=e,c[d++]=r+a,c[d++]=n+o,c[d++]=s+h,c[d++]=e+i,c[d++]=r+a,c},_setConcatenatedMatrix:function(t,e){var r=t.__webglWorldMatrix,i=1,a=0,s=t.rotation%360,o=t.pivotX,h=t.pivotY,c=t.scaleX,_=t.scaleY,l=t.transform;if(l)r.copy(l);else{if(s){var d=s*n;i=Math.cos(d),a=Math.sin(d)}var u=t.getAlignPosition();r.a=i*c,r.b=a*c,r.c=-a*_,r.d=i*_,r.tx=u.x-r.a*o-r.c*h,r.ty=u.y-r.b*o-r.d*h}r.concat(e.__webglWorldMatrix)},_getTexture:function(t){var e=t.__textureImage,r=this._cacheTexture[e.src];return r||(r=this.activeShader.uploadTexture(e)),r}}),o=function(t,e,r){this.renderer=t,this.gl=t.gl,this.program=this._createProgram(this.gl,e.v,e.f),r=r||{},this.attributes=r.attributes||[],this.uniforms=r.uniforms||[]};return o.prototype={active:function(){var t=this,e=t.renderer,r=t.gl,i=t.program;i&&r&&(e.activeShader=t,r.useProgram(i),t.attributes.forEach(function(t){e[t]=r.getAttribLocation(i,t),r.enableVertexAttribArray(e[t])}),t.uniforms.forEach(function(t){e[t]=r.getUniformLocation(i,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,r=this.renderer,i=e.createTexture(),a=r.u_Sampler;return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i),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(a,0),e.bindTexture(e.TEXTURE_2D,null),this.renderer._cacheTexture[t.src]=i,i},_createProgram:function(t,e,r){var i=this._createShader(t,t.VERTEX_SHADER,e),a=this._createShader(t,t.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=t.createProgram();if(n){t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),t.deleteShader(a),t.deleteShader(i);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var o=t.getProgramInfoLog(n);return console.log("Failed to link program: "+o),t.deleteProgram(n),null}}return n},_createShader:function(t,e,r){var i=t.createShader(e);if(i){t.shaderSource(i,r),t.compileShader(i);var a=t.getShaderParameter(i,t.COMPILE_STATUS);if(!a){var n=t.getShaderInfoLog(i);return console.log("Failed to compile shader: "+n),t.deleteShader(i),null}}return i}},s},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer","hilo/geom/Matrix"]});
\ No newline at end of file
diff --git a/build/kissy/hilo/tween/Ease.js b/build/kissy/hilo/tween/Ease.js
index 44c6550f..0b53ff2c 100644
--- a/build/kissy/hilo/tween/Ease.js
+++ b/build/kissy/hilo/tween/Ease.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/tween/Ease.min.js b/build/kissy/hilo/tween/Ease.min.js
index a3d521e5..aae6e90c 100644
--- a/build/kissy/hilo/tween/Ease.min.js
+++ b/build/kissy/hilo/tween/Ease.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/tween/Tween.js b/build/kissy/hilo/tween/Tween.js
index 86b507db..4fd80696 100644
--- a/build/kissy/hilo/tween/Tween.js
+++ b/build/kissy/hilo/tween/Tween.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/tween/Tween.min.js b/build/kissy/hilo/tween/Tween.min.js
index 3b7f7a75..e4f674e5 100644
--- a/build/kissy/hilo/tween/Tween.min.js
+++ b/build/kissy/hilo/tween/Tween.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/TextureAtlas.js b/build/kissy/hilo/util/TextureAtlas.js
index 868b80c0..a7589d6e 100644
--- a/build/kissy/hilo/util/TextureAtlas.js
+++ b/build/kissy/hilo/util/TextureAtlas.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/TextureAtlas.min.js b/build/kissy/hilo/util/TextureAtlas.min.js
index bb84ce5d..b0850aba 100644
--- a/build/kissy/hilo/util/TextureAtlas.min.js
+++ b/build/kissy/hilo/util/TextureAtlas.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/Ticker.js b/build/kissy/hilo/util/Ticker.js
index b49b36a2..7b792266 100644
--- a/build/kissy/hilo/util/Ticker.js
+++ b/build/kissy/hilo/util/Ticker.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/Ticker.min.js b/build/kissy/hilo/util/Ticker.min.js
index 46fc1cbf..7099dca1 100644
--- a/build/kissy/hilo/util/Ticker.min.js
+++ b/build/kissy/hilo/util/Ticker.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/browser.js b/build/kissy/hilo/util/browser.js
index e672cdb5..a6e333af 100644
--- a/build/kissy/hilo/util/browser.js
+++ b/build/kissy/hilo/util/browser.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/browser.min.js b/build/kissy/hilo/util/browser.min.js
index 73d1ce41..95a93335 100644
--- a/build/kissy/hilo/util/browser.min.js
+++ b/build/kissy/hilo/util/browser.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/drag.js b/build/kissy/hilo/util/drag.js
index 80af7e20..399b0fd2 100644
--- a/build/kissy/hilo/util/drag.js
+++ b/build/kissy/hilo/util/drag.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/drag.min.js b/build/kissy/hilo/util/drag.min.js
index 1b1aa1ad..7f5c4cd6 100644
--- a/build/kissy/hilo/util/drag.min.js
+++ b/build/kissy/hilo/util/drag.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/polyfill.js b/build/kissy/hilo/util/polyfill.js
index da592488..fab724e4 100644
--- a/build/kissy/hilo/util/polyfill.js
+++ b/build/kissy/hilo/util/polyfill.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/polyfill.min.js b/build/kissy/hilo/util/polyfill.min.js
index d30070d7..f3cb8339 100644
--- a/build/kissy/hilo/util/polyfill.min.js
+++ b/build/kissy/hilo/util/polyfill.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/util.js b/build/kissy/hilo/util/util.js
index c1b62241..ed6159e8 100644
--- a/build/kissy/hilo/util/util.js
+++ b/build/kissy/hilo/util/util.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/util/util.min.js b/build/kissy/hilo/util/util.min.js
index c9aec06f..3a7a1bb1 100644
--- a/build/kissy/hilo/util/util.min.js
+++ b/build/kissy/hilo/util/util.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Bitmap.js b/build/kissy/hilo/view/Bitmap.js
index c090e715..7ed6285b 100644
--- a/build/kissy/hilo/view/Bitmap.js
+++ b/build/kissy/hilo/view/Bitmap.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Bitmap.min.js b/build/kissy/hilo/view/Bitmap.min.js
index 5db9fdeb..9d0f223d 100644
--- a/build/kissy/hilo/view/Bitmap.min.js
+++ b/build/kissy/hilo/view/Bitmap.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/BitmapText.js b/build/kissy/hilo/view/BitmapText.js
index deb03359..7bec0adc 100644
--- a/build/kissy/hilo/view/BitmapText.js
+++ b/build/kissy/hilo/view/BitmapText.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/BitmapText.min.js b/build/kissy/hilo/view/BitmapText.min.js
index 12251bc9..687e8f2b 100644
--- a/build/kissy/hilo/view/BitmapText.min.js
+++ b/build/kissy/hilo/view/BitmapText.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Button.js b/build/kissy/hilo/view/Button.js
index e062561f..384e2680 100644
--- a/build/kissy/hilo/view/Button.js
+++ b/build/kissy/hilo/view/Button.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Button.min.js b/build/kissy/hilo/view/Button.min.js
index 3a5fb7d2..a810b157 100644
--- a/build/kissy/hilo/view/Button.min.js
+++ b/build/kissy/hilo/view/Button.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/CacheMixin.js b/build/kissy/hilo/view/CacheMixin.js
index 240847b8..f5fb07c3 100644
--- a/build/kissy/hilo/view/CacheMixin.js
+++ b/build/kissy/hilo/view/CacheMixin.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/CacheMixin.min.js b/build/kissy/hilo/view/CacheMixin.min.js
index 531f43d4..4bc52958 100644
--- a/build/kissy/hilo/view/CacheMixin.min.js
+++ b/build/kissy/hilo/view/CacheMixin.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Container.js b/build/kissy/hilo/view/Container.js
index 2afc447a..396fbd19 100644
--- a/build/kissy/hilo/view/Container.js
+++ b/build/kissy/hilo/view/Container.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Container.min.js b/build/kissy/hilo/view/Container.min.js
index 79e3ae2d..8517feca 100644
--- a/build/kissy/hilo/view/Container.min.js
+++ b/build/kissy/hilo/view/Container.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/DOMElement.js b/build/kissy/hilo/view/DOMElement.js
index fbb779a5..5d1b1d5a 100644
--- a/build/kissy/hilo/view/DOMElement.js
+++ b/build/kissy/hilo/view/DOMElement.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/DOMElement.min.js b/build/kissy/hilo/view/DOMElement.min.js
index 4e9e2c5d..5ddca5ec 100644
--- a/build/kissy/hilo/view/DOMElement.min.js
+++ b/build/kissy/hilo/view/DOMElement.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Drawable.js b/build/kissy/hilo/view/Drawable.js
index cd1f5f74..faaeb3d1 100644
--- a/build/kissy/hilo/view/Drawable.js
+++ b/build/kissy/hilo/view/Drawable.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Drawable.min.js b/build/kissy/hilo/view/Drawable.min.js
index e1268bd5..c107bbeb 100644
--- a/build/kissy/hilo/view/Drawable.min.js
+++ b/build/kissy/hilo/view/Drawable.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Graphics.js b/build/kissy/hilo/view/Graphics.js
index 1bcf698f..d50c4604 100644
--- a/build/kissy/hilo/view/Graphics.js
+++ b/build/kissy/hilo/view/Graphics.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -9,7 +9,7 @@ KISSY.add('hilo/view/Graphics', function(S, Hilo, Class, View, CacheMixin){
/**
* @language=en
- *
+ *
*
* @class Graphics class contains a group of functions for creating vector graphics.
* @augments View
diff --git a/build/kissy/hilo/view/Graphics.min.js b/build/kissy/hilo/view/Graphics.min.js
index 35c1ba0b..74347766 100644
--- a/build/kissy/hilo/view/Graphics.min.js
+++ b/build/kissy/hilo/view/Graphics.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Sprite.js b/build/kissy/hilo/view/Sprite.js
index 8e1893b7..3ac846f8 100644
--- a/build/kissy/hilo/view/Sprite.js
+++ b/build/kissy/hilo/view/Sprite.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Sprite.min.js b/build/kissy/hilo/view/Sprite.min.js
index 7b57bff5..ce979e17 100644
--- a/build/kissy/hilo/view/Sprite.min.js
+++ b/build/kissy/hilo/view/Sprite.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Stage.js b/build/kissy/hilo/view/Stage.js
index cbd029d6..81d88a65 100644
--- a/build/kissy/hilo/view/Stage.js
+++ b/build/kissy/hilo/view/Stage.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Stage.min.js b/build/kissy/hilo/view/Stage.min.js
index 49d229ac..b8e89909 100644
--- a/build/kissy/hilo/view/Stage.min.js
+++ b/build/kissy/hilo/view/Stage.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/Text.js b/build/kissy/hilo/view/Text.js
index 1cd999fd..57032cb5 100644
--- a/build/kissy/hilo/view/Text.js
+++ b/build/kissy/hilo/view/Text.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -47,7 +47,7 @@ var Text = Class.create(/** @lends Text.prototype */{
this._fontHeight = Text.measureFontHeight(this.font);
},
- text: null,
+ text: '',
color: '#000',
textAlign: null,
textVAlign: null,
diff --git a/build/kissy/hilo/view/Text.min.js b/build/kissy/hilo/view/Text.min.js
index 59df6d64..2e5cb5de 100644
--- a/build/kissy/hilo/view/Text.min.js
+++ b/build/kissy/hilo/view/Text.min.js
@@ -1,6 +1,6 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
-KISSY.add("hilo/view/Text",function(t,e,i,n,o){var r=e.create({Extends:n,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),r.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=r.measureFontHeight(this.font)},text:null,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=r.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,o=n.domElement,r=o.style;r.font=i.font,r.textAlign=i.textAlign,r.color=i.color,r.width=i.width+"px",r.height=i.height+"px",r.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,r,h,l,a=i.split(/\r\n|\r|\n|
/),s=0,d=0,c=e._fontHeight+e.lineSpacing,x=[];for(n=0,h=a.length;ne.maxWidth?(x.push({text:w,y:d}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=r}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var e,n=document.documentElement,o=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(o),e=o.offsetHeight,n.removeChild(o),e}}});return r},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"]});
\ No newline at end of file
+KISSY.add("hilo/view/Text",function(t,e,i,n,o){var r=e.create({Extends:n,Mixes:o,constructor:function(t){t=t||{},this.id=this.id||t.id||i.getUid("Text"),r.superclass.constructor.call(this,t),t.font||(this.font="12px arial"),this._fontHeight=r.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=r.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,o=n.domElement,r=o.style;r.font=i.font,r.textAlign=i.textAlign,r.color=i.color,r.width=i.width+"px",r.height=i.height+"px",r.lineHeight=i._fontHeight+i.lineSpacing+"px",o.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,o,r,h,l,a=i.split(/\r\n|\r|\n|
/),s=0,d=0,c=e._fontHeight+e.lineSpacing,x=[];for(n=0,h=a.length;ne.maxWidth?(x.push({text:w,y:d}),s>1;break;case"bottom":p=e.height-e.textHeight}var v=e.background;for(v&&(t.fillStyle=v,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":o=r}n.outline?t.strokeText(e,o,i):t.fillText(e,o,i)},Statics:{measureFontHeight:function(t){var e,n=document.documentElement,o=i.createElement("div",{style:{font:t,position:"absolute"},innerHTML:"M"});return n.appendChild(o),e=o.offsetHeight,n.removeChild(o),e}}});return r},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/view/View","hilo/view/CacheMixin"]});
\ No newline at end of file
diff --git a/build/kissy/hilo/view/View.js b/build/kissy/hilo/view/View.js
index 55372748..0b1ea1bb 100644
--- a/build/kissy/hilo/view/View.js
+++ b/build/kissy/hilo/view/View.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/kissy/hilo/view/View.min.js b/build/kissy/hilo/view/View.min.js
index d04b6eb7..11b90395 100644
--- a/build/kissy/hilo/view/View.min.js
+++ b/build/kissy/hilo/view/View.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for kissy
+ * Hilo 1.4.0 for kissy
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/physics/physics.js b/build/physics/physics.js
index ce1f876a..219532da 100644
--- a/build/physics/physics.js
+++ b/build/physics/physics.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for physics
+ * Hilo 1.4.0 for physics
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/physics/physics.min.js b/build/physics/physics.min.js
index a629cd68..09bf71d2 100644
--- a/build/physics/physics.min.js
+++ b/build/physics/physics.min.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for physics
+ * Hilo 1.4.0 for physics
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
diff --git a/build/standalone/hilo-standalone.js b/build/standalone/hilo-standalone.js
index 74dd7c5c..1159c8b3 100644
--- a/build/standalone/hilo-standalone.js
+++ b/build/standalone/hilo-standalone.js
@@ -1,5 +1,5 @@
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -190,7 +190,7 @@ var browser = (function(){
window.Hilo.browser = browser;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -225,7 +225,7 @@ var util = {
window.Hilo.util = util;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -255,7 +255,7 @@ var Hilo = {
* Hilo version
* @type String
*/
- version: '1.3.0',
+ version: '1.4.0',
/**
* @language=en
* Gets a globally unique id. Such as Stage1, Bitmap2 etc.
@@ -561,7 +561,7 @@ var Hilo = {
for(var i in Hilo){window.Hilo[i] = Hilo[i];}
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -742,7 +742,7 @@ return {create:create, mix:mix};
window.Hilo.Class = Class;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -965,7 +965,7 @@ var Matrix = Class.create(/** @lends Matrix.prototype */{
window.Hilo.Matrix = Matrix;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1117,7 +1117,7 @@ if(RawEvent){
window.Hilo.EventMixin = EventMixin;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1198,7 +1198,7 @@ var Drawable = Class.create(/** @lends Drawable.prototype */{
window.Hilo.Drawable = Drawable;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1292,7 +1292,7 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{
window.Hilo.Renderer = Renderer;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1503,7 +1503,7 @@ var CanvasRenderer = Class.create( /** @lends CanvasRenderer.prototype */ {
window.Hilo.CanvasRenderer = CanvasRenderer;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1686,7 +1686,7 @@ function createDOMDrawable(view, imageObj){
window.Hilo.DOMRenderer = DOMRenderer;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -1746,7 +1746,13 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
}
}
return this._isSupported;
- }
+ },
+ /**
+ * WebGL context Options
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
+ * @type {Object}
+ */
+ contextOptions: null
},
renderType:'webgl',
gl:null,
@@ -1755,7 +1761,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
- this.gl = this.canvas.getContext("webgl")||this.canvas.getContext('experimental-webgl');
+ var contextOptions = WebGLRenderer.contextOptions || {};
+ this.gl = this.canvas.getContext("webgl", contextOptions)||this.canvas.getContext('experimental-webgl', contextOptions);
this.maxBatchNum = WebGLRenderer.MAX_BATCH_NUM;
this.positionStride = WebGLRenderer.ATTRIBUTE_NUM * 4;
@@ -2264,7 +2271,7 @@ Shader.prototype = {
window.Hilo.WebGLRenderer = WebGLRenderer;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2763,7 +2770,7 @@ function doSATCheck(poly1, poly2, result){
window.Hilo.View = View;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -2829,7 +2836,7 @@ var CacheMixin = /** @lends CacheMixin# */ {
window.Hilo.CacheMixin = CacheMixin;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3203,7 +3210,7 @@ var Container = Class.create(/** @lends Container.prototype */{
window.Hilo.Container = Container;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3475,7 +3482,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{
window.Hilo.Stage = Stage;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3554,7 +3561,7 @@ var Drawable = window.Hilo.Drawable;
window.Hilo.Bitmap = Bitmap;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3826,7 +3833,7 @@ var Sprite = Class.create(/** @lends Sprite.prototype */{
window.Hilo.Sprite = Sprite;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3942,7 +3949,7 @@ var DOMElement = Class.create(/** @lends DOMElement.prototype */{
window.Hilo.DOMElement = DOMElement;
})(window);
/**
- * Hilo 1.3.0 for standalone
+ * Hilo 1.4.0 for standalone
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
@@ -3955,7 +3962,7 @@ var CacheMixin = window.Hilo.CacheMixin;
/**
* @language=en
- *