Skip to content
Permalink
Browse files

Merge branch 'waterkant'

  • Loading branch information
koenbok committed Nov 30, 2016
2 parents 64e9597 + f7bfc94 commit 5b5fa2f6eda19f59bf32e416125bc10cdcf50f03
Showing with 26 additions and 5 deletions.
  1. +13 −4 framer/Components/NavComponent.coffee
  2. +9 −0 framer/Layer.coffee
  3. +4 −1 framer/Utils.coffee
@@ -32,12 +32,11 @@ class exports.NavComponent extends Layer
options.width ?= Screen.width
options.height ?= Screen.height

options.clip ?= true

super options

@_stack = []
@_seen = []
@_current = null
@_isModal = false
@reset()

@overlay = new Layer
name: "overlay"
@@ -56,6 +55,15 @@ class exports.NavComponent extends Layer
width: @width
height: @height

reset: ->

@_stack = []
@_seen = []
@_current = null
@_isModal = false

@showNext(@_initial) if @_initial

# @define "isTransitioning",
# get: -> @_runningTransition

@@ -159,6 +167,7 @@ class exports.NavComponent extends Layer


showNext: (layer, options={}) ->
@_initial ?= layer
@transition(layer, Transitions.show, options)

showPrevious: (options={}) =>
@@ -140,6 +140,9 @@ class exports.Layer extends BaseClass

@_context.emit("layer:create", @)

# Make sure the layer is always centered
@label = @label

delete @__constructor

##############################################################
@@ -148,6 +151,12 @@ class exports.Layer extends BaseClass
# Readonly context property
@define "context", get: -> @_context

@define "label",
get: -> @_label
set: (value="") ->
@_label = value
Utils.labelLayer(@, @_label)

# A placeholder for layer bound properties defined by the user:
@define "custom", @simpleProperty("custom", undefined)

@@ -184,10 +184,13 @@ Utils.defineEnum = (names = [], offset = 0, geometric = 0) ->

Utils.labelLayer = (layer, text, style={}) ->

return unless text
return if text is ""

fontSize = Math.max(Math.min(48, parseInt(layer.height / 3.2)), 14)

style = _.extend({
font: "#{fontSize}px/1em Menlo"
font: "#{fontSize}px/1em #{Utils.deviceFont()}"
lineHeight: "#{layer.height}px"
textAlign: "center"
color: "#fff"

0 comments on commit 5b5fa2f

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