Skip to content
Permalink
Browse files

PageComponent Direction Aliases

  • Loading branch information...
Benjamin den Boer
Benjamin den Boer committed Apr 23, 2015
1 parent a063536 commit 7f8a9def0f3d3ef5206386b1407b7cab1f25c9e8
Showing with 10 additions and 7 deletions.
  1. +7 −7 framer/Components/PageComponent.coffee
  2. +3 −0 test/studio/PageComponentVertical.framer/app.coffee
@@ -50,10 +50,10 @@ class exports.PageComponent extends ScrollComponent
point = {x:0, y:0}
point = Utils.framePointForOrigin(currentPage, @originX, @originY) if currentPage

layers = @content.subLayersAbove(point, @originX, @originY) if direction is "up"
layers = @content.subLayersBelow(point, @originX, @originY) if direction is "down"
layers = @content.subLayersRight(point, @originX, @originY) if direction is "right"
layers = @content.subLayersLeft(point, @originX, @originY) if direction is "left"
layers = @content.subLayersAbove(point, @originX, @originY) if direction in ["up", "top", "north"]
layers = @content.subLayersBelow(point, @originX, @originY) if direction in ["down", "bottom", "south"]
layers = @content.subLayersLeft(point, @originX, @originY) if direction in ["left", "west"]
layers = @content.subLayersRight(point, @originX, @originY) if direction in ["right", "east"]

# See if there is one close by that we should go to
layers = _.without(layers, currentPage)
@@ -88,7 +88,7 @@ class exports.PageComponent extends ScrollComponent
# be hard to insert them in the right order, and if we need to manage that for you
# we'd have to change the position of every content layer so the new page fits.
# Ergo: too much magic.
directions = ["right", "bottom"]
directions = ["down", "bottom", "south"] + ["right", "east"]

if not direction in directions
direction = "right"
@@ -97,8 +97,8 @@ class exports.PageComponent extends ScrollComponent
point = {x:0, y:0}

if @content.subLayers.length
point.x = Utils.frameGetMaxX(@content.contentFrame()) if direction == "right"
point.y = Utils.frameGetMaxY(@content.contentFrame()) if direction == "bottom"
point.x = Utils.frameGetMaxX(@content.contentFrame()) if direction in ["right", "east"]
point.y = Utils.frameGetMaxY(@content.contentFrame()) if direction in ["down", "bottom", "south"]

page.point = point

@@ -23,3 +23,6 @@ for index in [0..30]
}

# page.velocityMultiplier = 50

Utils.interval 0.5, ->
page.snapToNextPage("bottom")

0 comments on commit 7f8a9de

Please sign in to comment.
You can’t perform that action at this time.