all files / fontkit/src/glyph/ BBox.coffee

93.75% Statements 15/16
100% Branches 8/8
83.33% Functions 5/6
93.75% Lines 15/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28             580× 100×   580× 74×   580× 98×   580× 128×        
class BBox
  get = require('../get')(this)
  constructor: (@minX = Infinity, @minY = Infinity, @maxX = -Infinity, @maxY = -Infinity) ->
      
  get 'width', ->
    @maxX - @minX
    
  get 'height', ->
    @maxY - @minY
    
  addPoint: (x, y) ->
    if x < @minX
      @minX = x
      
    if y < @minY
      @minY = y
      
    if x > @maxX
      @maxX = x
      
    if y > @maxY
      @maxY = y
      
  copy: ->
    return new BBox @minX, @minY, @maxX, @maxY
 
module.exports = BBox