fix: update version

This commit is contained in:
thinkinggis 2020-08-28 11:40:45 +08:00
commit eeee362c95
6 changed files with 8864 additions and 8112 deletions

View File

@ -7,7 +7,7 @@
},
"devDependencies": {
"@antv/g2": "^3.5.9",
"@antv/gatsby-theme-antv": "^0.10.59",
"@antv/gatsby-theme-antv": "^0.11.5",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-decorators": "^7.6.0",

View File

@ -22,15 +22,26 @@ export function computeMiter(
export function computeNormal(out: vec2, dir: vec2) {
return vec2.set(out, -dir[1], dir[0]);
}
export function direction(out: vec2, a: vec2, b: vec2) {
vec2.sub(out, a, b);
vec2.normalize(out, out);
return out;
}
function isPointEqual(a: vec2, b: vec2) {
return a[0] === b[0] && a[1] === b[1];
}
function getArrayUnique(matrix: number[][]) {
const result: number[][] = [];
matrix.map((item) => {
item.sort((a, b) => b - a);
result.push(item);
});
return result;
}
export interface IExtrudeLineOption {
join: string;
cap: string;
@ -80,16 +91,14 @@ export default class ExtrudePolyline {
this.started = false;
this.normal = null;
this.totalDistance = 0;
// 去除数组里重复的点
points = getArrayUnique(points);
const total = points.length;
let count = complex.startIndex;
for (let i = 1; i < total; i++) {
const last = points[i - 1] as vec2;
const cur = points[i] as vec2;
const next = i < points.length - 1 ? points[i + 1] : null;
// 如果当前点和前一点相同,跳过
if (isPointEqual(last, cur)) {
continue;
}
const amt = this.segment(complex, count, last, cur, next as vec2);
count += amt;
}

View File

@ -29,6 +29,7 @@
"@antv/l7-core": "^2.2.33",
"@antv/l7-map": "^2.2.33",
"@antv/l7-utils": "^2.2.33",
"@amap/amap-jsapi-loader": "^0.0.3",
"@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6",
"gl-matrix": "^3.1.0",

View File

@ -1,6 +1,7 @@
/**
* AMapService
*/
import AMapLoader from '@amap/amap-jsapi-loader';
import {
Bounds,
CoordinateSystem,
@ -330,17 +331,22 @@ export default class AMapService
}
amapLoaded = true;
plugin.push('Map3D');
this.loadAMapScript(
`https://webapi.amap.com/maps?v=${AMAP_VERSION}&key=${token}&plugin=${plugin.join(
',',
)}`,
).then(() => {
resolveMap();
if (pendingResolveQueue.length) {
pendingResolveQueue.forEach((r) => r());
pendingResolveQueue = [];
}
});
AMapLoader.load({
key: token, // 申请好的Web端开发者Key首次调用 load 时必填
version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
})
.then((AMap) => {
resolveMap();
if (pendingResolveQueue.length) {
pendingResolveQueue.forEach((r) => r());
pendingResolveQueue = [];
}
})
.catch((e) => {
throw new Error(e);
});
} else {
if ((amapLoaded && window.AMap) || mapInstance) {
resolveMap();
@ -451,15 +457,4 @@ export default class AMapService
$wrapper.appendChild($amapdiv);
return $amapdiv;
}
private loadAMapScript(src: string) {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = src;
script.onload = () => {
resolve();
};
script.onerror = reject;
document.head.appendChild(script);
});
}
}

View File

@ -6,6 +6,7 @@ describe('template', () => {
el.id = 'test-div-id';
el.style.width = '500px';
el.style.height = '500px';
el.style.position = 'absolute';
document.querySelector('body')?.appendChild(el);
const scene = new Scene({
id: 'test-div-id',

16916
yarn.lock

File diff suppressed because it is too large Load Diff