From 0b2673f8de7b60611c0ad45a8f2cd648e8f58643 Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+2912401452@users.noreply.github.com> Date: Wed, 8 Dec 2021 15:40:54 +0800 Subject: [PATCH] Shihuidev (#871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 修复 texture 重复销毁问题 * style: lint style --- lerna.json | 2 +- packages/component/package.json | 6 +++--- packages/core/package.json | 4 ++-- packages/l7/package.json | 16 ++++++++-------- packages/l7/src/version.ts | 2 +- packages/layers/package.json | 8 ++++---- packages/map/package.json | 4 ++-- packages/maps/package.json | 8 ++++---- packages/mini/package.json | 12 ++++++------ packages/renderer/package.json | 4 ++-- packages/renderer/src/regl/ReglTexture2D.ts | 6 +++++- packages/scene/package.json | 14 +++++++------- packages/source/package.json | 6 +++--- packages/three/package.json | 8 ++++---- packages/utils/package.json | 2 +- stories/Map/components/mapCenter.tsx | 18 ++++++++++-------- stories/customMap/components/Map.tsx | 21 ++++++++++++--------- 17 files changed, 75 insertions(+), 66 deletions(-) diff --git a/lerna.json b/lerna.json index 16b826fba2..3c94ba2396 100644 --- a/lerna.json +++ b/lerna.json @@ -14,7 +14,7 @@ "message": "chore: publish" } }, - "version": "2.6.8", + "version": "2.6.9", "npmClient": "yarn", "useWorkspaces": true, "publishConfig": { diff --git a/packages/component/package.json b/packages/component/package.json index 461f651305..4e8659208b 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-component", - "version": "2.6.8", + "version": "2.6.9", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,8 +25,8 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/l7-core": "^2.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "eventemitter3": "^4.0.0", "inversify": "^5.0.1", diff --git a/packages/core/package.json b/packages/core/package.json index 0ff6175fd0..4cf3c82494 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-core", - "version": "2.6.8", + "version": "2.6.9", "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.6.8", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "ajv": "^6.10.2", "element-resize-event": "^3.0.3", diff --git a/packages/l7/package.json b/packages/l7/package.json index 1f795cc8f4..93b65a48fe 100644 --- a/packages/l7/package.json +++ b/packages/l7/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "2.6.8", + "version": "2.6.9", "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.6.7", - "@antv/l7-core": "^2.6.7", - "@antv/l7-source": "^2.6.7", - "@antv/l7-layers": "^2.6.7", - "@antv/l7-maps": "^2.6.7", - "@antv/l7-scene": "^2.6.7", - "@antv/l7-utils": "^2.6.7", + "@antv/l7-component": "^2.6.9", + "@antv/l7-core": "^2.6.9", + "@antv/l7-layers": "^2.6.9", + "@antv/l7-maps": "^2.6.9", + "@antv/l7-scene": "^2.6.9", + "@antv/l7-source": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7" }, "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", diff --git a/packages/l7/src/version.ts b/packages/l7/src/version.ts index febc98b16b..81bef9cb1d 100644 --- a/packages/l7/src/version.ts +++ b/packages/l7/src/version.ts @@ -1,2 +1,2 @@ -const version = '2.6.8'; +const version = '2.6.9'; export { version }; diff --git a/packages/layers/package.json b/packages/layers/package.json index 3a33a43f0f..5cd7720a8a 100644 --- a/packages/layers/package.json +++ b/packages/layers/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-layers", - "version": "2.6.8", + "version": "2.6.9", "description": "L7's collection of built-in layers", "main": "lib/index.js", "module": "es/index.js", @@ -24,9 +24,9 @@ "license": "ISC", "dependencies": { "@antv/geo-coord": "^1.0.8", - "@antv/l7-core": "^2.6.8", - "@antv/l7-source": "^2.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-source": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "@mapbox/martini": "^0.2.0", "@turf/meta": "^6.0.2", diff --git a/packages/map/package.json b/packages/map/package.json index da088b9c10..5e14f5ec7a 100644 --- a/packages/map/package.json +++ b/packages/map/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-map", - "version": "2.6.8", + "version": "2.6.9", "description": "l7 map", "keywords": [], "author": "thinkinggis ", @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-utils": "^2.6.8", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "@mapbox/point-geometry": "^0.1.0", "@mapbox/unitbezier": "^0.0.0", diff --git a/packages/maps/package.json b/packages/maps/package.json index 9cf97ddd55..bbd91e3ec3 100644 --- a/packages/maps/package.json +++ b/packages/maps/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-maps", - "version": "2.6.8", + "version": "2.6.9", "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.6.8", - "@antv/l7-map": "^2.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-map": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "@types/amap-js-api": "^1.4.6", "@types/mapbox-gl": "^1.11.2", diff --git a/packages/mini/package.json b/packages/mini/package.json index efde05a432..234b5ca0dc 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-mini", - "version": "2.6.8", + "version": "2.6.9", "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.6.8", - "@antv/l7-layers": "^2.6.8", - "@antv/l7-maps": "^2.6.8", - "@antv/l7-scene": "^2.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-layers": "^2.6.9", + "@antv/l7-maps": "^2.6.9", + "@antv/l7-scene": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7" }, "gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31", diff --git a/packages/renderer/package.json b/packages/renderer/package.json index 87afcf104b..3b765cb43a 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-renderer", - "version": "2.6.8", + "version": "2.6.9", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -26,7 +26,7 @@ "gl": "^4.4.0" }, "dependencies": { - "@antv/l7-core": "^2.6.8", + "@antv/l7-core": "^2.6.9", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "l7regl": "^0.0.16", diff --git a/packages/renderer/src/regl/ReglTexture2D.ts b/packages/renderer/src/regl/ReglTexture2D.ts index c212804c8e..f9c8dff253 100644 --- a/packages/renderer/src/regl/ReglTexture2D.ts +++ b/packages/renderer/src/regl/ReglTexture2D.ts @@ -17,6 +17,7 @@ export default class ReglTexture2D implements ITexture2D { private texture: regl.Texture2D; private width: number; private height: number; + private isDistroy: boolean = false; constructor(reGl: regl.Regl, options: ITexture2DInitializationOptions) { const { @@ -89,6 +90,9 @@ export default class ReglTexture2D implements ITexture2D { } public destroy() { - this.texture.destroy(); + if (!this.isDistroy) { + this.texture.destroy(); + } + this.isDistroy = true; } } diff --git a/packages/scene/package.json b/packages/scene/package.json index 02b7d77e30..1b0aa17750 100644 --- a/packages/scene/package.json +++ b/packages/scene/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-scene", - "version": "2.6.8", + "version": "2.6.9", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -23,12 +23,12 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/l7-component": "^2.6.8", - "@antv/l7-core": "^2.6.8", - "@antv/l7-layers": "^2.6.8", - "@antv/l7-maps": "^2.6.8", - "@antv/l7-renderer": "^2.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-component": "^2.6.9", + "@antv/l7-core": "^2.6.9", + "@antv/l7-layers": "^2.6.9", + "@antv/l7-maps": "^2.6.9", + "@antv/l7-renderer": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "mapbox-gl": "^1.2.1", diff --git a/packages/source/package.json b/packages/source/package.json index 95634b83d9..40ccbed2ab 100644 --- a/packages/source/package.json +++ b/packages/source/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-source", - "version": "2.6.8", + "version": "2.6.9", "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.6.8", - "@antv/l7-utils": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-utils": "^2.6.9", "@babel/runtime": "^7.7.7", "@mapbox/geojson-rewind": "^0.4.0", "@turf/helpers": "^6.1.4", diff --git a/packages/three/package.json b/packages/three/package.json index 32329dc20d..ac5040c32e 100644 --- a/packages/three/package.json +++ b/packages/three/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-three", - "version": "2.6.8", + "version": "2.6.9", "description": "three for L7 ", "keywords": [ "3D", @@ -44,9 +44,9 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - "@antv/l7-core": "^2.6.8", - "@antv/l7-layers": "^2.6.8", - "@antv/l7-scene": "^2.6.8", + "@antv/l7-core": "^2.6.9", + "@antv/l7-layers": "^2.6.9", + "@antv/l7-scene": "^2.6.9", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "reflect-metadata": "^0.1.13", diff --git a/packages/utils/package.json b/packages/utils/package.json index d7e8307fed..3fa08d879a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-utils", - "version": "2.6.8", + "version": "2.6.9", "description": "", "main": "lib/index.js", "module": "es/index.js", diff --git a/stories/Map/components/mapCenter.tsx b/stories/Map/components/mapCenter.tsx index 01fb3d8b8a..c64c20accc 100644 --- a/stories/Map/components/mapCenter.tsx +++ b/stories/Map/components/mapCenter.tsx @@ -17,7 +17,7 @@ export default class GaodeMapComponent extends React.Component { map: new GaodeMap({ center: [121.107846, 30.267069], pitch: 0, - // style: 'normal', + style: 'dark', zoom: 20, animateEnable: false, }), @@ -28,7 +28,7 @@ export default class GaodeMapComponent extends React.Component { // min = 'min', // max = 'max', // none = 'none', - const layer = new PointLayer({ zIndex: 2 }) + const layer = new PointLayer({ zIndex: 2, blend: 'additive' }) .source( [ { @@ -50,17 +50,16 @@ export default class GaodeMapComponent extends React.Component { ) .shape('circle') // .shape('normal') - .color('blue') - .size(10) + .color('#1990FF') + .size(20) .style({ stroke: '#fff', storkeWidth: 2, - // offsets: [100, 100], }); this.scene = scene; - const linelayer = new LineLayer({}) + const linelayer = new LineLayer({ blend: 'additive' }) .source({ type: 'FeatureCollection', features: [ @@ -80,14 +79,17 @@ export default class GaodeMapComponent extends React.Component { ], }) .shape('line') - .color('#0ff') + .color('#78FFFF') .size(10); scene.on('loaded', () => { - scene.addLayer(linelayer); + // scene.addLayer(linelayer); scene.addLayer(layer); }); layer.on('click', () => console.log('point click')); + layer.on('mousemove', (e) => { + console.log(e.feature); + }); linelayer.on('click', () => console.log('line click')); } diff --git a/stories/customMap/components/Map.tsx b/stories/customMap/components/Map.tsx index 1462ed0016..6bf8cb55ba 100644 --- a/stories/customMap/components/Map.tsx +++ b/stories/customMap/components/Map.tsx @@ -1,7 +1,7 @@ import { Scene, PolygonLayer, PointLayer, Map } from '@antv/l7-mini'; // import { Scene } from '@antv/l7'; // import { PolygonLayer, PointLayer } from '@antv/l7-layers'; -import { GaodeMap } from '@antv/l7-maps'; +import { GaodeMap, Mapbox } from '@antv/l7-maps'; import * as React from 'react'; export default class ScaleComponent extends React.Component { @@ -9,7 +9,6 @@ export default class ScaleComponent extends React.Component { const scene = new Scene({ id: 'map', map: new GaodeMap({ - hash: true, center: [105, 32], pitch: 0, zoom: 3, @@ -42,12 +41,6 @@ export default class ScaleComponent extends React.Component { dir: 'in', // in - out }, }); - scene.addLayer(layer); - - scene.fitBounds([ - [48.073279, 3.067261], - [160.573279, 54.003394], - ]); const layer2 = new PolygonLayer({ blend: 'normal' }) .source(data) @@ -65,7 +58,17 @@ export default class ScaleComponent extends React.Component { .style({ opacity: 1.0, }); - scene.addLayer(layer2); + + scene.on('loaded', () => { + scene.addLayer(layer); + scene.addLayer(layer2); + scene.fitBounds([ + [48.073279, 3.067261], + [160.573279, 54.003394], + ]); + + console.log('getBounds', scene.getBounds()); + }); }); }