Permalink
Browse files

Fixed device size calculations when rendering fullscreen

  • Loading branch information...
nvh committed May 28, 2018
1 parent ffd0a4d commit 638d6dacf85d862fb2ebb8947fe96169fb0e4da8
Showing with 12 additions and 3 deletions.
  1. +12 −3 framer/Components/DeviceComponent.coffee
@@ -147,13 +147,22 @@ class exports.DeviceComponent extends BaseClass
contentScaleFactor = 1 if contentScaleFactor > 1
screenSizeChanged = false
if @_shouldRenderFullScreen()
clientWidth = document.documentElement.clientWidth
clientHeight = document.documentElement.clientHeight
if Utils.isMobile()
# This uses the actual screen size, which only make sense if the prototype takes up the whole screen of the device
# This uses the actual screen size, which only make sense if the prototype
# takes up the whole screen of the device
width = screen.width * window.devicePixelRatio
height = screen.height * window.devicePixelRatio
# If the width and height don't match up with the client width and height
# the device is rotated, so flip them
if clientWidth < clientHeight and width > height or clientWidth > clientHeight and width < height
newHeight = width
width = height
height = newHeight
else
width = document.documentElement.clientWidth / contentScaleFactor
height = document.documentElement.clientHeight / contentScaleFactor
width = clientWidth / contentScaleFactor
height = clientHeight / contentScaleFactor
screenSizeChanged = @content.width isnt width or @content.height isnt height
for layer in [@background, @hands, @phone, @viewport, @content, @screen, @screenMask]
layer.x = layer.y = 0

0 comments on commit 638d6da

Please sign in to comment.