import type { FitViewOptions, ViewportAnimationEffectTiming } from '../types';
import type { Padding, STDPadding } from '../types/padding';
/**
* 视口配置项
*
* Viewport
* @public
*/
export interface ViewportOptions {
/**
* 视口 x 坐标
*
* viewport x coordinate
*/
x?: number;
/**
* 视口 y 坐标
*
* viewport y coordinate
*/
y?: number;
/**
* 是否自动适应
*
* whether to auto fit
* @remarks
* 每次执行 `render` 时,都会根据 `autoFit` 进行自适应
*
* Every time `render` is executed, it will be adapted according to `autoFit`
*/
autoFit?: {
type: 'view';
options?: FitViewOptions;
animation?: ViewportAnimationEffectTiming;
} | {
type: 'center';
animation?: ViewportAnimationEffectTiming;
} | 'view' | 'center';
/**
* 画布内边距
*
* canvas padding
* @remarks
* 通常在自适应时,会根据内边距进行适配
*
* Usually, it will be adapted according to the padding when auto-fitting
*/
padding?: Padding;
/**
* 旋转角度
*
* rotation angle
* @defaultValue 0
*/
rotation?: number;
/**
* 缩放比例
*
* zoom ratio
* @defaultValue 1
*/
zoom?: number;
/**
* 缩放范围
*
* zoom range
* @defaultValue [0.01, 10]
*/
zoomRange?: [number, number];
}
/**
* @internal
*/
export interface STDViewportOptions {
autoFit?: {
type: 'view';
options?: FitViewOptions;
animation?: ViewportAnimationEffectTiming;
} | {
type: 'center';
animation?: ViewportAnimationEffectTiming;
};
padding?: STDPadding;
zoom?: number;
zoomRange?: [number, number];
}