kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
37 lines (36 loc) • 1.33 kB
TypeScript
/// <reference types="react" />
export declare type MapLegendControlSettings = {
position: {
x: number;
y: number;
anchorX: 'left' | 'right';
anchorY: 'top' | 'bottom';
};
contentHeight: number;
};
declare type Params = {
legendContentRef: React.MutableRefObject<HTMLElement | null>;
isSidePanelShown: boolean;
settings: MapLegendControlSettings;
onChangeSettings: (settings: Partial<MapLegendControlSettings>) => void;
theme: Record<string, any>;
};
declare type ReturnType = {
positionStyles: Record<string, unknown>;
updatePosition: () => void;
contentHeight: number;
startResize: () => void;
resize: (deltaY: number) => void;
};
export declare type UseCalcLegendPositionProps = {
legendContentRef: React.MutableRefObject<HTMLElement | null>;
isSidePanelShown: boolean;
sidePanelWidth: number;
};
export declare function useCalcLegendPosition({ legendContentRef, isSidePanelShown, sidePanelWidth }: UseCalcLegendPositionProps): () => MapLegendControlSettings['position'];
/**
* Returns a function that calculates the anchored position of the map legend
* that is being dragged.
*/
export default function useLegendPosition({ legendContentRef, isSidePanelShown, settings, onChangeSettings, theme }: Params): ReturnType;
export {};