From 51a5c870d16f5422828c385be9dd800b1645d761 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Wed, 5 Dec 2018 17:46:29 -0200 Subject: [PATCH] FlightMap.qml: Add rotation using gcsHeading --- src/FlightMap/FlightMap.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 635acab5fe..568b20f33b 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -35,6 +35,7 @@ Map { property string mapName: 'defaultMap' property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1 property var gcsPosition: QGroundControl.qgcPositionManger.gcsPosition + property var gcsHeading: QGroundControl.qgcPositionManger.gcsHeading property bool userPanned: false ///< true: the user has manually panned the map property bool allowGCSLocationCenter: false ///< true: map will center/zoom to gcs location one time property bool allowVehicleLocationCenter: false ///< true: map will center/zoom to vehicle location one time @@ -134,12 +135,18 @@ Map { coordinate: gcsPosition sourceItem: Image { - source: "/res/QGCLogoFull" + id: mapItemImage + source: isNaN(gcsHeading) ? "/res/QGCLogoFull" : "/res/QGCLogoArrow" mipmap: true antialiasing: true fillMode: Image.PreserveAspectFit - height: ScreenTools.defaultFontPixelHeight * 1.75 + height: ScreenTools.defaultFontPixelHeight * (isNaN(gcsHeading) ? 1.75 : 2.5 ) sourceSize.height: height + transform: Rotation { + origin.x: mapItemImage.width / 2 + origin.y: mapItemImage.height / 2 + angle: isNaN(gcsHeading) ? 0 : gcsHeading + } } } } // Map -- GitLab