Conversation
- 统一 Zoom 偏移机制,支持 bmap/tmap/gmap 不同偏移量 - 补全 tdtmap/earth/amap-next 缺失方法 - 修复 gmap setMapStyle 调用错误 - 删除 tmap/gmap 错误 getMapStyleConfig 方法 - 添加多底图切换 demo
- 修复 fill/fillImage/radar/earthFill shader 中 applyAnchor 垂直方向偏移 - 修复 symbol-layout.ts 中 bottom/top 的 verticalAlign 方向 - 添加 bottom-center anchor 支持(anchorType=9) - 修复 Marker/Popup 的 anchor 工具函数,补齐 BOTTOM-RIGHT - 更新 demo 和测试用例
- top: 补偿 yOffset 使文字顶部正确对齐坐标点 - bottom: 补偿 yOffset 使文字底部正确对齐坐标点 - center: 保持 yOffset 偏移,文字视觉中心对齐坐标点
- 移除多余空行 - 统一代码风格
…demo improvements
- 使用 OverlayView + MapCanvasProjection 实现每帧同步(参考 deck.gl) - 通过 fromLatLngToDivPixel 计算 fractional zoom,解决整数跳变 - 用 fromContainerPixelToLatLng 获取动画帧真实视口中心 - containerToLngLat/lngLatToContainer 优先使用 MapCanvasProjection - disableDefaultUI 隐藏所有默认控件 - 修复百度/腾讯/天地图 viewport 空值保护和缩放同步 - 添加 Google/百度/腾讯地图 demo 配置
# Conflicts: # packages/component/package.json # packages/core/package.json # packages/l7/package.json # packages/layers/package.json # packages/map/package.json # packages/maps/package.json # packages/maps/src/gmap/map.ts # packages/maps/src/tmap/map.ts # packages/renderer/package.json # packages/scene/package.json # packages/source/package.json # packages/test-utils/package.json # packages/three/package.json # packages/utils/package.json
|
There was a problem hiding this comment.
Code Review
This pull request introduces the anchor style property for 2D shapes in PointLayer to control alignment relative to coordinate points, complete with documentation and new demos. It also refactors the Google Maps integration (GMapService) to use OverlayView for accurate camera synchronization and adds default API tokens for map providers in examples. The review feedback highlights several critical issues: using Unicode escape sequences instead of HTML entities in the iconfont demo, adding defensive checks for potential null values returned by Google Maps projection methods to prevent runtime crashes, avoiding hardcoded API keys in example utilities, and resolving a potential memory leak in the Tencent Map service caused by an un-cleared anonymous DOM event listener.
| scene.addIconFonts([ | ||
| ['smallRain', ''], | ||
| ['middleRain', ''], | ||
| ['hugeRain', ''], | ||
| ['sun', ''], | ||
| ['cloud', ''], | ||
| ]); |
There was a problem hiding this comment.
The iconfont demo uses HTML entities (e.g., '') which are not parsed correctly in JS/TS strings. They should be replaced with Unicode escape sequences (e.g., '\ue6f7'), matching the fix applied in site/examples/point/text/demo/iconfonts.js.
| scene.addIconFonts([ | |
| ['smallRain', ''], | |
| ['middleRain', ''], | |
| ['hugeRain', ''], | |
| ['sun', ''], | |
| ['cloud', ''], | |
| ]); | |
| scene.addIconFonts([ | |
| ['smallRain', '\ue6f7'], | |
| ['middleRain', '\ue61c'], | |
| ['hugeRain', '\ue6a6'], | |
| ['sun', '\ue6da'], | |
| ['cloud', '\ue8da'], | |
| ]); |
| const topRight = projection.fromLatLngToPoint(ne); | ||
| const bottomLeft = projection.fromLatLngToPoint(sw); | ||
| const { width, height } = this.getMapSize(); | ||
| let worldWidth = topRight.x - bottomLeft.x; | ||
| if (worldWidth <= 0) worldWidth += 256; | ||
| const worldX = bottomLeft.x + (x / width) * worldWidth; | ||
| const worldY = topRight.y + (y / height) * (bottomLeft.y - topRight.y); | ||
| const latLng = projection.fromPointToLatLng(new google.maps.Point(worldX, worldY)); | ||
| return { lng: latLng.lng(), lat: latLng.lat() }; |
There was a problem hiding this comment.
Both projection.fromLatLngToPoint and projection.fromPointToLatLng can return null. We should add defensive checks for topRight, bottomLeft, and latLng to prevent potential runtime crashes.
const topRight = projection.fromLatLngToPoint(ne);
const bottomLeft = projection.fromLatLngToPoint(sw);
if (!topRight || !bottomLeft) {
return { lng: 0, lat: 0 };
}
const { width, height } = this.getMapSize();
let worldWidth = topRight.x - bottomLeft.x;
if (worldWidth <= 0) worldWidth += 256;
const worldX = bottomLeft.x + (x / width) * worldWidth;
const worldY = topRight.y + (y / height) * (bottomLeft.y - topRight.y);
const latLng = projection.fromPointToLatLng(new google.maps.Point(worldX, worldY));
if (!latLng) {
return { lng: 0, lat: 0 };
}
return { lng: latLng.lng(), lat: latLng.lat() };| const DEFAULT_TOKENS: Record<string, string> = { | ||
| GoogleMap: 'AIzaSyA6U7oKLKbPVUicuCaGQ25_zIMep-zGBcU', | ||
| BaiduMap: 'ShSrOHgrilK8rvaXV6kHC8vwxgnvF3CV', | ||
| TencentMap: 'VZ2BZ-EZ7KZ-D4RXM-TZQDP-Q3PQH-TVF5L', | ||
| TMap: 'b15e548080c79819617367d3f6095c69', | ||
| }; |
| if (eventName === 'mouseover') { | ||
| this.map.getContainer().addEventListener('mouseover', (e) => { | ||
| this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e)); | ||
| handleProxy({ type: e.type, originalEvent: e }); | ||
| }); | ||
| } |
There was a problem hiding this comment.
- 新增各地图独立入口文件(gaode/baidu/google/mapbox/maplibre/tencent/tianditu/earth/simple)
- 更新 package.json 添加 exports 字段,支持 @antv/l7-maps/gaode 等子路径导入
- 修复各地图目录 index.ts 的导出命名一致性
- 向后兼容:原有全量导入方式不受影响
使用方式:
import { GaodeMap } from '@antv/l7-maps/gaode' // 按需加载
import { GaodeMap } from '@antv/l7-maps' // 全量导入(向后兼容)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
[English Template / 英文模板]
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
☑️ 请求合并前的自查清单