@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.18 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
function t(t,e){return e?"xoffset"in e&&e.xoffset?Math.max(t,Math.abs(e.xoffset)):"yoffset"in e&&e.yoffset?Math.max(t,Math.abs(e.yoffset||0)):t:t}function e(t){let e=0,n=0;for(let r=0;r<t.length;r++){const o=t[r].size;"number"==typeof o&&(e+=o,n++)}return e/n}function n(t,n){return"number"==typeof t?t:t?.stops?.length?e(t.stops):n}function r(t,e){if(!e)return t;const r=e.filter((t=>"size"===t.type)).map((e=>{const{maxSize:r,minSize:o}=e;return(n(r,t)+n(o,t))/2}));let o=0;const s=r.length;if(0===s)return t;for(let n=0;n<s;n++)o+=r[n];const f=Math.floor(o/s);return Math.max(f,t)}function o(e){const n=e?.renderer,o=e?.pointerType,s="touch"===o?9:6;if(!n)return s;const f="visualVariables"in n?r(s,n.visualVariables):s;if("simple"===n.type)return t(f,n.symbol);if("unique-value"===n.type){let e=f;return n.uniqueValueInfos?.forEach((n=>{e=t(e,n.symbol)})),e}if("class-breaks"===n.type){let e=f;return n.classBreakInfos.forEach((n=>{e=t(e,n.symbol)})),e}return"dot-density"===n.type||n.type,f}export{o as calculateTolerance};