Skip to content

Commit

Permalink
feat(esl-utils): add ability to resize Rect instance
Browse files Browse the repository at this point in the history
  • Loading branch information
dshovchko committed Mar 5, 2024
1 parent 55378a3 commit 1a4aa60
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/esl-utils/dom/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ export class Rect implements Point {
return new Rect(this.x + x, this.y + y, this.width, this.height);
}

/** @returns new {@link Rect} that is resized by x and y axis */
public resize(xDelta: number = 0, yDelta: number = 0): Rect {
return new Rect(this.x, this.y, this.width + xDelta, this.height + yDelta);
}

/** @returns new {@link Rect} an intersection of current and passed Rectangle */
public intersect(rect: Rect): Rect {
const top = Math.max(this.top, rect.top);
Expand Down

0 comments on commit 1a4aa60

Please sign in to comment.