Permalink
Browse files

Fix zero division bugs in frame

  • Loading branch information...
Koen Bok
Koen Bok committed May 12, 2013
1 parent 5728949 commit ec11e8b83736f057d7a3bbababf386dd77d9837f
Showing with 18 additions and 8 deletions.
  1. +18 −8 src/primitives/frame.coffee
@@ -29,14 +29,18 @@ class Frame extends EventEmitter
@define "midX",
get: -> @x + (@width / 2.0)
set: (value) ->
throw Error "Width is zero" if @width is 0
@x = value - (@width / 2.0)
if @width is 0
@x = 0
else
@x = value - (@width / 2.0)
@define "maxX",
get: -> @x + @width
set: (value) ->
throw Error "Width is zero" if @width is 0
@x = value - @width
if @width is 0
@x = 0
else
@x = value - @width
@define "minY",
get: -> @y
@@ -45,14 +49,20 @@ class Frame extends EventEmitter
@define "midY",
get: -> @y + (@height / 2.0)
set: (value) ->
throw Error "Width is zero" if @height is 0
@y = value - (@height / 2.0)
if @height is 0
@y = 0
else
@y = value - (@height / 2.0)
@define "maxY",
get: -> @y + @height
set: (value) ->
throw Error "Width is zero" if @height is 0
@y = value - @height
if @height is 0
@y = 0
else
@y = value - @height
merge: (r2) ->
r1 = @

0 comments on commit ec11e8b

Please sign in to comment.