neft
Version:
Universal Platform
42 lines (35 loc) • 1.26 kB
text/coffeescript
'use strict'
TOUCH_OS =
android: true
blackberry: true
ios: true
wince: true
winrt: true
winphone: true
module.exports = (impl) ->
initScreenNamespace: ->
{screen} = __stylesWindow
= screen.width
= screen.height
= !!TOUCH_OS[Qt.platform.os]
# orientation
getOrientation = ->
if screen.orientation & Qt.InvertedLandscapeOrientation
'InvertedLandscape'
else if screen.orientation & Qt.InvertedPortraitOrientation
'InvertedPortrait'
else if screen.orientation & Qt.LandscapeOrientation
'Landscape'
else
'Portrait'
updateOrientation = ->
oldVal =
= getOrientation()
.emit oldVal
return
screen.orientationUpdateMask = Qt.LandscapeOrientation | Qt.PortraitOrientation |
Qt.InvertedLandscapeOrientation |
Qt.InvertedPortraitOrientation;
= getOrientation()
screen.orientationChanged.connect @, updateOrientation
return