@eclipse-scout/core
Version:
Eclipse Scout runtime
76 lines • 2.63 kB
TypeScript
import { Dimension, Insets, Point } from '../index';
export declare class Rectangle {
x: number;
y: number;
width: number;
height: number;
/**
* If no parameters are passed, all members are initialized with 0.
*/
constructor(xOrRectangle?: number | Rectangle, y?: number, width?: number, height?: number);
toString(): string;
equals(o: Rectangle): boolean;
clone(): Rectangle;
center(): Point;
right(): number;
bottom(): number;
contains(xOrPoint: number | Point, y?: number): boolean;
/**
* Tests whether the specified rectangle intersects this rectangle.
* This means the two rectangles share at least one internal point.
*
* @param r the rectangle to test against
* @returns true if the specified rectangle intersects this one
*/
intersects(r: Rectangle): boolean;
/**
* Determines the intersection with the given rectangle.
*
* @returns the rectangle that represents the intersection, or an empty rectangle, if the rectangles don't intersect.
*/
intersect(rect: Rectangle): Rectangle;
/**
* Subtracts the given insets from the rectangle.
*/
subtract(insets: Insets): Rectangle;
/**
* Subtracts the insets only from the dimension properties (width and height)
*/
subtractFromDimension(insets: Insets): Rectangle;
/**
* Adds the given insets to the rectangle.
*/
add(insets: Insets): Rectangle;
/**
* Moves the rectangle the given distance.
*
* @param dxOrPoint the distance to move the rectangle along the x-axis, or a point object containing the diff on the x and y-axis.
* @param dy the distance to move the rectangle along the y-axis.
*/
translate(dxOrPoint: number | Point, dy?: number): Rectangle;
/**
* Moves the rectangle to the new point.
*
* @param xOrPoint the new position on the x-axis or a point object containing the new position.
* @param y the new position on the y-axis.
*/
moveTo(xOrPoint: number | Point, y?: number): Rectangle;
/**
* @returns property x and y of this instance as new {@link Point} instance.
*/
point(): Point;
/**
* @returns property width and height of this instance as new {@link Dimension} instance.
*/
dimension(): Dimension;
union(r: Rectangle): Rectangle;
/**
* Creates a copy and calls Math.floor() on each property.
*/
floor(): Rectangle;
/**
* Creates a copy and calls Math.ceil() on each property.
*/
ceil(): Rectangle;
}
//# sourceMappingURL=Rectangle.d.ts.map