Permalink
Browse files

Rename to FlowComponent

  • Loading branch information...
koenbok committed Dec 1, 2016
1 parent 30bfb04 commit 73363ec1dd0d25f2b437c3db043ffcdda4f8ec28
@@ -6,14 +6,14 @@ Utils = require "../Utils"
{LayerStateMachine} = require "../LayerStateMachine"
{AnimationGroup} = require "../AnimationGroup"
-NavComponentLayerScrollKey = "_navComponentWrapped"
+FlowComponentLayerScrollKey = "_flowComponentWrapped"
Events.TransitionStart = "transitionstart"
Events.TransitionHalt = "transitionhalt"
Events.TransitionStop = "transitionstop"
Events.TransitionEnd = "transitionend"
-class exports.NavComponent extends Layer
+class exports.FlowComponent extends Layer
constructor: (layerOrOptions={}, options={}) ->
@@ -118,8 +118,8 @@ class exports.NavComponent extends Layer
# Transition over to a new layer using a specific transtition function.
# Some basic error checking
- throw new Error "NavComponent.transition expects a layer" unless layer
- throw new Error "NavComponent.transition expects transitionFunction" unless transitionFunction
+ throw new Error "FlowComponent.transition expects a layer" unless layer
+ throw new Error "FlowComponent.transition expects transitionFunction" unless transitionFunction
return if layer is @current
@@ -214,10 +214,10 @@ class exports.NavComponent extends Layer
_wrapLayer: (layer) ->
# Wrap the layer in a ScrollComponent if the size exceeds the size of
- # the NavComponent. Also set the horizontal/vertical scrollin if only
+ # the FlowComponent. Also set the horizontal/vertical scrollin if only
# one of the sizes exceeds.
- # TODO: what about NavComponent changing size, do we need to account?
+ # TODO: what about FlowComponent changing size, do we need to account?
scroll = null
@@ -229,15 +229,15 @@ class exports.NavComponent extends Layer
height =- @footer.height if @footer
# If we already created a scroll, we can use that one
- if layer[NavComponentLayerScrollKey]
- scroll = layer[NavComponentLayerScrollKey]
+ if layer[FlowComponentLayerScrollKey]
+ scroll = layer[FlowComponentLayerScrollKey]
- # If the layer size is exactly equal to the size of the NavComponent
+ # If the layer size is exactly equal to the size of the FlowComponent
# we can just use it directly.
else if layer.width is @width and layer.height is height
return layer
- # If the layer size is smaller then the size of the NavComponent we
+ # If the layer size is smaller then the size of the FlowComponent we
# still need to add a backgound layer so it covers up the background.
# TODO: Implement this
else if layer.width < @width and layer.height < height
@@ -253,7 +253,7 @@ class exports.NavComponent extends Layer
scroll = new ScrollComponent
scroll.name = "scrollComponent"
scroll.backgroundColor = @backgroundColor
- layer[NavComponentLayerScrollKey] = scroll
+ layer[FlowComponentLayerScrollKey] = scroll
layer.parent = scroll.content
# Forward the events to the wrapped layer so we can listen on it for
@@ -292,7 +292,7 @@ class exports.NavComponent extends Layer
# Get the ScrollComponent for a layer if it was wrapped,
# or just the layer itself if it was not.
return null unless layer
- return layer[NavComponentLayerScrollKey] or layer
+ return layer[FlowComponentLayerScrollKey] or layer
_runTransition: (transition, direction, animate, from, to) =>
View
@@ -26,7 +26,7 @@ Framer.PageComponent = (require "./Components/PageComponent").PageComponent
Framer.SliderComponent = (require "./Components/SliderComponent").SliderComponent
Framer.DeviceComponent = (require "./Components/DeviceComponent").DeviceComponent
Framer.GridComponent = (require "./Components/GridComponent").GridComponent
-Framer.NavComponent = (require "./Components/NavComponent").NavComponent
+Framer.FlowComponent = (require "./Components/FlowComponent").FlowComponent
Framer.CircularProgressComponent = (require "./Components/CircularProgressComponent").CircularProgressComponent
Framer.MIDIComponent = (require "./Components/MIDIComponent").MIDIComponent
Framer.DeviceView = Framer.DeviceComponent # Compat
View
@@ -43,6 +43,6 @@ require "./tests/VersionTest"
require "./tests/ColorTest"
require "./tests/DeviceComponentTest"
require "./tests/SliderComponentTest"
-require "./tests/NavComponentTest"
+require "./tests/FlowComponentTest"
mocha.run()
@@ -1,10 +1,10 @@
assert = require "assert"
-describe "NavComponent", ->
+describe "FlowComponent", ->
it "should not animate first show", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer size: 100
cardB = new Layer size: 100
@@ -13,7 +13,7 @@ describe "NavComponent", ->
it "should go back", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer size: 100
cardB = new Layer size: 100
@@ -24,13 +24,13 @@ describe "NavComponent", ->
nav.current.should.equal cardA
it "should allow constructor options", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
nav.width.should.equal 100
nav.height.should.equal 100
it "should allow constructor options with initial layer", ->
cardA = new Layer size: 100
- nav = new NavComponent(cardA, size: 100)
+ nav = new FlowComponent(cardA, size: 100)
nav.width.should.equal 100
nav.height.should.equal 100
nav.current.should.equal cardA
@@ -39,7 +39,7 @@ describe "NavComponent", ->
it "should add header", ->
- nav = new NavComponent size: 200
+ nav = new FlowComponent size: 200
nav.header = new Layer width: 200, height: 20
nav.showNext new Layer width: 200, height: 200
@@ -51,7 +51,7 @@ describe "NavComponent", ->
it "should add footer", ->
- nav = new NavComponent size: 200
+ nav = new FlowComponent size: 200
nav.footer = new Layer width: 200, height: 20
nav.showNext new Layer width: 200, height: 200
@@ -66,7 +66,7 @@ describe "NavComponent", ->
it "should make views scrollable", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer width: 200, height: 200
nav.showNext(cardA, scroll: true)
@@ -76,7 +76,7 @@ describe "NavComponent", ->
it "should make views scrollable horizontal", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer width: 200, height: 100
nav.showNext(cardA, scroll: true)
@@ -86,7 +86,7 @@ describe "NavComponent", ->
it "should make views scrollable vertical", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer width: 100, height: 200
nav.showNext(cardA, scroll: true)
@@ -96,7 +96,7 @@ describe "NavComponent", ->
it "should not make views scrollable", ->
- nav = new NavComponent size: 100
+ nav = new FlowComponent size: 100
cardA = new Layer width: 100, height: 200
nav.showNext(cardA, scroll: false)
@@ -111,7 +111,7 @@ describe "NavComponent", ->
cardA = new Layer name: "cardA", size: 100
cardB = new Layer name: "cardB", size: 100
- nav = new NavComponent()
+ nav = new FlowComponent()
nav.showNext(cardA)
nav.current.should.equal cardA

0 comments on commit 73363ec

Please sign in to comment.