Skip to content

Commit

Permalink
Fix more frame bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Apr 3, 2015
1 parent 6dda6c6 commit 2b7855d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions framer/Components/ScrollComponent.coffee
Expand Up @@ -82,7 +82,7 @@ class exports.ScrollComponent extends Layer

super options

@_contentInset = options.contentInset or Utils.zeroRect()
@_contentInset = options.contentInset or Utils.rectZero()
@setContentLayer(new Layer)

# Because we did not have a content layer before, we want to re-apply
Expand Down Expand Up @@ -216,7 +216,7 @@ class exports.ScrollComponent extends Layer
get: ->
_.clone(@_contentInset)
set: (contentInset) ->
@_contentInset = Utils.zeroRect(Utils.parseRect(contentInset))
@_contentInset = Utils.rectZero(Utils.parseRect(contentInset))
@updateContent()

@define "direction",
Expand Down
10 changes: 9 additions & 1 deletion framer/Utils.coffee
Expand Up @@ -495,6 +495,9 @@ Utils.loadImage = (url, callback, context) ->

# Point

Utils.pointZero = (args={}) ->
return _.defaults(args, {x:0, y:0})

Utils.pointMin = ->
points = Utils.arrayFromArguments arguments
point =
Expand Down Expand Up @@ -532,6 +535,9 @@ Utils.pointInFrame = (point, frame) ->

# Size

Utils.sizeZero = (args={}) ->
return _.defaults(args, {width:0, height:0})

Utils.sizeMin = ->
sizes = Utils.arrayFromArguments arguments
size =
Expand All @@ -546,7 +552,7 @@ Utils.sizeMax = ->

# Rect

Utils.zeroRect = (args={}) ->
Utils.rectZero = (args={}) ->
return _.defaults(args, {top:0, right:0, bottom:0, left:0})

Utils.parseRect = (args) ->
Expand Down Expand Up @@ -592,6 +598,8 @@ Utils.frameGetMaxY = (frame) ->
Utils.frameSetMaxY = (frame, value) ->
frame.y = if frame.height is 0 then 0 else value - frame.height

Utils.frameZero = (args={}) ->
return _.defaults(args, {top:0, right:0, bottom:0, left:0})

Utils.frameSize = (frame) ->
size =
Expand Down

0 comments on commit 2b7855d

Please sign in to comment.