neft
Version:
Universal Platform
51 lines (44 loc) • 1.3 kB
text/coffeescript
TOUCH_OS =
android: true
blackberry: true
ios: true
wince: true
PLATFORMS =
android: 'Android'
ios: 'iOS'
blackberry: 'BlackBerry'
wince: 'WindowsCE'
winrt: 'WindowsRT'
winphone: 'WindowsPhone'
linux: 'Linux'
windows: 'Windows'
unix: 'Unix'
osx: 'OSX'
module.exports = (impl) ->
initDeviceNamespace: ->
device = @
{pointer} = @
{screen} = __stylesWindow
= PLATFORMS[Qt.platform.os] or 'Unix'
= screen.devicePixelRatio
isTouch = !!TOUCH_OS[Qt.platform.os]
= not isTouch
= isTouch and Math.min(, )/Math.max(, ) < 0.75
__stylesMouseArea.onPressed.connect (e) ->
e.accepted = true
pointer.x = e.x
pointer.y = e.y
device.onPointerPress.emit pointer
return
__stylesMouseArea.onPositionChanged.connect (e) ->
pointer.x = e.x
pointer.y = e.y
device.onPointerMove.emit pointer
return
__stylesMouseArea.onReleased.connect (e) ->
pointer.x = e.x
pointer.y = e.y
device.onPointerRelease.emit pointer
return
return