Commit f57c7369 authored by Filip Matijević's avatar Filip Matijević

[rotation] fix ScreenGestureArea when rotating

parent 17859efd
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
// SOFTWARE. // SOFTWARE.
import QtQuick 2.0 import QtQuick 2.0
import org.nemomobile.lipstick 0.1
MouseArea { MouseArea {
id: root id: root
...@@ -42,20 +43,27 @@ MouseArea { ...@@ -42,20 +43,27 @@ MouseArea {
// Internal // Internal
property int _mouseStart property int _mouseStart
property Item _mapTo: Lipstick.compositor.topmostWindow.window
function mouseToMouseReal(m) {
return mapToItem(_mapTo, m.x, m.y)
}
onPressed: { onPressed: {
if (mouse.x < boundary) { var mouseReal = mouseToMouseReal(mouse)
if (mouseReal.x < boundary) {
gesture = "right" gesture = "right"
max = width - mouse.x max = _mapTo.width - mouseReal.x
} else if (width - mouse.x < boundary) { } else if (_mapTo.width - mouseReal.x < boundary) {
gesture = "left" gesture = "left"
max = mouse.x max = mouseReal.x
} else if (mouse.y < boundary) { } else if (mouseReal.y < boundary) {
gesture = "down" gesture = "down"
max = height - mouse.y max = _mapTo.height - mouseReal.y
} else if (height - mouse.y < boundary) { } else if (_mapTo.height - mouseReal.y < boundary) {
gesture = "up" gesture = "up"
max = mouse.y max = mouseReal.y
} else { } else {
mouse.accepted = false mouse.accepted = false
return return
...@@ -63,15 +71,16 @@ MouseArea { ...@@ -63,15 +71,16 @@ MouseArea {
value = 0 value = 0
if (horizontal) if (horizontal)
_mouseStart = mouse.x _mouseStart = mouseReal.x
else else
_mouseStart = mouse.y _mouseStart = mouseReal.y
gestureStarted(gesture) gestureStarted(gesture)
} }
onPositionChanged: { onPositionChanged: {
var p = horizontal ? mouse.x : mouse.y var mouseReal = mouseToMouseReal(mouse)
var p = horizontal ? mouseReal.x : mouseReal.y
value = Math.max(Math.min(p - _mouseStart, max), -max) value = Math.max(Math.min(p - _mouseStart, max), -max)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment