This commit is contained in:
Manav Rathi 2024-05-19 16:51:07 +05:30
parent faf415277e
commit 568e470752
No known key found for this signature in database
2 changed files with 5 additions and 10 deletions

View file

@ -33,14 +33,6 @@ export class Box implements IRect {
this.height = height;
}
public get topLeft(): Point {
return new Point(this.x, this.y);
}
public get bottomRight(): Point {
return new Point(this.x + this.width, this.y + this.height);
}
public round(): Box {
const [x, y, width, height] = [
this.x,

View file

@ -52,8 +52,11 @@ function transformPoints(points: Point[], transform: Matrix) {
}
function transformBox(box: Box, transform: Matrix) {
const topLeft = transformPoint(box.topLeft, transform);
const bottomRight = transformPoint(box.bottomRight, transform);
const topLeft = transformPoint(new Point(box.x, box.y), transform);
const bottomRight = transformPoint(
new Point(box.x + box.width, box.y + box.height),
transform,
);
return new Box({
x: topLeft.x,