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" "registry": "https://registry.npmjs.org"
} }
}, },
"version": "2.8.38", "version": "2.8.39",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"publishConfig": { "publishConfig": {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -244,6 +244,11 @@ export default class Source extends EventEmitter implements ISource {
private setCenter(bbox: BBox) { private setCenter(bbox: BBox) {
this.center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]; 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", "name": "@antv/l7-three",
"version": "2.8.38", "version": "2.8.39",
"description": "three for L7 ", "description": "three for L7 ",
"keywords": [ "keywords": [
"3D", "3D",
@ -44,9 +44,9 @@
}, },
"homepage": "https://github.com/antvis/L7#readme", "homepage": "https://github.com/antvis/L7#readme",
"dependencies": { "dependencies": {
"@antv/l7-core": "^2.8.38", "@antv/l7-core": "^2.8.39",
"@antv/l7-layers": "^2.8.38", "@antv/l7-layers": "^2.8.39",
"@antv/l7-scene": "^2.8.38", "@antv/l7-scene": "^2.8.39",
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.7.7",
"inversify": "^5.0.1", "inversify": "^5.0.1",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",

View File

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