Permalink
Browse files

Clean up Screen and base it on device.screenSize

  • Loading branch information...
koenbok committed May 11, 2016
1 parent 9e60469 commit 51ebe97b5ace051fce15ce99dbb7d9a2912971cd
Showing with 19 additions and 42 deletions.
  1. +19 −42 framer/Screen.coffee
@@ -2,50 +2,27 @@
class ScreenClass extends BaseClass
@define "width", get: -> Framer.CurrentContext.width
@define "height", get: -> Framer.CurrentContext.height
@define "size", get: -> Framer.CurrentContext.size
@define "frame", get: -> Framer.CurrentContext.frame
@define "canvasFrame", get: -> Framer.CurrentContext.canvasFrame
@define "backgroundColor",
importable: false
exportable: false
get: -> Framer.Device.screen.backgroundColor
set: (value) ->
Framer.Device.screen.backgroundColor = value
@define "perspective",
importable: false
exportable: false
get: -> Framer.CurrentContext.perspective
set: (value) ->
Framer.CurrentContext.perspective = value
@define "perspectiveOriginX",
importable: false
exportable: false
get: -> Framer.CurrentContext.perspectiveOriginX
set: (value) ->
Framer.CurrentContext.perspectiveOriginX = value
@define "perspectiveOriginY",
importable: false
exportable: false
get: -> Framer.CurrentContext.perspectiveOriginY
set: (value) ->
Framer.CurrentContext.perspectiveOriginY = value
# Todo: maybe resize based on parent layer
@define "width", get: ->
return @device.screenSize.width if @device
return Canvas.width
@define "height", get: ->
return @device.screenSize.height if @device
return Canvas.height
@define "canvasFrame", get: ->
return @device.context.canvasFrame if @device
return @frame
@define "size", get: -> Utils.size(@)
@define "frame", get: -> Utils.frame(@)
@define "device", get: -> Framer.CurrentContext.device
@define "backgroundColor", @proxyProperty("device.screen.backgroundColor")
@define "perspective", @proxyProperty("device.context.perspective")
@define "perspectiveOriginX", @proxyProperty("device.context.perspectiveOriginX")
@define "perspectiveOriginY", @proxyProperty("device.context.perspectiveOriginY")
toInspect: ->
round = (value) ->
if parseInt(value) == value
return parseInt(value)
return Utils.round(value, 1)
return "<Screen #{round(@width)}x#{round(@height)}>"
return "<Screen #{Utils.roundWhole(@width)}x#{Utils.roundWhole(@height)}>"
# Edge Swipe

0 comments on commit 51ebe97

Please sign in to comment.