var gdjs;(function(c){class m extends c.RuntimeLayer{constructor(t,e){super(t,e);this._cameraRotation=0;this._zoomFactor=1;this._cameraX=this.getWidth()/2,this._cameraY=this.getHeight()/2}onGameResolutionResized(t,e){this._cameraX+=this._runtimeScene.getViewportOriginX()-t,this._cameraY+=this._runtimeScene.getViewportOriginY()-e,this._renderer.updatePosition()}getCameraX(t){return this._forceDimensionUpdate(),this._cameraX}getCameraY(t){return this._forceDimensionUpdate(),this._cameraY}setCameraX(t,e){this._forceDimensionUpdate(),this._cameraX=t,this._renderer.updatePosition()}setCameraY(t,e){this._forceDimensionUpdate(),this._cameraY=t,this._renderer.updatePosition()}getCameraWidth(t){return this.getWidth()/this._zoomFactor}getCameraHeight(t){return this.getHeight()/this._zoomFactor}setCameraZoom(t,e){this._zoomFactor=t,this._renderer.updatePosition()}getCameraZoom(t){return this._zoomFactor}getCameraRotation(t){return this._cameraRotation}setCameraRotation(t,e){this._cameraRotation=t,this._renderer.updatePosition()}convertCoords(t,e,o=0,i){let a=i||[0,0];t-=this.getRuntimeScene()._cachedGameResolutionWidth/2,e-=this.getRuntimeScene()._cachedGameResolutionHeight/2,t/=Math.abs(this._zoomFactor),e/=Math.abs(this._zoomFactor);const r=this._cameraRotation/180*Math.PI,s=t,n=Math.cos(r),h=Math.sin(r);return t=n*t-h*e,e=h*s+n*e,a[0]=t+this.getCameraX(o),a[1]=e+this.getCameraY(o),a}applyLayerInverseTransformation(t,e,o,i){t-=this._runtimeScene.getViewportOriginX(),e-=this._runtimeScene.getViewportOriginY(),t/=Math.abs(this._zoomFactor),e/=Math.abs(this._zoomFactor);const a=this._cameraRotation/180*Math.PI,r=t,s=Math.cos(a),n=Math.sin(a);return t=s*t-n*e,e=n*r+s*e,i[0]=t+this.getCameraX(o),i[1]=e+this.getCameraY(o),i}convertInverseCoords(t,e,o=0,i){let a=i||[0,0];t-=this.getCameraX(o),e-=this.getCameraY(o);const r=this._cameraRotation/180*Math.PI,s=t,n=Math.cos(-r),h=Math.sin(-r);return t=n*t-h*e,e=h*s+n*e,t*=Math.abs(this._zoomFactor),e*=Math.abs(this._zoomFactor),a[0]=t+this.getRuntimeScene()._cachedGameResolutionWidth/2,a[1]=e+this.getRuntimeScene()._cachedGameResolutionHeight/2,a}applyLayerTransformation(t,e,o,i){t-=this.getCameraX(o),e-=this.getCameraY(o);const a=this._cameraRotation/180*Math.PI,r=t,s=Math.cos(-a),n=Math.sin(-a);return t=s*t-n*e,e=n*r+s*e,t*=Math.abs(this._zoomFactor),e*=Math.abs(this._zoomFactor),t+=this._runtimeScene.getViewportOriginX(),e+=this._runtimeScene.getViewportOriginY(),i[0]=t,i[1]=e,i}_forceDimensionUpdate(){this._runtimeScene.getViewportWidth()}}c.Layer=m})(gdjs||(gdjs={}));
//# sourceMappingURL=layer.js.map
