diff options
author | Alexey Andriyashin <alexey.andriyashin@nokia.com> | 2011-12-29 14:22:42 +0200 |
---|---|---|
committer | Alexey Andriyashin <alexey.andriyashin@nokia.com> | 2011-12-29 14:22:42 +0200 |
commit | 4f668f9ce17daeb62be99608707e5054591684ac (patch) | |
tree | dba146d1b779e4ab642722b70a63815c2508fff3 /tests/manual/testbed/PositionPicker.qml | |
parent | 50a745cd9c396c991ffa95c5f084484150a260f4 (diff) | |
download | qtgraphicaleffects-4f668f9ce17daeb62be99608707e5054591684ac.tar.gz |
Fix PositionPicker position after resize
Diffstat (limited to 'tests/manual/testbed/PositionPicker.qml')
-rw-r--r-- | tests/manual/testbed/PositionPicker.qml | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/manual/testbed/PositionPicker.qml b/tests/manual/testbed/PositionPicker.qml index 522a690..d29c3ea 100644 --- a/tests/manual/testbed/PositionPicker.qml +++ b/tests/manual/testbed/PositionPicker.qml @@ -45,8 +45,8 @@ Image { property real xValue: 0 property real yValue: 0 - x: xValue - positionPicker.width / 2 - y: yValue - positionPicker.height / 2 + x: parent.width * xValue - positionPicker.width / 2 + y: parent.height * yValue - positionPicker.height / 2 property alias pressed: mouseArea.pressed @@ -65,11 +65,8 @@ Image { } onPositionChanged: { - xValue = positionPicker.x + positionPicker.width / 2 + mouseX - startX; - yValue = positionPicker.y + positionPicker.height / 2 + mouseY - startY; - - positionPicker.x += mouseX - startX; - positionPicker.y += mouseY - startY; + xValue = (positionPicker.x + positionPicker.width / 2 + mouseX - startX) / positionPicker.parent.width; + yValue = (positionPicker.y + positionPicker.height / 2 + mouseY - startY) / positionPicker.parent.height; } } } |