Skip to content

Commit

Permalink
Fix contentInset for ScrollComponent
Browse files Browse the repository at this point in the history
This was due to: b961fbf?diff=unified
  • Loading branch information
Koen Bok committed Apr 11, 2016
1 parent c526d80 commit 01e2794
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion framer/Components/ScrollComponent.coffee
Expand Up @@ -126,6 +126,7 @@ class exports.ScrollComponent extends Layer
@on("change:height", @updateContent)

@updateContent()

@scrollPoint = {x:0, y:0}

return @_content
Expand All @@ -141,7 +142,7 @@ class exports.ScrollComponent extends Layer
# call it yourself, but make sure you don't overdo it.

return unless @content

contentFrame = @calculateContentFrame()
@content.width = contentFrame.width
@content.height = contentFrame.height
Expand Down Expand Up @@ -225,6 +226,12 @@ class exports.ScrollComponent extends Layer
_.clone(@_contentInset)
set: (contentInset) ->
@_contentInset = Utils.rectZero(Utils.parseRect(contentInset))

# If we reset the content inset, we need to reset the content position
contentFrame = @calculateContentFrame()
contentFrame.x = contentFrame.x + @_contentInset.left
contentFrame.y = contentFrame.y + @_contentInset.top
@content.frame = contentFrame
@updateContent()

@define "direction",
Expand Down

0 comments on commit 01e2794

Please sign in to comment.