@nightingale-elements/nightingale-new-core
Version:
Base Elements for Nightingale Components
25 lines • 1.5 kB
TypeScript
import { ScaleLinear, Selection } from "d3";
import NightingaleBaseElement, { Constructor } from "../../nightingale-base-element";
import { WithDimensionsInterface } from "../withDimensions";
import { withMarginInterface } from "../withMargin";
import { withPositionInterface } from "../withPosition";
import { WithResizableInterface } from "../withResizable";
type SVGSelection = Selection<SVGSVGElement, unknown, HTMLElement | SVGElement | null, unknown>;
export interface WithZoomInterface extends WithDimensionsInterface, withPositionInterface, withMarginInterface, WithResizableInterface {
/** Current scale, the one used to calculate any positions. Calculated based on `display-start` and `display-end`. */
xScale?: ScaleLinear<number, number>;
/** Target for zooming events */
svg?: SVGSelection;
getSingleBaseWidth(): number;
/** Compute X coordinate within this HTML element from sequence position */
getXFromSeqPosition(position: number): number;
/** Compute sequence position from X coordinate within this HTML element */
getSeqPositionFromX(x: number): number | undefined;
updateScaleDomain(): void;
applyZoomTranslation(): void;
/** Method to be called whenever zoom changes, subclasses can override to perform their stuff */
zoomRefreshed(): void;
}
declare const withZoom: <T extends Constructor<NightingaleBaseElement>>(superClass: T) => Constructor<WithZoomInterface> & T;
export default withZoom;
//# sourceMappingURL=index.d.ts.map