UNPKG

rlayers

Version:

React Components for OpenLayers

51 lines 1.82 kB
import React, { MouseEvent, PropsWithChildren } from 'react'; import { Overlay } from 'ol'; import { RContextType } from './context'; import { RlayersBase } from './REvent'; export type Positioning = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'; /** * @propsfor ROverlay */ export interface ROverlayProps extends PropsWithChildren<unknown> { /** Content to be displayed */ content?: string | HTMLElement | React.ElementType; /** CSS class */ className?: string; /** Automatically pan the map when the element is rendered * @default false */ autoPan?: boolean; /** Offset the overlay on the x and y axes relative to the containing feature * @default [0,0] */ offset?: number[]; /** Anchor point * @default 'top-left' */ positioning?: Positioning; /** Automatically position the overlay so that it fits in the viewport * @default false */ autoPosition?: boolean; /** Called immediately on click */ onClick?: (event: MouseEvent<HTMLDivElement>) => void; } /** * A basic overlay * * Requires a location context * * (ie it must be descendant of a `RFeature`) * * @name ROverlay * @constructor */ export declare class ROverlayBase<P extends ROverlayProps> extends RlayersBase<P, Record<string, never>> { ol: Overlay; protected containerRef: React.RefObject<HTMLDivElement>; constructor(props: Readonly<P>, context?: React.Context<RContextType>); protected setPosition(): void; protected refresh(prevProps?: P): void; componentDidMount(): void; componentWillUnmount(): void; render(): JSX.Element; } export default class ROverlay extends ROverlayBase<ROverlayProps> { } //# sourceMappingURL=ROverlay.d.ts.map