From 1fcd1f06a074282a4a21c52beafa3b07beec49aa Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+2912401452@users.noreply.github.com> Date: Tue, 21 Dec 2021 15:48:35 +0800 Subject: [PATCH] Shihuidev (#888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 增加着色器的拾取计算控制、完善 arcmini * feat: 完善 enableShaderPick/disableShaderPick 功能 * style: lint style * feat: 补充调用高德地图公交线路查询 demo * style: lint style * feat: 优化弧线的纹理动画 * style: lint style * feat: 去除greatCircle 的纹理动画优化 * feat: 扩展点图层圆柱效果 * feat: 增加几何体的径向渐变配置 * style: lint style * fix: 修复bug 图层触发的事件跟图层设置的zIndex无关,只跟插入图层先后顺序有关 * style: lint style * feat: 补全挤出几何体拾取颜色的光照配置 * style: lint style * fix: 修复圆柱 cull 问题 mapbox amap 不同 * feat: 图层销毁时的内存泄漏 * style: lint style * feat: 平面弧线新增弧线偏移量的数据映射能力 * style: lint style * fix: 修复重复销毁bug * style: lint style * feat: 修复 texture 重复销毁问题 * style: lint style * fix: 修复图层叠加模式下的拾取失效问题 * style: lint style * fix: 修复纹理贴图在 zoom 大于 12 时存在的问题 * fix: 修复水波点颜色偏暗 * feat: 优化点图层的渲染效果,叠加渲染效果 * style: lint style * fix: 修复 layer contextmenu 事件丢失 * fix: 修复 map 类型 resize 失效 * style: lint style * feat: 增加瓦片地图的请求节流 * style: lint style * feat: 优化热力图在 radius 数值比较大时热力点边缘发生裁剪的现象 * style: lint style * fix: 修复resize 后 picking shiqu 拾取失败的问题 * feat: 优化 marker/popup 在容器边缘的表现 * feat: 增加 setEnableRender 方法 * style: lint style * feat: 增加城市图层扫光特效 * style: lint style * feat: 补全拾取色混合配置 * style: lint style * feat: 增加高德地图的面积大小点 * style: lint style * feat: 点优化边缘锯齿 * feat: add declaration layers * feat: 调整点图层 version 的引入 * style: lint style * fix: 修复pointLayer stroke 变暗问题 --- packages/layers/src/point/models/fill.ts | 2 +- .../layers/src/point/shaders/fill_frag.glsl | 18 ++++++++++++++---- packages/maps/src/index.ts | 3 ++- stories/Map/components/mapCenter.tsx | 5 +++-- typings.d.ts | 3 ++- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/layers/src/point/models/fill.ts b/packages/layers/src/point/models/fill.ts index 1c85d22b24..18c072963f 100644 --- a/packages/layers/src/point/models/fill.ts +++ b/packages/layers/src/point/models/fill.ts @@ -23,8 +23,8 @@ import pointFillVert from '../shaders/fill_vert.glsl'; import { isNumber } from 'lodash'; +import { Version } from '@antv/l7-maps'; import { mat4, vec3 } from 'gl-matrix'; -import { Version } from '../../../../maps/src/version'; interface IPointLayerStyleOptions { opacity: styleSingle; strokeWidth: styleSingle; diff --git a/packages/layers/src/point/shaders/fill_frag.glsl b/packages/layers/src/point/shaders/fill_frag.glsl index abfec4fa9b..52285d9ece 100644 --- a/packages/layers/src/point/shaders/fill_frag.glsl +++ b/packages/layers/src/point/shaders/fill_frag.glsl @@ -71,7 +71,7 @@ void main() { // 付出的代价是边缘会有一些锯齿 if(outer_df > antialiasblur + 0.018) discard; } - float opacity_t = smoothstep(0.0, antialiasblur, outer_df); + float opacity_t = smoothstep(0.0, antialiasblur, outer_df); float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep( antialiasblur, @@ -82,7 +82,13 @@ void main() { float N_RINGS = 3.0; float FREQ = 1.0; - gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t); + if(strokeWidth < 0.01) { + gl_FragColor = vec4(v_color.rgb, v_color.a * opacity); + } else { + gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t); + } + + // gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t); if(u_aimate.x == Animate) { float d = length(v_data.xy); @@ -105,10 +111,14 @@ void main() { } else { gl_FragColor = filterColor(gl_FragColor); } - } else { gl_FragColor = filterColor(gl_FragColor); + } - gl_FragColor *= opacity_t; + if(u_additive > 0.0) { + gl_FragColor *= opacity_t; + } else { + gl_FragColor.a *= opacity_t; + } } diff --git a/packages/maps/src/index.ts b/packages/maps/src/index.ts index c88b7cae20..b670d1a063 100644 --- a/packages/maps/src/index.ts +++ b/packages/maps/src/index.ts @@ -5,7 +5,8 @@ import Earth from './earth/'; // import GaodeMapV2 from './amap2/'; import Map from './map/'; import Mapbox from './mapbox/'; +import { Version } from './version'; -export { GaodeMap, GaodeMapV2, Mapbox, Map, Earth }; +export { Version, GaodeMap, GaodeMapV2, Mapbox, Map, Earth }; // export { GaodeMap, GaodeMapV2, Mapbox, Map }; // export { Map }; diff --git a/stories/Map/components/mapCenter.tsx b/stories/Map/components/mapCenter.tsx index 8cac7cf114..2cc949284f 100644 --- a/stories/Map/components/mapCenter.tsx +++ b/stories/Map/components/mapCenter.tsx @@ -78,13 +78,14 @@ export default class GaodeMapComponent extends React.Component { }, ) .shape('circle') - .color('#00f') + .color('#0f9') .size(circleRadius) .style({ stroke: '#f00', // strokeWidth: 10, + strokeWidth: 0, strokeOpacity: 1, - unit: 'meter', + // unit: 'meter', }) // .animate(true) .active({ color: '#00f' }); diff --git a/typings.d.ts b/typings.d.ts index dc0cfefb65..5828f93260 100644 --- a/typings.d.ts +++ b/typings.d.ts @@ -1,2 +1,3 @@ declare module '@antv/l7'; -declare module '@antv/l7-core'; \ No newline at end of file +declare module '@antv/l7-core'; +declare module '@antv/l7-layers'; \ No newline at end of file