text: /**
   * Hilo 1.6.0 for amd
   * Copyright 2016 alibaba.com
   * Licensed under the MIT License
   */
  define("hilo/view/Stage",["hilo/core/Hilo","hilo/core/Class","hilo/view/Container","hilo/renderer/CanvasRenderer","hilo/renderer/DOMRenderer","hilo/renderer/WebGLRenderer","hilo/util/browser","hilo/util/util"],function(e,t,i,n,r,s,a,o){var h=t.create({Extends:i,constructor:function(t){t=t||{},this.id=this.id||t.id||e.getUid("Stage"),h.superclass.constructor.call(this,t),this._initRenderer(t);var i=this.width,n=this.height,r=this.updateViewport();t.width||(i=r&&r.width||320),t.height||(n=r&&r.height||480),this.resize(i,n,!0)},canvas:null,renderer:null,paused:!1,viewport:null,_initRenderer:function(t){var i=t.canvas,a=t.container,o=t.renderType||"canvas";if("string"==typeof i&&(i=e.getElement(i)),"string"==typeof a&&(a=e.getElement(a)),i)i.getContext||(o="dom");else{var h="dom"===o?"div":"canvas";i=e.createElement(h,{style:{position:"absolute"}})}this.canvas=i,a&&a.appendChild(i);var d={canvas:i,stage:this};switch(o){case"dom":this.renderer=new r(d);break;case"webgl":s.isSupport()?this.renderer=new s(d):this.renderer=new n(d);break;case"canvas":default:this.renderer=new n(d)}},addTo:function(e){var t=this.canvas;return t.parentNode!==e&&e.appendChild(t),this},tick:function(e){this.paused||this._render(this.renderer,e)},enableDOMEvent:function(e,t){var i=this,n=i.canvas,r=i._domListener||(i._domListener=function(e){i._onDOMEvent(e)});e="string"==typeof e?[e]:e,t=t!==!1;for(var s=0;s<e.length;s++){var a=e[s];t?n.addEventListener(a,r,!1):n.removeEventListener(a,r)}return i},_onDOMEvent:function(e){var t=e.type,i=e,n=0==t.indexOf("touch"),r=e;if(n){var s=e.touches,h=e.changedTouches;r=s&&s.length?s[0]:h&&h.length?h[0]:null}var d=r.pageX||r.clientX,u=r.pageY||r.clientY,l=this.viewport||this.updateViewport();i.stageX=d=(d-l.left)/this.scaleX,i.stageY=u=(u-l.top)/this.scaleY,i.stopPropagation=function(){this._stopPropagationed=!0};var c=this.getViewAtPoint(d,u,!0,!1,!0)||this,v=this.canvas,p=this._eventTarget,g="mouseout"===t;if(p&&(p!=c&&(!p.contains||!p.contains(c))||g)){var f="touchmove"===t?"touchout":"mousemove"===t||g||!c?"mouseout":null;if(f){var w=o.copy({},i);w.type=f,w.eventTarget=p,p._fireMouseEvent(w)}i.lastEventTarget=p,this._eventTarget=null}if(c&&c.pointerEnabled&&"mouseout"!==t&&(i.eventTarget=this._eventTarget=c,c._fireMouseEvent(i)),!n){var m=c&&c.pointerEnabled&&c.useHandCursor?"pointer":"";v.style.cursor=m}a.android&&"touchmove"===t&&e.preventDefault()},updateViewport:function(){var t=this.canvas,i=null;return t.parentNode&&(i=this.viewport=e.getElementRect(t)),i},resize:function(e,t,i){(i||this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.renderer.resize(e,t),this.updateViewport())}});return h});