UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.65 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as r,fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{textVerticalPaddingPx as c}from"../../webgl-engine/lib/TextRenderer.js";const n=Object.freeze({left:0,center:.5,right:1}),i=Object.freeze({"bottom-left":o(0,0),bottom:o(.5,0),"bottom-right":o(1,0),left:o(0,.5),center:o(.5,.5),right:o(1,.5),"top-left":o(0,1),top:o(.5,1),"top-right":o(1,1)});function s(t){switch(t){case"left":return 0;case"right":return 2;default:return 1}}function a(t){switch(t){case"bottom-left":case"left":case"top-left":return"left";case"bottom":case"center":case"top":return"center";case"bottom-right":case"right":case"top-right":return"right"}}function f(t){switch(t){case"bottom-left":case"bottom":case"bottom-right":return"bottom";case"left":case"center":case"right":return"center";case"top-left":case"top":case"top-right":return"top"}}function l(t,e){switch(e){case"bottom":return"left"===t?"bottom-left":"right"===t?"bottom-right":"bottom";case"center":return t;case"top":return"left"===t?"top-left":"right"===t?"top-right":"top"}}function m(t){return"middle"===t?"center":t}function u(o,n){switch(o){case"top":return e(n,0,c);case"bottom":return e(n,0,-c);default:return t(n,r)}}export{l as anchorFromPlacements,a as horizontalPlacementFromAnchor,n as horizontalPlacementToAnchorX,i as namedAnchorToHUDMaterialAnchorPos,s as textRenderAlignmentFromHorizontalPlacement,m as verticalPlacementFromAlignment,f as verticalPlacementFromAnchor,u as verticalScreenOffsetFromAlignment};