diff --git a/packages/maps/src/amap/map.ts b/packages/maps/src/amap/map.ts index 43c0125d83..629088d1c9 100644 --- a/packages/maps/src/amap/map.ts +++ b/packages/maps/src/amap/map.ts @@ -30,6 +30,7 @@ import { Version } from '../version'; import './logo.css'; import { MapTheme } from './theme'; import Viewport from './Viewport'; +import SimpleMapCoord from '../simpleMapCoord'; let mapdivCount = 0; // @ts-ignore window.forceWebGL = true; @@ -57,7 +58,7 @@ const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; // 暂时关闭 fix 统一不同坐标 export default class AMapService implements IMapService { public version: string = Version['GAODE1.x']; - public simpleMapCoord: SimpleCoordinate; + public simpleMapCoord: SimpleCoordinate = new SimpleMapCoord(); /** * 原始地图实例 */ diff --git a/packages/maps/src/amap2/map.ts b/packages/maps/src/amap2/map.ts index c496dffa78..e1ecd80c02 100644 --- a/packages/maps/src/amap2/map.ts +++ b/packages/maps/src/amap2/map.ts @@ -24,7 +24,7 @@ import { DOM } from '@antv/l7-utils'; import { mat4, vec2, vec3 } from 'gl-matrix'; import { inject, injectable } from 'inversify'; import 'reflect-metadata'; -import { SimpleCoordinate } from '..'; +import SimpleMapCoord from '../simpleMapCoord'; import { IAMapEvent, IAMapInstance } from '../../typings/index'; import { toPaddingOptions } from '../utils'; import { Version } from '../version'; @@ -60,7 +60,7 @@ let pendingResolveQueue: Array<() => void> = []; export default class AMapService implements IMapService { public version: string = Version['GAODE2.x']; - public simpleMapCoord: SimpleCoordinate; + public simpleMapCoord: SimpleMapCoord = new SimpleMapCoord(); /** * 原始地图实例 */ diff --git a/packages/maps/src/earth/map.ts b/packages/maps/src/earth/map.ts index f1a2cbc922..1be935d953 100644 --- a/packages/maps/src/earth/map.ts +++ b/packages/maps/src/earth/map.ts @@ -31,8 +31,8 @@ const EventMap: { zoomchange: 'zoom', dragging: 'drag', }; -import { SimpleCoordinate } from '..'; import { MapTheme } from './theme'; +import SimpleMapCoord from '../simpleMapCoord'; const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; /** @@ -42,7 +42,7 @@ const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; export default class L7EarthService implements IEarthService { public version: string = Version.GLOBEL; public map: Map; - public simpleMapCoord: SimpleCoordinate; + public simpleMapCoord: SimpleMapCoord = new SimpleMapCoord(); // TODO: 判断地图是否正在拖拽 public dragging: boolean = false; diff --git a/packages/maps/src/index.ts b/packages/maps/src/index.ts index 33f6dc04e4..c9951fa3f1 100644 --- a/packages/maps/src/index.ts +++ b/packages/maps/src/index.ts @@ -4,7 +4,7 @@ import GaodeMapV2 from './amap2/'; import Earth from './earth/'; // import GaodeMapV2 from './amap2/'; import Map from './map/'; -import SimpleCoordinate from './map/simpleMapCoord'; +import SimpleCoordinate from './simpleMapCoord'; import Mapbox from './mapbox/'; import { Version } from './version'; diff --git a/packages/maps/src/map/map.ts b/packages/maps/src/map/map.ts index b83e85a7f7..a01eb5c556 100644 --- a/packages/maps/src/map/map.ts +++ b/packages/maps/src/map/map.ts @@ -22,7 +22,7 @@ import { $window, DOM } from '@antv/l7-utils'; import { inject, injectable } from 'inversify'; import 'reflect-metadata'; import { Version } from '../version'; -import SimpleMapCoord from './simpleMapCoord'; +import SimpleMapCoord from '../simpleMapCoord'; import Viewport from './Viewport'; const EventMap: { [key: string]: any; diff --git a/packages/maps/src/mapbox/map.ts b/packages/maps/src/mapbox/map.ts index 86213b0d12..43a8696383 100644 --- a/packages/maps/src/mapbox/map.ts +++ b/packages/maps/src/mapbox/map.ts @@ -36,7 +36,7 @@ const EventMap: { zoomchange: 'zoom', dragging: 'drag', }; -import { SimpleCoordinate } from '..'; +import SimpleMapCoord from '../simpleMapCoord'; import { MapTheme } from './theme'; let mapdivCount = 0; const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; @@ -50,7 +50,7 @@ export default class MapboxService implements IMapService { public version: string = Version.MAPBOX; public map: Map & IMapboxInstance; - public simpleMapCoord: SimpleCoordinate; + public simpleMapCoord: SimpleMapCoord = new SimpleMapCoord(); // 背景色 public bgColor: string = 'rgba(0.0, 0.0, 0.0, 0.0)'; diff --git a/packages/maps/src/map/simpleMapCoord.ts b/packages/maps/src/simpleMapCoord.ts similarity index 100% rename from packages/maps/src/map/simpleMapCoord.ts rename to packages/maps/src/simpleMapCoord.ts