@spearwolf/twopoint5d
Version:
Create 2.5D realtime graphics and pixelart with WebGL and three.js
54 lines • 1.79 kB
TypeScript
import { Vector2 } from 'three/webgpu';
export type AnchorPositionX = 'left' | 'center' | 'right';
export type AnchorPositionY = 'top' | 'center' | 'bottom';
export type AnchorPosition = 'top left' | 'top center' | 'top right' | 'center left' | 'center' | 'center center' | 'center right' | 'bottom left' | 'bottom center' | 'bottom right';
export type FitIntoRectangleSpecs = {
fit?: 'fill';
pixelZoom: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'fill';
anchorPosition?: AnchorPosition;
} | {
fit: 'contain';
width: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'contain';
height: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'contain';
height: number;
width: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'cover';
width: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'cover';
height: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
} | {
fit: 'cover';
height: number;
width: number;
minPixelZoom?: number;
maxPixelZoom?: number;
anchorPosition?: AnchorPosition;
};
export declare function parseAnchorPosition(anchorPosition: AnchorPosition | undefined): [AnchorPositionY, AnchorPositionX];
export declare function calculateAnchorOffset(rect: Vector2, view: Vector2, anchorPosition?: AnchorPosition, target?: Vector2): Vector2;
export declare function fitIntoRectangle(rect: Vector2, specs: FitIntoRectangleSpecs, target?: Vector2): Vector2;
//# sourceMappingURL=fitIntoRectangle.d.ts.map