var __extends=this&&this.__extends||function(){var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}();import Disposable from"../Disposable.js";import Polygon from"../geom/Polygon.js";var RenderBox=function(n){function t(t){var e=n.call(this)||this;return e.geometry_=null,e.element_=document.createElement("div"),e.element_.style.position="absolute",e.element_.style.pointerEvents="auto",e.element_.className="ol-box "+t,e.map_=null,e.startPixel_=null,e.endPixel_=null,e}return __extends(t,n),t.prototype.disposeInternal=function(){this.setMap(null)},t.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,n="px",o=this.element_.style;o.left=Math.min(t[0],e[0])+n,o.top=Math.min(t[1],e[1])+n,o.width=Math.abs(e[0]-t[0])+n,o.height=Math.abs(e[1]-t[1])+n},t.prototype.setMap=function(t){var e;this.map_&&(this.map_.getOverlayContainer().removeChild(this.element_),(e=this.element_.style).left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"),this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},t.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},t.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,e=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);e[4]=e[0].slice(),this.geometry_?this.geometry_.setCoordinates([e]):this.geometry_=new Polygon([e])},t.prototype.getGeometry=function(){return this.geometry_},t}(Disposable);export default RenderBox;