UNPKG

mobility-toolbox-js

Version:

Toolbox for JavaScript applications in the domains of mobility and logistics.

21 lines (20 loc) 1.08 kB
import LayerRenderer from 'ol/renderer/Layer'; import type { Feature } from 'ol'; import type { Coordinate } from 'ol/coordinate'; import type { Geometry } from 'ol/geom'; import type { FrameState } from 'ol/Map'; import type { Pixel } from 'ol/pixel'; import type { FeatureCallback } from 'ol/renderer/vector'; import type { MaplibreStyleLayer } from '../layers'; /** * This class is a renderer for Maplibre Layer to be able to use the native ol * functionnalities like map.getFeaturesAtPixel or map.hasFeatureAtPixel. * @private */ export default class MaplibreStyleLayerRenderer extends LayerRenderer<MaplibreStyleLayer> { forEachFeatureAtCoordinate<Feature>(coordinate: Coordinate, frameState: FrameState, hitTolerance: number, callback: FeatureCallback<Feature>): Feature | undefined; getFeatures(pixel: Pixel): Promise<Feature<Geometry>[]>; getFeaturesAtCoordinate(coordinate: Coordinate | undefined, hitTolerance?: number): Feature<Geometry>[]; prepareFrame(): boolean; renderFrame(frameState: FrameState, target: HTMLElement | null): HTMLElement; }