This commit is contained in:
djerom
2022-05-23 14:30:34 +05:00
parent 2a8d03bae5
commit cf5956e248
6 changed files with 46 additions and 17 deletions

View File

@@ -71,6 +71,22 @@ class BBox {
clone(){
return BBox.fromLTRB(this.l, this.t, this.r, this.b)
}
expand(dx, dy){
dy = dy === null ? dx : dy
console.log(dx, dy)
this.l -= dx
this.r += dx
this.t -= dy
this.b += dy
return this
}
expandPerc(perc){
const w = this.w() * perc / 100
const h = this.h() * perc / 100
return this.expand(w, h)
}
}
module.exports = BBox