diff options
Diffstat (limited to 'examples/location/mapviewer/map/ImageItem.qml')
-rw-r--r-- | examples/location/mapviewer/map/ImageItem.qml | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/examples/location/mapviewer/map/ImageItem.qml b/examples/location/mapviewer/map/ImageItem.qml index ca8de2b5..433b12ef 100644 --- a/examples/location/mapviewer/map/ImageItem.qml +++ b/examples/location/mapviewer/map/ImageItem.qml @@ -6,14 +6,22 @@ import QtLocation MapQuickItem { //to be used inside MapComponent only id: imageItem - MouseArea { - anchors.fill: parent - drag.target: parent + anchorPoint.x: testImage.width/2 + anchorPoint.y: testImage.height/2 + + function setGeometry(anchorCoordinate) { + coordinate = anchorCoordinate + } + + function addGeometry(newCoordinate, changeLast){ + var p1 = view.map.fromCoordinate(coordinate, false); + var p2 = view.map.fromCoordinate(newCoordinate, false); + var size = Math.max(Math.abs((p1.x-p2.x)), Math.abs((p1.y-p2.y))); + testImage.scale = Math.max(0.1, size/Math.max(testImage.height, testImage.width))*2 + return true } - function setGeometry(markers, index) { - coordinate.latitude = markers[index].coordinate.latitude - coordinate.longitude = markers[index].coordinate.longitude + function finishAddGeometry(){ } sourceItem: Image { |