@stringsync/vexml
Version:
MusicXML to Vexflow
59 lines (58 loc) • 1.53 kB
TypeScript
import { Point } from './point';
import { Shape } from './types';
import * as util from '../util';
/** Represents a rectangle in a 2D coordinate system. */
export declare class Rect implements Shape {
/** upper-left corner x-coordinate */
readonly x: number;
/** upper-left corner y-coordinate */
readonly y: number;
/** total width */
readonly w: number;
/** total height */
readonly h: number;
constructor(
/** upper-left corner x-coordinate */
x: number,
/** upper-left corner y-coordinate */
y: number,
/** total width */
w: number,
/** total height */
h: number);
static fromRectLike(rectLike: {
x: number;
y: number;
w: number;
h: number;
}): Rect;
static fromShape(shape: Shape): Rect;
static fromRanges({ xRange, yRange }: {
xRange: util.NumberRange;
yRange: util.NumberRange;
}): Rect;
static empty(): Rect;
static merge(rects: Rect[]): Rect;
origin(): Point;
center(): Point;
topLeft(): Point;
topRight(): Point;
bottomLeft(): Point;
bottomRight(): Point;
translate(opts: {
dx?: number;
dy?: number;
}): Rect;
quadrants(): [topRight: Rect, topLeft: Rect, bottomLeft: Rect, bottomRight: Rect];
contains(point: Point): boolean;
toRectLike(): {
x: number;
y: number;
w: number;
h: number;
};
left(): number;
right(): number;
top(): number;
bottom(): number;
}