You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.9 KiB

4 months ago
import type { FitViewOptions, ViewportAnimationEffectTiming } from '../types';
import type { Padding, STDPadding } from '../types/padding';
/**
* <zh/>
*
* <en/> Viewport
* @public
*/
export interface ViewportOptions {
/**
* <zh/> x
*
* <en/> viewport x coordinate
*/
x?: number;
/**
* <zh/> y
*
* <en/> viewport y coordinate
*/
y?: number;
/**
* <zh/>
*
* <en/> whether to auto fit
* @remarks
* <zh/> `render` `autoFit`
*
* <en/> 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';
/**
* <zh/>
*
* <en/> canvas padding
* @remarks
* <zh/>
*
* <en/> Usually, it will be adapted according to the padding when auto-fitting
*/
padding?: Padding;
/**
* <zh/>
*
* <en/> rotation angle
* @defaultValue 0
*/
rotation?: number;
/**
* <zh/>
*
* <en/> zoom ratio
* @defaultValue 1
*/
zoom?: number;
/**
* <zh/>
*
* <en/> 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];
}