MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / findNearest

Method findNearest

src/openlayers/mapping/WebMap.js:828–837  ·  view source on GitHub ↗
(scales, target)

Source from the content-addressed store, hash-verified

826 }
827
828 findNearest(scales, target) {
829 let resultIndex = 0;
830 let targetScaleD = target;
831 for (let i = 1, len = scales.length; i < len; i++) {
832 if (Math.abs(scales[i] - targetScaleD) < Math.abs(scales[resultIndex] - targetScaleD)) {
833 resultIndex = i;
834 }
835 }
836 return scales[resultIndex];
837 }
838
839 /**
840 * @private

Callers 1

limitScaleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected