updates
This commit is contained in:
16
libs/bbox.js
16
libs/bbox.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user