Permalink
Browse files

Scroll lock now works correct with Page component

  • Loading branch information...
J.P.P Treub J.P.P Treub
J.P.P Treub authored and J.P.P Treub committed Jul 21, 2015
1 parent 9e98ef0 commit 8972740ff35efdf81ac8e45430a24a88aeee698d
Showing with 722 additions and 1 deletion.
  1. +4 −1 framer/Components/PageComponent.coffee
  2. +260 −0 framer/Components/PageComponent.js
  3. 0 test/studio/PageComponentCurrentPage.framer/images/.gitkeep
  4. 0 test/studio/PageComponentEvents.framer/images/.gitkeep
  5. 0 test/studio/PageComponentGrid.framer/images/.gitkeep
  6. 0 test/studio/PageComponentHorizontal.framer/images/.gitkeep
  7. 0 test/studio/PageComponentLockDirection.framer/images/.gitkeep
  8. 0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/Icon
  9. +31 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/app.coffee
  10. +12 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/coffee-script.js
  11. +10 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/config.json
  12. +126 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/framer.init.js
  13. +1 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/framer.js
  14. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/background.png
  15. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/cursor.png
  16. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/cursor@2x.png
  17. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-120.png
  18. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-152.png
  19. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-76.png
  20. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-arrow.png
  21. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-arrow@2x.png
  22. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-close.png
  23. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-close@2x.png
  24. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-framer.png
  25. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-framer@2x.png
  26. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-share.png
  27. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/images/icon-share@2x.png
  28. +196 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/mirror.css
  29. +44 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/style.css
  30. +1 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/framer/version
  31. 0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/images/.gitkeep
  32. BIN test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/images/framer-icon.png
  33. +37 −0 test/studio/PageComponentLockHorizontalDirectionExceptTopRow.framer/index.html
  34. 0 test/studio/PageComponentVertical.framer/images/.gitkeep
@@ -153,10 +153,13 @@ class exports.PageComponent extends ScrollComponent
# See if we meet the minimum velocity to scroll to the next page. If not we snap
# to the layer closest to the scroll point.
xDisabled = !@scrollHorizontal and (@direction == "right" or @direction == "left")
yDisabled = !@scrollVertical and (@direction == "down" or @direction == "up")
xLock = @content.draggable._directionLockEnabledX and (@direction == "right" or @direction == "left")
yLock = @content.draggable._directionLockEnabledY and (@direction == "down" or @direction == "up")
if Math.max(Math.abs(velocity.x), Math.abs(velocity.y)) < @velocityThreshold or xLock or yLock
if Math.max(Math.abs(velocity.x), Math.abs(velocity.y)) < @velocityThreshold or xLock or yLock or xDisabled or yDisabled
# print "velocity"
@snapToPage(@closestPage, true, @animationOptions)
return

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,31 @@
horizontalPages = 3
verticalPages = 4
pageComp = new PageComponent
size: Screen.size
directionLock: true
verticalPCs = []
for horizontalPageIndex in [0...horizontalPages]
for verticalPageIndex in [0...verticalPages]
page = new Layer
x: horizontalPageIndex * Screen.width
y: verticalPageIndex * Screen.height
size: Screen.size
backgroundColor: "#28affa"
superLayer: pageComp.content
html: "#{horizontalPageIndex}:#{verticalPageIndex}"
style:
lineHeight: "#{Screen.height}px"
textAlign: "center"
fontSize: "240px"
fontWeight: "100"
fontFamily: "Helvetica Neue"
pageComp.on Events.Move, (scrollOffset) ->
if scrollOffset.y == 0
pageComp.scrollHorizontal = true
else
if pageComp.scrollHorizontal
pageComp.scrollHorizontal = false

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,10 @@
{
"device" : "iPhone 5S Space Gray",
"sharedPrototype" : 1,
"deviceOrientation" : 0,
"contentScale" : 1,
"deviceType" : "fullscreen",
"updateDelay" : 0.3,
"deviceScale" : -1,
"delay" : 0.3
}
Oops, something went wrong.

0 comments on commit 8972740

Please sign in to comment.