import { AABB } from '@antv/g'; import type { FitViewOptions, ID, Point, TransformOptions, ViewportAnimationEffectTiming } from '../types'; import type { RuntimeContext } from './types'; export declare class ViewportController { private context; private get padding(); private get paddingOffset(); constructor(context: RuntimeContext); private get camera(); private landmarkCounter; private createLandmark; private getAnimation; getCanvasSize(): [number, number]; /** * 获取画布中心坐标 * * Get the center coordinates of the canvas * @returns - 画布中心坐标 | Center coordinates of the canvas * @remarks * 基于画布的宽高计算中心坐标,不受视口变换影响 * * Calculate the center coordinates based on the width and height of the canvas, not affected by the viewport transformation */ getCanvasCenter(): Point; /** * 当前视口中心坐标 * * Current viewport center coordinates * @returns - 视口中心坐标 | Viewport center coordinates * @remarks * 以画布原点为原点,受到视口变换影响 * * With the origin of the canvas as the origin, affected by the viewport transformation */ getViewportCenter(): Point; getGraphCenter(): Point; getZoom(): number; getRotation(): number; private getTranslateOptions; private getRotateOptions; private getZoomOptions; private transformResolver?; transform(options: TransformOptions, animation?: ViewportAnimationEffectTiming): Promise; fitView(options?: FitViewOptions, animation?: ViewportAnimationEffectTiming): Promise; fitCenter(options: FocusOptions): Promise; focusElements(ids: ID[], options?: FocusOptions): Promise; private focus; /** * 获取画布元素在视口中的包围盒 * * Get the bounding box of the canvas element in the viewport * @param bbox - 画布元素包围盒 | Canvas element bounding box * @returns - 视口中的包围盒 | Bounding box in the viewport */ getBBoxInViewport(bbox: AABB): AABB; /** * 判断点或包围盒是否在视口中 * * Determine whether the point or bounding box is in the viewport * @param target - 点或包围盒 | Point or bounding box * @param complete - 是否完全在视口中 | Whether it is completely in the viewport * @param tolerance - 视口外的容差 | Tolerance outside the viewport * @returns - 是否在视口中 | Whether it is in the viewport */ isInViewport(target: Point | AABB, complete?: boolean, tolerance?: number): boolean; cancelAnimation(): void; } export interface FocusOptions { /** * 动画配置 * * Animation configuration */ animation?: ViewportAnimationEffectTiming; /** * 使用子图形计算包围盒 * * Calculate the bounding box by using sub-shapes */ shapes?: string; /** * 对齐位置,默认为画布中心 * * Alignment position, default is the center of the canvas */ position?: Point; }