UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.71 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import e from"../../../../core/Logger.js";const t=()=>e.getLogger("esri.views.2d.engine.webgl.alignmentUtils");var r,n;function a(e){if(!e)return r.Center;switch(e){case"Left":case"left":return r.Left;case"Right":case"right":return r.Right;case"Justify":return t().warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),r.Center;case"Center":case"center":return r.Center}}function c(e){if(!e)return n.Center;switch(e){case"Top":case"top":return n.Top;case"Center":case"middle":return n.Center;case"Baseline":case"baseline":return n.Baseline;case"Bottom":case"bottom":return n.Bottom}}function o(e){switch(e){case"above-left":case"esriServerPointLabelPlacementAboveLeft":return["right","bottom"];case"above-center":case"above-along":case"esriServerPointLabelPlacementAboveCenter":case"esriServerLinePlacementAboveAlong":return["center","bottom"];case"above-right":case"esriServerPointLabelPlacementAboveRight":return["left","bottom"];case"center-left":case"esriServerPointLabelPlacementCenterLeft":return["right","middle"];case"center-center":case"center-along":case"esriServerPointLabelPlacementCenterCenter":case"esriServerLinePlacementCenterAlong":case"always-horizontal":case"esriServerPolygonPlacementAlwaysHorizontal":return["center","middle"];case"center-right":case"esriServerPointLabelPlacementCenterRight":return["left","middle"];case"below-left":case"esriServerPointLabelPlacementBelowLeft":return["right","top"];case"below-center":case"below-along":case"esriServerPointLabelPlacementBelowCenter":case"esriServerLinePlacementBelowAlong":return["center","top"];case"below-right":case"esriServerPointLabelPlacementBelowRight":return["left","top"];default:return console.debug(`Found invalid placement type ${e}`),["center","middle"]}}function i(e){switch(e){case r.Right:case"right":return-1;case r.Center:case"center":return 0;case r.Left:case"left":return 1;default:return console.debug(`Found invalid horizontal alignment ${e}`),0}}function s(e){switch(e){case n.Top:case"top":return 1;case n.Center:case"middle":return 0;case n.Bottom:case n.Baseline:case"baseline":case"bottom":return-1;default:return console.debug(`Found invalid vertical alignment ${e}`),0}}!function(e){e[e.Left=-1]="Left",e[e.Center=0]="Center",e[e.Right=1]="Right"}(r||(r={})),function(e){e[e.Top=1]="Top",e[e.Center=0]="Center",e[e.Bottom=-1]="Bottom",e[e.Baseline=2]="Baseline"}(n||(n={}));export{r as HAlign,n as VAlign,o as getAlignmentFromPlacement,a as getXAnchorDirection,i as getXDirection,c as getYAnchorDirection,s as getYDirection};