Permalink
Browse files

Always scale to fit after we switch from fullscreen to device

  • Loading branch information...
koenbok committed Nov 26, 2014
1 parent e33a47b commit 24de214488b4cec026717ec65168875972344c91
Showing with 18 additions and 34 deletions.
  1. +12 −34 extras/CactusFramer/static/app.coffee
  2. +6 −0 framer/DeviceView.coffee
@@ -1,37 +1,15 @@
Framer.Device = new Framer.DeviceView()
Framer.Device.setupContext()
selectionLayer = null
ctx = new Framer.Context name:"highlight"
ctx.run ->
selectionLayer = new Layer
selectionLayer.style =
border: "1px solid red"
zIndex: 1000
# Welcome to Framer
# Learn how to prototype: http://framerjs.com/learn
# Drop an image on the device, or import a design from Sketch or Photoshop
iconLayer = new Layer width:256, height:256
iconLayer.center()
# Define a set of states with names (the original state is 'default')
iconLayer.states.add
second: {y:100, scale:0.6, rotationZ:100}
third: {y:300, scale:1.3, blur:4}
fourth: {y:200, scale:0.9, blur:2, rotationZ:200}
# Set the default animation options
iconLayer.states.animationOptions =
curve: "spring(500,12,0)"
# On a click, go to the next state
iconLayer.on Events.Click, ->
iconLayer.states.next()
selectionLayer.frame = iconLayer.screenScaledFrame()
Framer.Device.deviceType = "desktop-browser-1440"
f = false
l = new Layer
l.on Events.Click, ->
if f is true
Framer.Device.deviceType = "desktop-browser-1440"
f = false
else
Framer.Device.deviceType = "fullscreen"
f = true
@@ -237,6 +237,9 @@ class exports.DeviceView extends BaseClass
if @_device is device
return
# If we switch from fullscreen to a device, we should zoom to fit
shouldZoomToFit = @_deviceType is "fullscreen"
@_device = device
@_deviceType = deviceType
@fullscreen = false
@@ -246,6 +249,9 @@ class exports.DeviceView extends BaseClass
@_positionKeyboard()
@emit("change:deviceType")
if shouldZoomToFit
@deviceScale = "fit"
_updateDeviceImage: =>
if @_shouldRenderFullScreen()
@phone.image = ""

0 comments on commit 24de214

Please sign in to comment.