UNPKG

@vtx/cs-map

Version:

React components for Vortex

25 lines (23 loc) 727 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; /** * @description: 产生随机点 * @param {*} position:中心点坐标 * @param {*} num:随机点数量 * @return {*} */ function generateRandomPosition(position, num) { var list = []; for (var i = 0; i < num; i++) { // random产生的随机数范围是0-1,需要加上正负模拟 var lon = position[0] + Math.random() * 0.04 * (i % 2 === 0 ? 1 : -1); var lat = position[1] + Math.random() * 0.04 * (i % 2 === 0 ? 1 : -1); list.push([lon, lat]); } return list; } var _default = exports["default"] = generateRandomPosition; //# sourceMappingURL=generateRandomPosition.js.map