fix: 修复计算图层数据中心点时可能存在的计算错误 (#1134)

* fix: 修复 mouseup 失效

* chore: update version 2.8.36 -> 2.8.37

* chore: update version 2.8.37 -> 2.8.38

* fix: 修复高德2动态顶点错误

* chore: update version 2.8.38 -> 2.8.39

* fix: 修复计算图层数据中心点时可能存在的计算错误

* style: lint style
This commit is contained in:
YiQianYao 2022-05-31 14:52:37 +08:00 committed by GitHub
parent b05606506b
commit 9fafa41522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 94 additions and 71 deletions

View File

@ -15,7 +15,7 @@
"registry": "https://registry.npmjs.org"
}
},
"version": "2.8.38",
"version": "2.8.39",
"npmClient": "yarn",
"useWorkspaces": true,
"publishConfig": {

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-component",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,8 +25,8 @@
"author": "lzxue",
"license": "ISC",
"dependencies": {
"@antv/l7-core": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"eventemitter3": "^4.0.0",
"inversify": "^5.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-core",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -24,7 +24,7 @@
"license": "ISC",
"dependencies": {
"@antv/async-hook": "^2.1.0",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"ajv": "^6.10.2",
"element-resize-event": "^3.0.3",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7",
"version": "2.8.38",
"version": "2.8.39",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,13 +25,13 @@
"author": "antv",
"license": "MIT",
"dependencies": {
"@antv/l7-component": "^2.8.38",
"@antv/l7-core": "^2.8.38",
"@antv/l7-layers": "^2.8.38",
"@antv/l7-maps": "^2.8.38",
"@antv/l7-scene": "^2.8.38",
"@antv/l7-source": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-component": "^2.8.39",
"@antv/l7-core": "^2.8.39",
"@antv/l7-layers": "^2.8.39",
"@antv/l7-maps": "^2.8.39",
"@antv/l7-scene": "^2.8.39",
"@antv/l7-source": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7"
},
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",

View File

@ -1,2 +1,3 @@
const version = '2.8.38';
const version = '2.8.39';
export { version };

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-layers",
"version": "2.8.38",
"version": "2.8.39",
"description": "L7's collection of built-in layers",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,9 +25,9 @@
"author": "xiaoiver",
"license": "ISC",
"dependencies": {
"@antv/l7-core": "^2.8.38",
"@antv/l7-source": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-source": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"@mapbox/martini": "^0.2.0",
"@turf/meta": "^6.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-map",
"version": "2.8.38",
"version": "2.8.39",
"description": "l7 map",
"keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>",
@ -37,7 +37,7 @@
},
"homepage": "https://github.com/antvis/L7#readme",
"dependencies": {
"@antv/l7-utils": "^2.8.38",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/unitbezier": "^0.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-maps",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,9 +27,9 @@
"license": "ISC",
"dependencies": {
"@amap/amap-jsapi-loader": "^0.0.3",
"@antv/l7-core": "^2.8.38",
"@antv/l7-map": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-map": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6",
"@types/mapbox-gl": "^1.11.2",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-mini",
"version": "2.8.38",
"version": "2.8.39",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,11 +25,11 @@
"author": "antv",
"license": "MIT",
"dependencies": {
"@antv/l7-core": "^2.8.38",
"@antv/l7-layers": "^2.8.38",
"@antv/l7-maps": "^2.8.38",
"@antv/l7-scene": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-layers": "^2.8.39",
"@antv/l7-maps": "^2.8.39",
"@antv/l7-scene": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7"
},
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-renderer",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -26,7 +26,7 @@
"gl": "^4.4.0"
},
"dependencies": {
"@antv/l7-core": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"l7regl": "^0.0.20",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-scene",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -23,12 +23,12 @@
"author": "xiaoiver",
"license": "ISC",
"dependencies": {
"@antv/l7-component": "^2.8.38",
"@antv/l7-core": "^2.8.38",
"@antv/l7-layers": "^2.8.38",
"@antv/l7-maps": "^2.8.38",
"@antv/l7-renderer": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-component": "^2.8.39",
"@antv/l7-core": "^2.8.39",
"@antv/l7-layers": "^2.8.39",
"@antv/l7-maps": "^2.8.39",
"@antv/l7-renderer": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"mapbox-gl": "^1.2.1",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-source",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -26,8 +26,8 @@
"license": "ISC",
"dependencies": {
"@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.8.38",
"@antv/l7-utils": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-utils": "^2.8.39",
"@babel/runtime": "^7.7.7",
"@mapbox/geojson-rewind": "^0.4.0",
"@turf/helpers": "^6.1.4",

View File

@ -244,6 +244,11 @@ export default class Source extends EventEmitter implements ISource {
private setCenter(bbox: BBox) {
this.center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2];
if (isNaN(this.center[0]) || isNaN(this.center[1])) {
// this.center = [Infinity, Infinity] // Infinity/Infinity = NaN
// 默认设置为大地原点
this.center = [108.92361111111111, 34.54083333333333];
}
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-three",
"version": "2.8.38",
"version": "2.8.39",
"description": "three for L7 ",
"keywords": [
"3D",
@ -44,9 +44,9 @@
},
"homepage": "https://github.com/antvis/L7#readme",
"dependencies": {
"@antv/l7-core": "^2.8.38",
"@antv/l7-layers": "^2.8.38",
"@antv/l7-scene": "^2.8.38",
"@antv/l7-core": "^2.8.39",
"@antv/l7-layers": "^2.8.39",
"@antv/l7-scene": "^2.8.39",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"reflect-metadata": "^0.1.13",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-utils",
"version": "2.8.38",
"version": "2.8.39",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -1,4 +1,4 @@
import { PolygonLayer, Scene } from '@antv/l7';
import { PolygonLayer, Scene, Source } from '@antv/l7';
import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
@ -13,13 +13,18 @@ export default class Amap2demo_polygon extends React.Component {
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new GaodeMap({
map: new GaodeMapV2({
pitch: 40,
center: [120, 30],
zoom: 13,
// center: [120, 30],
center: [113.8623046875, 30.031055426540206],
zoom: 8,
}),
});
this.scene = scene;
const emptyData = {
type: 'FeatureCollection',
features: [],
};
const data = {
type: 'FeatureCollection',
features: [
@ -68,10 +73,14 @@ export default class Amap2demo_polygon extends React.Component {
],
};
const source = new Source(emptyData);
const layer = new PolygonLayer({
autoFit: true,
// autoFit: true,
})
.source(data)
// .source(data)
.source(emptyData)
// .source(source)
.shape('fill')
.color('red')
.active(true)
@ -81,24 +90,32 @@ export default class Amap2demo_polygon extends React.Component {
// dir: 'in',
// },
});
scene.addLayer(layer);
const layer2 = new PolygonLayer({
autoFit: true,
})
.source(data2)
.shape('fill')
.color('#ff0')
.active(true)
.style({
// opacity: 0.4,
// opacityLinear: {
// enable: true,
// dir: 'out',
// },
// raisingHeight: 50000,
});
scene.addLayer(layer2);
scene.on('loaded', () => {
scene.addLayer(layer);
scene.render();
setTimeout(() => {
layer.setData(data);
scene.render();
}, 3000);
});
// const layer2 = new PolygonLayer({
// autoFit: true,
// })
// .source(data2)
// .shape('fill')
// .color('#ff0')
// .active(true)
// .style({
// // opacity: 0.4,
// // opacityLinear: {
// // enable: true,
// // dir: 'out',
// // },
// // raisingHeight: 50000,
// });
// scene.addLayer(layer2);
}
public render() {