Commit 7e5b45a9 authored by Gus Grubba's avatar Gus Grubba

Fix indicator dropdowns x position on screen

parent 1e54c4ba
......@@ -555,9 +555,9 @@ ApplicationWindow {
//-------------------------------------------------------------------------
//-- Indicator Popups
function showPopUp(dropItem, centerX) {
indicatorDropdown.centerX = centerX
function showPopUp(item, dropItem) {
indicatorDropdown.currentIndicator = dropItem
indicatorDropdown.currentItem = item
indicatorDropdown.open()
}
......@@ -567,8 +567,8 @@ ApplicationWindow {
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property var currentIndicator: null
property real centerX: 0
property var currentItem: null
property var currentIndicator: null
background: Rectangle {
width: loader.width
height: loader.height
......@@ -577,7 +577,7 @@ ApplicationWindow {
Loader {
id: loader
onLoaded: {
indicatorDropdown.x = mapFromGlobal(indicatorDropdown.centerX, 0).x
indicatorDropdown.x = mainWindow.contentItem.mapFromItem(indicatorDropdown.currentItem, 0, 0).x - (loader.width * 0.5)
}
}
onOpened: {
......
......@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- Battery Indicator
Item {
id: _root
anchors.top: parent.top
anchors.bottom: parent.bottom
width: batteryIndicatorRow.width
......@@ -117,8 +118,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(batteryInfo, centerX)
mainWindow.showPopUp(_root, batteryInfo)
}
}
}
......@@ -19,7 +19,7 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- GPS Indicator
Item {
id: satelitte
id: _root
width: (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -107,8 +107,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(gpsInfo, centerX)
mainWindow.showPopUp(_root, gpsInfo)
}
}
}
......@@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- GPS Indicator
Item {
id: satelitte
id: _root
width: visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -108,8 +108,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(gpsInfo, centerX)
mainWindow.showPopUp(_root, gpsInfo)
}
}
}
......@@ -18,6 +18,7 @@ import QGroundControl.Palette 1.0
// Joystick Indicator
Item {
id: _root
width: joystickRow.width * 1.1
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -90,8 +91,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(joystickInfo, centerX)
mainWindow.showPopUp(_root, joystickInfo)
}
}
}
......@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- RC RSSI Indicator
Item {
id: _root
width: rssiRow.width * 1.1
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -92,8 +93,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(rcRSSIInfo, centerX)
mainWindow.showPopUp(_root, rcRSSIInfo)
}
}
}
......@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- Telemetry RSSI
Item {
id: _root
anchors.top: parent.top
anchors.bottom: parent.bottom
width: _hasTelemetry ? telemIcon.width * 1.1 : 0
......@@ -83,8 +84,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x
mainWindow.showPopUp(telemRSSIInfo, centerX)
mainWindow.showPopUp(_root, telemRSSIInfo)
}
}
}
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