import type { ILayerService, ILngLat, IMapService, IMapletService, IPopup, IPopupOption, RaContainer } from '@ramap/ra-core'; import { DOM } from '@ramap/ra-utils'; import { EventEmitter } from 'eventemitter3'; type ElementType = DOM.ElementType; export { Popup }; export default class Popup extends EventEmitter implements IPopup { /** * 配置 * @protected */ protected popupOption: O; protected mapsService: IMapService; protected mapletService: IMapletService; protected layerService: ILayerService; protected maplet: RaContainer; /** * 关闭按钮对应的 DOM * @protected */ protected closeButton?: HTMLElement | SVGElement; /** * Popup 的总容器 DOM,包含 content 和 tip * @protected */ protected container: HTMLElement; /** * popup 气泡容器 * @protected */ protected content: HTMLElement; /** * popup 气泡标题 * @protected */ protected contentTitle?: HTMLElement; /** * popup 内容容器 * @protected */ protected contentPanel: HTMLElement; /** * 气泡箭头对应的 DOM * @protected */ protected tip: HTMLElement; /** * 当前是否展示 * @protected */ protected isShow: boolean; protected get lngLat(): ILngLat; protected set lngLat(newLngLat: ILngLat); constructor(cfg?: Partial); getIsShow(): boolean; addTo(maplet: RaContainer): this; remove(): this | undefined; /** * 获取 option 配置 */ getOptions(): O; setOptions(option: Partial): this; open(): this; close(): this; show(): this | undefined; hide(): this | undefined; /** * 设置 HTML 内容 * @param html */ setHTML(html: ElementType): this; /** * 设置 Popup 展示文本 * @param text */ setText(text: string): this; setTitle(title?: ElementType): void; /** * 将地图自动平移到气泡位置 */ panToPopup(): this; setLngLat(lngLat: ILngLat | [number, number]): this; /** * 设置 Popup 所在经纬度 * @param lngLat */ setLnglat(lngLat: ILngLat | [number, number]): this; /** * 获取 Popup 所在经纬度 */ getLnglat(): ILngLat; /** * 设置 Popup 最大宽度 * @param maxWidth */ setMaxWidth(maxWidth: string): this; isOpen(): boolean; protected onMouseMove: (e: MouseEvent) => void; /** * 将经纬度转换成对应的像素偏移位置 * @protected */ protected updateLngLatPosition: () => void; protected updateLngLatPositionWhenZoom: (ev: any) => void; protected getDefault(option: Partial): O; /** * 设置 Popup 内容 HTML * @param element */ protected setDOMContent(element: ElementType): this; /** * 绑定地图点击事件触发销毁 Popup * @protected */ protected updateCloseOnClick(onlyClear?: boolean): void; protected updateCloseOnEsc(onlyClear?: boolean): void; protected updateFollowCursor(onlyClear?: boolean): void; protected onKeyDown: (e: KeyboardEvent) => void; /** * 创建 Popup 内容容器的 DOM (在每次 setHTML 或 setText 时都会被调用) * @protected */ protected createContent(): void; protected onCloseButtonClick: (e: Event) => void; private updatePosition; protected updateWhenZoom: (ev: any) => void; protected update: () => void; /** * 设置 Popup 相对于地图容器的 Position * @param {Number} left * @param {Number} top * @param {Boolean} [useTransition=false] 是否使用过度效果 * @protected */ protected setPopupPosition(left: number, top: number, useTransition?: boolean): void; /** * 检查当前传入 option 是否包含 keys 字段 * @param option * @param keys * @protected */ protected checkUpdateOption(option: Partial, keys: Array): boolean; }