@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.02 kB
JavaScript
import{defaultSettings as e}from"./Settings.js";class t{constructor(t){this._createCamera=t,this.compared={sourceZoom:0,targetZoom:0,pan:0,rotate:0},this.settings={desiredScreenFlow:e.desiredScreenFlow},this.source=t(),this.target=t()}clone(){const e=new t(this._createCamera);return e.copyFrom(this),e}copyFrom(e){this.update(e.source,e.target,e.settings)}update(t,r,s){this.source!==t&&this.source.copyFrom(t),this.target!==r&&this.target.copyFrom(r),this.compared=this.source.compareTo(this.target,this.compared),this.settings.desiredScreenFlow=null!=s.desiredScreenFlow?s.desiredScreenFlow:e.desiredScreenFlow,this.desiredPixelFlow=this.settings.desiredScreenFlow*this.target.size,this.halfWindowSize=this.target.size/2}halfWindowPanAtZoom(e){const t=this.target.pixelsPerPanAtZoom(e);return this.halfWindowSize/t}get hasZoom(){return Math.abs(this.compared.sourceZoom-this.compared.targetZoom)>1e-5}get hasPan(){return this.compared.pan>1e-9}get hasRotate(){return this.compared.rotate>1e-9}}export{t as Definition};