Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/true-lamps-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@antv/l7-component': patch
'@antv/l7-layers': patch
'@antv/l7-source': patch
'@antv/l7-core': patch
'@antv/l7-maps': patch
'@antv/l7-map': patch
'@antv/l7': patch
---

相对坐标系支持
14 changes: 9 additions & 5 deletions examples/demos/point/fill-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export const fillImage: TestCase = async (options) => {
},
});

await scene.addImage(
'car',
'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*AtZnTYIlkbwAAAAAQGAAAAgAemJ7AQ/original',
);
await scene.addImage(
'marker',
'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ',
Expand All @@ -23,7 +27,7 @@ export const fillImage: TestCase = async (options) => {
{
lng: 120,
lat: 30,
name: 'marker',
name: 'car',
},
],
{
Expand All @@ -35,9 +39,9 @@ export const fillImage: TestCase = async (options) => {
},
)
.style({
unit: 'meter',
rotation: 0,
})
.shape('marker')
.shape('car')
.size(36);

const pointLayer2 = new PointLayer({ layerType: 'fillImage' })
Expand All @@ -58,10 +62,10 @@ export const fillImage: TestCase = async (options) => {
},
)
.shape('marker')
.size(36)
.size(20)
.active(true)
.style({
rotation: 90,
rotation: 0,
});

scene.addLayer(pointLayer);
Expand Down
3 changes: 2 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
}
</style>
<script>
window.forceWebGL = true
window._AMapSecurityConfig = {
securityJsCode: '290ddc4b0d33be7bc9b354bc6a4ca614',
};
</script>
<script src="https://webapi.amap.com/maps?v=2.0&key=6f025e700cbacbb0bb866712d20bb35c"></script>
<script src="https://webapi.amap.com/maps?v=2.0.5&key=6f025e700cbacbb0bb866712d20bb35c"></script>
<script type="module" src="./index.tsx"></script>
<div id="root"></div>
</html>
14 changes: 11 additions & 3 deletions packages/core/src/services/layer/LayerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ export default class LayerService extends EventEmitter<LayerServiceEvent> implem
}

public async remove(layer: ILayer, parentLayer?: ILayer): Promise<void> {
// Tip: layer.layerChildren 当 layer 存在子图层的情况
if (parentLayer) {
parentLayer.layerChildren = parentLayer.layerChildren.filter((item) => item !== layer);
if (!parentLayer.layerChildren) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确保parentLayer.layerChildren存在以避免潜在的undefined错误。

parentLayer.layerChildren = [];
}
const index = parentLayer.layerChildren.findIndex((item) => item.id === layer.id);
if (index > -1) {
parentLayer.layerChildren.splice(index, 1);
}
} else {
this.layers = this.layers.filter((item) => item !== layer);
const index = this.layers.findIndex((item) => item.id === layer.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确保this.layers中存在要移除的图层以避免潜在的undefined错误。

if (index > -1) {
this.layers.splice(index, 1);
}
}
layer.destroy();
this.reRender();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ out float v_opacity;
void main() {
vec3 extrude = a_Extrude;
v_uv = (a_Extrude.xy + 1.0) / 2.0;
v_uv.x = 1.0 - v_uv.x;
v_uv.y = 1.0 - v_uv.y;
v_Iconuv = a_Uv;
v_opacity = opacity;
Expand Down
2 changes: 2 additions & 0 deletions packages/maps/src/amap-next/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { MapTheme } from './theme';
const AMAP_VERSION = '2.0';
const AMAP_API_KEY = 'f59bcf249433f8b05caaee19f349b3d7';
const ZOOM_OFFSET = 1;
// @ts-ignore 高德地图强制使用 WebGL,否则支付宝端内无法使用
window.forceWebGL = true;

const AMapEventMapV2: Record<string, string> = {
contextmenu: 'rightclick',
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@antv/l7-test-utils",
"version": "2.22.6",
"private": false,
"private": true,
"description": "Test utils for L7",
"keywords": [],
"homepage": "https://github.com/antvis/L7#readme",
Expand Down
Loading