UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.04 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{clamp as t}from"../../core/mathUtils.js";import n from"../../geometry/Extent.js";import r from"../../geometry/Polygon.js";import{e as o}from"../../chunks/intersectionOperator.js";import{sampleExtent as e}from"./constants.js";const m=1920,i=1080;function s(t){if(!t)throw new Error("Missing View");return[t.on("drag",t=>t.stopPropagation()),t.on("key-down",t=>{t.key.startsWith("Arrow")&&t.stopPropagation()})]}const a=(t,n)=>{const r=(t-e.xmin)/(e.xmax-e.xmin),o=(e.ymax-n)/(e.ymax-e.ymin);return{x:r*m,y:o*i}},x=s=>{const x=r.fromExtent(new n(e)),y=o(x,s);return y?y.rings[0].map(([n,r])=>{const{x:o,y:e}=a(n,r);return{x:t(o,0,m),y:t(e,0,i)}}):[]},y=t=>{const r=t.width/2,o=t.height/2,m=e.xmin+r,i=e.xmax-r,s=e.ymin+o,a=e.ymax-o;return m<i&&s<a?new n({xmin:m,ymin:s,xmax:i,ymax:a,spatialReference:e.spatialReference}):null};export{s as disableVideoZoomAndPan,a as geoToPixel,y as getUpdatedConstraints,x as getUpdatedExtentPoints,i as videoHeight,m as videoWidth};