fix: 高德地图新

This commit is contained in:
thinkinggis 2020-12-21 11:23:33 +08:00
parent bb1f0b224d
commit 73c15918ed
4 changed files with 12 additions and 1 deletions

View File

@ -274,6 +274,10 @@ export default class Marker extends EventEmitter {
element.appendChild(svg);
}
DOM.addClass(element, 'l7-marker');
Object.keys(this.markerOption.style || {}).forEach((key: string) => {
// @ts-ignore
element?.style[key] = this.markerOption?.style[key];
});
element.addEventListener('click', (e: MouseEvent) => {
this.onMapClick(e);
});

View File

@ -17,6 +17,7 @@ export interface IMarkerOption {
offsets: number[];
draggable: boolean;
extData?: any;
style?: CSSStyleDeclaration;
}
export interface IMarker {
addTo(scene: Container): void;

View File

@ -148,6 +148,8 @@ export interface IMapConfig<RawMap = {}> {
attributionControl?: boolean;
offsetCoordinate?: boolean;
[key: string]: any;
}

View File

@ -311,6 +311,7 @@ export default class L7MapService implements IMapService<Map> {
private handleCameraChanged = () => {
const { lat, lng } = this.map.getCenter();
const { offsetCoordinate = false } = this.config;
// resync
this.viewport.syncWithMapCamera({
@ -324,7 +325,10 @@ export default class L7MapService implements IMapService<Map> {
cameraHeight: 0,
});
// set coordinate system
if (this.viewport.getZoom() > LNGLAT_OFFSET_ZOOM_THRESHOLD) {
if (
this.viewport.getZoom() > LNGLAT_OFFSET_ZOOM_THRESHOLD &&
offsetCoordinate
) {
this.coordinateSystemService.setCoordinateSystem(
CoordinateSystem.LNGLAT_OFFSET,
);