mirror of https://gitee.com/antv-l7/antv-l7
fix: marker 支持样式 & 高德地图可以关闭offset坐标系
This commit is contained in:
parent
73c15918ed
commit
23f01516e8
|
@ -156,6 +156,15 @@ L7 Logo 的显示位置 默认左下角
|
|||
|
||||
地图是否可旋转 {Boolean} default true
|
||||
|
||||
|
||||
## 实验参数
|
||||
参数可能会废弃
|
||||
### offsetCoordinate
|
||||
|
||||
{ boolean } default true
|
||||
|
||||
高德地图适用,是否关闭偏移坐标系
|
||||
|
||||
## 方法
|
||||
|
||||
### getZoom 获取缩放等级
|
||||
|
|
|
@ -252,7 +252,7 @@ export default class Marker extends EventEmitter {
|
|||
const { color, anchor } = this.markerOption;
|
||||
if (!element) {
|
||||
this.defaultMarker = true;
|
||||
element = DOM.create('div');
|
||||
element = DOM.create('div') as HTMLDivElement;
|
||||
this.markerOption.element = element;
|
||||
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
svg.setAttributeNS(null, 'display', 'block');
|
||||
|
@ -274,10 +274,18 @@ export default class Marker extends EventEmitter {
|
|||
element.appendChild(svg);
|
||||
}
|
||||
DOM.addClass(element, 'l7-marker');
|
||||
Object.keys(this.markerOption.style || {}).forEach((key: string) => {
|
||||
Object.keys(this.markerOption.style || {}).forEach(
|
||||
// @ts-ignore
|
||||
element?.style[key] = this.markerOption?.style[key];
|
||||
});
|
||||
(key: keyof CSSStyleDeclaration) => {
|
||||
const value =
|
||||
this.markerOption?.style && (this.markerOption?.style[key] as string);
|
||||
if (element) {
|
||||
// @ts-ignore
|
||||
(element.style as CSSStyleDeclaration)[key] = value;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
element.addEventListener('click', (e: MouseEvent) => {
|
||||
this.onMapClick(e);
|
||||
});
|
||||
|
|
|
@ -311,7 +311,7 @@ export default class L7MapService implements IMapService<Map> {
|
|||
|
||||
private handleCameraChanged = () => {
|
||||
const { lat, lng } = this.map.getCenter();
|
||||
const { offsetCoordinate = false } = this.config;
|
||||
const { offsetCoordinate = true } = this.config;
|
||||
|
||||
// resync
|
||||
this.viewport.syncWithMapCamera({
|
||||
|
|
Loading…
Reference in New Issue