From 3543438eef8f010e48006792163fcc2636204da7 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 22 Apr 2020 21:16:53 +0800 Subject: [PATCH] =?UTF-8?q?improvement:=20renderservice=20add=20setdirty?= =?UTF-8?q?=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/changelog.zh.md | 14 +++++++++----- .../core/src/services/renderer/IRendererService.ts | 2 ++ packages/layers/src/point/models/image.ts | 4 +++- packages/renderer/src/regl/index.ts | 9 +++++++++ packages/three/package.json | 3 +-- packages/three/src/core/baseLayer.ts | 2 ++ yarn.lock | 13 +++++++++++++ 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/docs/api/changelog.zh.md b/docs/api/changelog.zh.md index 5dbe21d6a8..e9c9053a0e 100644 --- a/docs/api/changelog.zh.md +++ b/docs/api/changelog.zh.md @@ -2,12 +2,16 @@ title: 发布日志 order: 10 --- + ## 2020.04.20 2.2 正式版本 ###✨ Features + #### [L7-Draw 地图绘制组件发布](../draw/start) + 支持基础图形绘制、平移、修改、删除 -- 绘制UI组件支持 + +- 绘制 UI 组件支持 - 绘制圆形 - 绘制矩形 - 绘制点 @@ -15,18 +19,18 @@ order: 10 - 绘制面 ### 🍏 Improvements -- 要素拾取支持添加buffer + +- 要素拾取支持添加 buffer - 图层拾取支持冒泡机制,默认拾取最上层 ### 🐞 Bug Fixes + - pointLayer 聚合支持多种数据格式化 - 修复热力图移动端不能正常渲染 -- 修复3D热力图高德地图正使用 +- 修复 3D 热力图高德地图正使用 - L7 版本锁定 - 修复点图层描边模糊问题 - - ## 2020.03.12 2.1 正式版 ###✨ Features diff --git a/packages/core/src/services/renderer/IRendererService.ts b/packages/core/src/services/renderer/IRendererService.ts index a349eacbdd..bf6c9de393 100644 --- a/packages/core/src/services/renderer/IRendererService.ts +++ b/packages/core/src/services/renderer/IRendererService.ts @@ -62,5 +62,7 @@ export interface IRendererService { readPixels(options: IReadPixelsOptions): Uint8Array; setBaseState(): void; setCustomLayerDefaults(): void; + setDirty(flag: boolean): void; + getDirty(): boolean; destroy(): void; } diff --git a/packages/layers/src/point/models/image.ts b/packages/layers/src/point/models/image.ts index e439c4591f..44d3719889 100644 --- a/packages/layers/src/point/models/image.ts +++ b/packages/layers/src/point/models/image.ts @@ -20,7 +20,9 @@ export default class ImageModel extends BaseModel { public getUninforms(): IModelUniform { const { opacity } = this.layer.getLayerConfig() as IImageLayerStyleOptions; - this.texture.update(); + if (this.rendererService.getDirty()) { + this.texture.update(); + } return { u_opacity: opacity || 1.0, u_texture: this.texture, diff --git a/packages/renderer/src/regl/index.ts b/packages/renderer/src/regl/index.ts index 8ab2a06cb6..43dc6f1027 100644 --- a/packages/renderer/src/regl/index.ts +++ b/packages/renderer/src/regl/index.ts @@ -38,6 +38,7 @@ export default class ReglRendererService implements IRendererService { private $container: HTMLDivElement | null; private width: number; private height: number; + private isDirty: boolean; public async init( $container: HTMLDivElement, @@ -211,6 +212,14 @@ export default class ReglRendererService implements IRendererService { gl.disable(gl.CULL_FACE); } + public setDirty(flag: boolean): void { + this.isDirty = flag; + } + + public getDirty(): boolean { + return this.isDirty; + } + public destroy = () => { // @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clean-up this.gl.destroy(); diff --git a/packages/three/package.json b/packages/three/package.json index a6b6e89feb..d3c526857e 100644 --- a/packages/three/package.json +++ b/packages/three/package.json @@ -39,8 +39,7 @@ }, "homepage": "https://github.com/antvis/L7#readme", "dependencies": { - - "@antv/l7": "2.1.15", + "@antv/l7": "2.2.0", "@babel/runtime": "^7.7.7", "rollup": "^2.3.3", "rollup-plugin-less": "^1.1.2" diff --git a/packages/three/src/core/baseLayer.ts b/packages/three/src/core/baseLayer.ts index a6abfcdf6b..53bdbedd30 100644 --- a/packages/three/src/core/baseLayer.ts +++ b/packages/three/src/core/baseLayer.ts @@ -82,6 +82,7 @@ export default class ThreeJSLayer mixer.update(this.getTime()); }); this.rendererService.setBaseState(); + this.rendererService.setDirty(true); return this; } @@ -99,6 +100,7 @@ export default class ThreeJSLayer mixer.update(this.getTime()); }); this.rendererService.setBaseState(); + this.rendererService.setDirty(true); return this; } diff --git a/yarn.lock b/yarn.lock index b192bd07b7..9f90d54215 100644 --- a/yarn.lock +++ b/yarn.lock @@ -202,6 +202,19 @@ resolved "https://registry.npmjs.org/@antv/gl-matrix/-/gl-matrix-2.7.1.tgz#acb8e37f7ab3df01345aba4372d7942be42eba14" integrity sha512-oOWcVNlpELIKi9x+Mm1Vwbz8pXfkbJKykoCIOJ/dNK79hSIANbpXJ5d3Rra9/wZqK6MC961B7sybFhPlLraT3Q== +"@antv/l7@2.1.15": + version "2.1.15" + resolved "https://registry.npmjs.org/@antv/l7/-/l7-2.1.15.tgz#27121b8f22838b5ad17114a1b2895389b6b0a800" + integrity sha512-goR3M1e2YXXEo5jp/QYd1VF9rKoAy/DlKrJ5KLE/jhzuqgw9Kp0iHSOaGE+M7tFIyL8hCoG8JXHmAK1tVyeaIw== + dependencies: + "@antv/l7-component" "^2.1.15" + "@antv/l7-core" "^2.1.15" + "@antv/l7-layers" "^2.1.15" + "@antv/l7-maps" "^2.1.15" + "@antv/l7-scene" "^2.1.15" + "@antv/l7-utils" "^2.1.15" + "@babel/runtime" "^7.7.7" + "@antv/scale@~0.1.1": version "0.1.5" resolved "https://registry.npmjs.org/@antv/scale/-/scale-0.1.5.tgz#243266e8b9047cf64b2fdfc40f9834cf0846496e"