import { type IInsightDefinition } from "@gooddata/sdk-model"; import { type IPushData, type VisualizationEnvironment } from "@gooddata/sdk-ui"; import { type IGeoLngLat, type IGeoLngLatBounds } from "@gooddata/sdk-ui-geo"; import { type IVisualizationProperties } from "../../../interfaces/Visualization.js"; /** * Type guard for {@link IGeoLngLat}. * * Values coming from `visualizationProperties.controls` are loosely typed * (`Record`). This guard narrows them safely. * * @internal */ export declare function isGeoLngLat(value: unknown): value is IGeoLngLat; /** * Type guard for {@link IGeoLngLatBounds}. * * @internal */ export declare function isGeoLngLatBounds(value: unknown): value is IGeoLngLatBounds; /** * Snapshot of the current map center and zoom. * * @internal */ export interface ILiveMapView { center?: IGeoLngLat; zoom?: number; bounds?: IGeoLngLatBounds; } /** * Context required by {@link LiveMapViewTracker.syncCustomViewportSnapshot} * to decide whether and how to persist the current map position. * * @internal */ export interface ISyncViewportContext { environment: VisualizationEnvironment; visualizationProperties: IVisualizationProperties; pushData: (data: IPushData) => void; setVisualizationProperties: (properties: IVisualizationProperties) => void; } /** * Handlers returned by {@link LiveMapViewTracker.createSyncedHandlers}. * * @internal */ export interface ISyncedMapHandlers { handleCenterPositionChanged: (center: IGeoLngLat) => void; handleZoomChanged: (zoom: number) => void; handleBoundsChanged: (bounds: IGeoLngLatBounds) => void; handleViewportInteractionEnded: () => void; } /** * Mixin-like helper that tracks the live map center/zoom reported via callbacks * and exposes a `getCurrentMapView()` function suitable for the config panel. * * Both `PluggableGeoAreaChart` and `PluggableGeoPushpinChartNext` have identical * private state for this purpose. This helper encapsulates it once. * * @internal */ export declare class LiveMapViewTracker { private currentMapCenter?; private currentMapZoom?; private currentMapBounds?; private insightContextKey?; readonly handleCenterPositionChanged: (center: IGeoLngLat) => void; readonly handleZoomChanged: (zoom: number) => void; readonly handleBoundsChanged: (bounds: IGeoLngLatBounds) => void; getCurrentMapView(visualizationProperties: IVisualizationProperties): ILiveMapView; /** * Persists the current map center and zoom into visualization properties * when the viewport mode is "custom" and the environment is Analytical Designer. * * This is called after every center/zoom callback from the map component so * that the saved insight always reflects the user's last viewport position. * The `ignoreUndoRedo` flag prevents these automatic updates from polluting * the undo stack. */ syncCustomViewportSnapshot(ctx: ISyncViewportContext): void; /** * Returns handlers that keep the live viewport snapshot in sync and persist it * only after an explicit user interaction signal from the map layer. */ createSyncedHandlers(getContext: () => ISyncViewportContext): ISyncedMapHandlers; /** * Resets the live snapshot when the insight configuration changes. * This ensures that stale center/zoom values from a previous render cycle * are not returned via `getCurrentMapView()`. */ resetIfInsightChanged(insight: IInsightDefinition): void; } /** * Accessors that let {@link createSyncedViewportHandlers} read/write the * chart state it needs without requiring public access to protected fields. * * @internal */ export interface IGeoChartAccessors { getEnvironment: () => string; getVisualizationProperties: () => IVisualizationProperties; setVisualizationProperties: (properties: IVisualizationProperties) => void; pushData: (data: IPushData) => void; } /** * Creates synced viewport handlers for a pluggable geo chart. * * This is a convenience wrapper around {@link LiveMapViewTracker.createSyncedHandlers} * that builds the {@link ISyncViewportContext} from accessor functions, eliminating * identical boilerplate in `PluggableGeoAreaChart` and `PluggableGeoPushpinChartNext`. * * @internal */ export declare function createSyncedViewportHandlers(tracker: LiveMapViewTracker, accessors: IGeoChartAccessors): ISyncedMapHandlers; //# sourceMappingURL=liveMapViewTracking.d.ts.map