@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.78 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextRenderAlignment as c,textVerticalPaddingPx as n}from"../../webgl-engine/lib/TextRenderer.js";const i=Object.freeze({left:0,center:.5,right:1}),s=Object.freeze({"bottom-left":r(0,0),bottom:r(.5,0),"bottom-right":r(1,0),left:r(0,.5),center:r(.5,.5),right:r(1,.5),"top-left":r(0,1),top:r(.5,1),"top-right":r(1,1)});function f(t){switch(t){case"left":return c.Left;case"right":return c.Right;default:return c.Center}}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 l(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 m(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 u(t){return"middle"===t?"center":t}function h(r,c){switch(r){case"top":return e(c,0,n);case"bottom":return e(c,0,-1);default:return t(c,o)}}export{m as anchorFromPlacements,a as horizontalPlacementFromAnchor,i as horizontalPlacementToAnchorX,s as namedAnchorToHUDMaterialAnchorPos,f as textRenderAlignmentFromHorizontalPlacement,u as verticalPlacementFromAlignment,l as verticalPlacementFromAnchor,h as verticalScreenOffsetFromAlignment};