Skip to content

Commit 8e80487

Browse files
authored
chore: 通过ID 移除图层&fillimage 镜像问题 (#2736)
* feat: 相对坐标模式 * feat: 支持相对坐标系 * chore: ci node 版本20 * fix: code formatting issues for CI * fix: resolve GL native bindings and Jest memory issues - Rebuild gl package native bindings to fix webgl.node missing error - Configure Jest to run tests serially (maxWorkers: 1) to avoid GL context conflicts - Add memory limits and Node.js heap size increase to prevent SIGABRT crashes - Add missing @eslint/js dependency for ESLint configuration - All 87 test suites now pass including citybuliding layer tests Fixes GL context creation issues in Jest environment that were causing worker processes to crash with SIGABRT errors due to memory limitations and concurrent GL context creation. * chore: 更新单测配置 * fix: prettier error * chore: lint error * chore: lint error * test: update integration test snapshots - Remove -actual suffix from snapshot files - Update existing snapshot files to match current rendering output - Clean up unused snapshot files * chore: 添加变更集 * feat: add changeset for relative coordinate system support - Add changeset for layer relative coordinate system feature - Mark all L7 packages as minor version bump - Update changeset description * chore: 更新变更集 * chore: 更新变更集 * chore: 设置私有 * chore: 设置为私有 * chore: 优化layer 移除方法 * fix: 修复 fillImage 点图层图片镜像翻转问题 - 在着色器中对UV坐标进行X和Y轴翻转 - 解决图片绘制时的镜像翻转问题
1 parent f57ea4a commit 8e80487

6 files changed

Lines changed: 26 additions & 10 deletions

File tree

examples/demos/point/fill-image.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export const fillImage: TestCase = async (options) => {
1212
},
1313
});
1414

15+
await scene.addImage(
16+
'car',
17+
'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*AtZnTYIlkbwAAAAAQGAAAAgAemJ7AQ/original',
18+
);
1519
await scene.addImage(
1620
'marker',
1721
'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ',
@@ -23,7 +27,7 @@ export const fillImage: TestCase = async (options) => {
2327
{
2428
lng: 120,
2529
lat: 30,
26-
name: 'marker',
30+
name: 'car',
2731
},
2832
],
2933
{
@@ -35,9 +39,9 @@ export const fillImage: TestCase = async (options) => {
3539
},
3640
)
3741
.style({
38-
unit: 'meter',
42+
rotation: 0,
3943
})
40-
.shape('marker')
44+
.shape('car')
4145
.size(36);
4246

4347
const pointLayer2 = new PointLayer({ layerType: 'fillImage' })
@@ -58,10 +62,10 @@ export const fillImage: TestCase = async (options) => {
5862
},
5963
)
6064
.shape('marker')
61-
.size(36)
65+
.size(20)
6266
.active(true)
6367
.style({
64-
rotation: 90,
68+
rotation: 0,
6569
});
6670

6771
scene.addLayer(pointLayer);

examples/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
}
3030
</style>
3131
<script>
32+
window.forceWebGL = true
3233
window._AMapSecurityConfig = {
3334
securityJsCode: '290ddc4b0d33be7bc9b354bc6a4ca614',
3435
};
3536
</script>
36-
<script src="https://webapi.amap.com/maps?v=2.0&key=6f025e700cbacbb0bb866712d20bb35c"></script>
37+
<script src="https://webapi.amap.com/maps?v=2.0.5&key=6f025e700cbacbb0bb866712d20bb35c"></script>
3738
<script type="module" src="./index.tsx"></script>
3839
<div id="root"></div>
3940
</html>

packages/core/src/services/layer/LayerService.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,19 @@ export default class LayerService extends EventEmitter<LayerServiceEvent> implem
104104
}
105105

106106
public async remove(layer: ILayer, parentLayer?: ILayer): Promise<void> {
107-
// Tip: layer.layerChildren 当 layer 存在子图层的情况
108107
if (parentLayer) {
109-
parentLayer.layerChildren = parentLayer.layerChildren.filter((item) => item !== layer);
108+
if (!parentLayer.layerChildren) {
109+
parentLayer.layerChildren = [];
110+
}
111+
const index = parentLayer.layerChildren.findIndex((item) => item.id === layer.id);
112+
if (index > -1) {
113+
parentLayer.layerChildren.splice(index, 1);
114+
}
110115
} else {
111-
this.layers = this.layers.filter((item) => item !== layer);
116+
const index = this.layers.findIndex((item) => item.id === layer.id);
117+
if (index > -1) {
118+
this.layers.splice(index, 1);
119+
}
112120
}
113121
layer.destroy();
114122
this.reRender();

packages/layers/src/point/shaders/fillImage/fillImage_vert.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ out float v_opacity;
2323
void main() {
2424
vec3 extrude = a_Extrude;
2525
v_uv = (a_Extrude.xy + 1.0) / 2.0;
26+
v_uv.x = 1.0 - v_uv.x;
2627
v_uv.y = 1.0 - v_uv.y;
2728
v_Iconuv = a_Uv;
2829
v_opacity = opacity;

packages/maps/src/amap-next/map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { MapTheme } from './theme';
2222
const AMAP_VERSION = '2.0';
2323
const AMAP_API_KEY = 'f59bcf249433f8b05caaee19f349b3d7';
2424
const ZOOM_OFFSET = 1;
25+
// @ts-ignore 高德地图强制使用 WebGL,否则支付宝端内无法使用
26+
window.forceWebGL = true;
2527

2628
const AMapEventMapV2: Record<string, string> = {
2729
contextmenu: 'rightclick',

packages/test-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@antv/l7-test-utils",
33
"version": "2.22.6",
4-
"private": false,
4+
"private": true,
55
"description": "Test utils for L7",
66
"keywords": [],
77
"homepage": "https://github.com/antvis/L7#readme",

0 commit comments

Comments
 (0)