Skip to content

Commit

Permalink
[fix]mapboxgl popup事件穿透
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Jul 17, 2024
1 parent 306d358 commit ef26e7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class InteractionService
}

private addEventListenerOnMap() {
const $containter = this.mapService.getMapContainer();
const $containter = (this.mapService.getMapCanvasContainer && this.mapService.getMapCanvasContainer()) || this.mapService.getMapContainer();
if ($containter) {
if (isMini) {
$window.document.addEventListener(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/services/map/IMapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface IMapService<RawMap = {}> {
getRotation(): number;
getBounds(): Bounds;
getMapContainer(): HTMLElement | null;
getMapCanvasContainer(): HTMLElement;
getMapCanvasContainer(): HTMLElement | null;
getMapStyleConfig(): MapStyleConfig; // 获取当前地图类型默认的样式配置
getMapStyleValue(name: MapStyleName): string | any; // 获取当前地图类型key值对应的样式 value,可能为字符串,也可能为对象
getMapStyle(): MapStyleName | any; // 获取当期地图
Expand Down
7 changes: 7 additions & 0 deletions packages/maps/src/mapbox/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ export default class MapboxService extends BaseMapService<
return this.$mapContainer;
}

public getMapCanvasContainer() {
if (this.$mapContainer) {
return this.$mapContainer.getElementsByClassName('mapboxgl-canvas-container')[0]
}
return this.$mapContainer;
}

public meterToCoord(center: [number, number], outer: [number, number]) {
// 统一根据经纬度来转化
// Tip: 实际米距离 unit meter
Expand Down

0 comments on commit ef26e7b

Please sign in to comment.