Commit d53bb78e authored by Don Gagne's avatar Don Gagne

Fix DropButton parenting

parent 671a465f
...@@ -77,7 +77,7 @@ FlightMap { ...@@ -77,7 +77,7 @@ FlightMap {
color: mapPal.text color: mapPal.text
visible: !ScreenTools.isShortScreen visible: !ScreenTools.isShortScreen
anchors.topMargin: _toolButtonTopMargin anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: toolColumn.horizontalCenter anchors.horizontalCenter: centerMapDropButton.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
} }
...@@ -103,18 +103,17 @@ FlightMap { ...@@ -103,18 +103,17 @@ FlightMap {
} }
} }
Column { // IMPORTANT NOTE: Drop Buttons must be parented directly to the map. If they are placed in a Column for example the drop control positioning
id: toolColumn // will not work correctly.
anchors.topMargin: ScreenTools.isShortScreen ? _toolButtonTopMargin : ScreenTools.defaultFontPixelHeight / 2
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: ScreenTools.isShortScreen ? parent.top : flyLabel.bottom
spacing: ScreenTools.defaultFontPixelHeight
z: QGroundControl.zOrderWidgets
//-- Map Center Control //-- Map Center Control
CenterMapDropButton { CenterMapDropButton {
id: centerMapDropButton id: centerMapDropButton
anchors.topMargin: flyLabel.visible ? ScreenTools.defaultFontPixelHeight / 2 : _toolButtonTopMargin
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: flyLabel.visible ? flyLabel.bottom : parent.top
z: QGroundControl.zOrderWidgets
exclusiveGroup: dropButtonsExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
map: _flightMap map: _flightMap
mapFitViewport: Qt.rect(leftToolWidth, _toolButtonTopMargin, flightMap.width - leftToolWidth - rightPanelWidth, flightMap.height - _toolButtonTopMargin) mapFitViewport: Qt.rect(leftToolWidth, _toolButtonTopMargin, flightMap.width - leftToolWidth - rightPanelWidth, flightMap.height - _toolButtonTopMargin)
...@@ -132,6 +131,9 @@ FlightMap { ...@@ -132,6 +131,9 @@ FlightMap {
//-- Map Type Control //-- Map Type Control
DropButton { DropButton {
id: mapTypeButton id: mapTypeButton
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: centerMapDropButton.bottom
anchors.left: centerMapDropButton.left
dropDirection: dropRight dropDirection: dropRight
buttonImage: "/qmlimages/MapType.svg" buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -181,6 +183,9 @@ FlightMap { ...@@ -181,6 +183,9 @@ FlightMap {
//-- Zoom Map In //-- Zoom Map In
RoundButton { RoundButton {
id: mapZoomPlus id: mapZoomPlus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapTypeButton.bottom
anchors.left: mapTypeButton.left
visible: !ScreenTools.isTinyScreen && _mainIsMap visible: !ScreenTools.isTinyScreen && _mainIsMap
buttonImage: "/qmlimages/ZoomPlus.svg" buttonImage: "/qmlimages/ZoomPlus.svg"
exclusiveGroup: dropButtonsExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
...@@ -196,6 +201,9 @@ FlightMap { ...@@ -196,6 +201,9 @@ FlightMap {
//-- Zoom Map Out //-- Zoom Map Out
RoundButton { RoundButton {
id: mapZoomMinus id: mapZoomMinus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapZoomPlus.bottom
anchors.left: mapZoomPlus.left
visible: !ScreenTools.isTinyScreen && _mainIsMap visible: !ScreenTools.isTinyScreen && _mainIsMap
buttonImage: "/qmlimages/ZoomMinus.svg" buttonImage: "/qmlimages/ZoomMinus.svg"
exclusiveGroup: dropButtonsExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
...@@ -207,7 +215,6 @@ FlightMap { ...@@ -207,7 +215,6 @@ FlightMap {
checked = false checked = false
} }
} }
}
// Add trajectory points to the map // Add trajectory points to the map
MapItemView { MapItemView {
......
...@@ -773,22 +773,21 @@ QGCView { ...@@ -773,22 +773,21 @@ QGCView {
color: mapPal.text color: mapPal.text
visible: !ScreenTools.isShortScreen visible: !ScreenTools.isShortScreen
anchors.topMargin: _toolButtonTopMargin anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: toolColumn.horizontalCenter anchors.horizontalCenter: addMissionItemsButton.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
} }
// IMPORTANT NOTE: Drop Buttons must be parented directly to the map. If they are placed in a Column for example the drop control positioning
// will not work correctly.
//-- Vertical Tool Buttons //-- Vertical Tool Buttons
Column {
id: toolColumn
anchors.topMargin: ScreenTools.isShortScreen ? _toolButtonTopMargin : ScreenTools.defaultFontPixelHeight / 2
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: ScreenTools.isShortScreen ? parent.top : planLabel.bottom
spacing: ScreenTools.defaultFontPixelHeight
z: QGroundControl.zOrderWidgets
RoundButton { RoundButton {
id: addMissionItemsButton id: addMissionItemsButton
anchors.topMargin: planLabel.visible ? ScreenTools.defaultFontPixelHeight / 2 : _toolButtonTopMargin
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: planLabel.visible ? planLabel.bottom : parent.top
buttonImage: "/qmlimages/MapAddMission.svg" buttonImage: "/qmlimages/MapAddMission.svg"
lightBorders: _lightWidgetBorders lightBorders: _lightWidgetBorders
visible: _editingLayer == _layerMission visible: _editingLayer == _layerMission
...@@ -796,6 +795,9 @@ QGCView { ...@@ -796,6 +795,9 @@ QGCView {
RoundButton { RoundButton {
id: addShapeButton id: addShapeButton
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: addMissionItemsButton.bottom
anchors.left: addMissionItemsButton.left
buttonImage: "/qmlimages/MapDrawShape.svg" buttonImage: "/qmlimages/MapDrawShape.svg"
lightBorders: _lightWidgetBorders lightBorders: _lightWidgetBorders
visible: _editingLayer == _layerMission visible: _editingLayer == _layerMission
...@@ -814,6 +816,9 @@ QGCView { ...@@ -814,6 +816,9 @@ QGCView {
DropButton { DropButton {
id: syncButton id: syncButton
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: addShapeButton.bottom
anchors.left: addShapeButton.left
dropDirection: dropRight dropDirection: dropRight
buttonImage: _syncDropDownController.dirty ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg" buttonImage: _syncDropDownController.dirty ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -826,6 +831,9 @@ QGCView { ...@@ -826,6 +831,9 @@ QGCView {
CenterMapDropButton { CenterMapDropButton {
id: centerMapButton id: centerMapButton
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: syncButton.bottom
anchors.left: syncButton.left
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
map: editorMap map: editorMap
mapFitViewport: Qt.rect(leftToolWidth, toolbarHeight, editorMap.width - leftToolWidth - rightPanelWidth, editorMap.height - toolbarHeight) mapFitViewport: Qt.rect(leftToolWidth, toolbarHeight, editorMap.width - leftToolWidth - rightPanelWidth, editorMap.height - toolbarHeight)
...@@ -841,6 +849,9 @@ QGCView { ...@@ -841,6 +849,9 @@ QGCView {
DropButton { DropButton {
id: mapTypeButton id: mapTypeButton
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: centerMapButton.bottom
anchors.left: centerMapButton.left
dropDirection: dropRight dropDirection: dropRight
buttonImage: "/qmlimages/MapType.svg" buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -876,6 +887,9 @@ QGCView { ...@@ -876,6 +887,9 @@ QGCView {
//-- Zoom Map In //-- Zoom Map In
RoundButton { RoundButton {
id: mapZoomPlus id: mapZoomPlus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapTypeButton.bottom
anchors.left: mapTypeButton.left
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomPlus.svg" buttonImage: "/qmlimages/ZoomPlus.svg"
lightBorders: _lightWidgetBorders lightBorders: _lightWidgetBorders
...@@ -890,6 +904,9 @@ QGCView { ...@@ -890,6 +904,9 @@ QGCView {
//-- Zoom Map Out //-- Zoom Map Out
RoundButton { RoundButton {
id: mapZoomMinus id: mapZoomMinus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapZoomPlus.bottom
anchors.left: mapZoomPlus.left
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomMinus.svg" buttonImage: "/qmlimages/ZoomMinus.svg"
lightBorders: _lightWidgetBorders lightBorders: _lightWidgetBorders
...@@ -899,7 +916,6 @@ QGCView { ...@@ -899,7 +916,6 @@ QGCView {
checked = false checked = false
} }
} }
}
MapScale { MapScale {
anchors.margins: ScreenTools.defaultFontPixelHeight * (0.66) anchors.margins: ScreenTools.defaultFontPixelHeight * (0.66)
......
...@@ -15,6 +15,7 @@ Item { ...@@ -15,6 +15,7 @@ Item {
property int dropDirection: dropDown property int dropDirection: dropDown
property alias dropDownComponent: dropDownLoader.sourceComponent property alias dropDownComponent: dropDownLoader.sourceComponent
property real viewportMargins: 0 property real viewportMargins: 0
property real topMargin: parent.height - ScreenTools.availableHeight
property alias lightBorders: roundButton.lightBorders property alias lightBorders: roundButton.lightBorders
width: radius * 2 width: radius * 2
...@@ -35,7 +36,7 @@ Item { ...@@ -35,7 +36,7 @@ Item {
property real _viewportMaxLeft: -x + viewportMargins property real _viewportMaxLeft: -x + viewportMargins
property real _viewportMaxRight: parent.width - (viewportMargins * 2) - x property real _viewportMaxRight: parent.width - (viewportMargins * 2) - x
property real _viewportMaxTop: -y + viewportMargins property real _viewportMaxTop: -y + viewportMargins + topMargin
property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y
// Set up ExclusiveGroup support. We use the checked property to drive visibility of drop down. // Set up ExclusiveGroup support. We use the checked property to drive visibility of drop down.
...@@ -53,8 +54,6 @@ Item { ...@@ -53,8 +54,6 @@ Item {
checked = false checked = false
} }
Component.onCompleted: _calcPositions()
function _calcPositions() { function _calcPositions() {
var dropComponentWidth = dropDownLoader.item.width var dropComponentWidth = dropDownLoader.item.width
var dropComponentHeight = dropDownLoader.item.height var dropComponentHeight = dropDownLoader.item.height
...@@ -161,6 +160,7 @@ Item { ...@@ -161,6 +160,7 @@ Item {
id: roundButton id: roundButton
radius: parent.width / 2 radius: parent.width / 2
onClicked: { onClicked: {
_calcPositions()
_root.clicked() _root.clicked()
} }
} }
...@@ -216,20 +216,11 @@ Item { ...@@ -216,20 +216,11 @@ Item {
Item { Item {
id: dropItemHolderRect id: dropItemHolderRect
//color: qgcPal.button
//radius: _dropCornerRadius
Loader { Loader {
id: dropDownLoader id: dropDownLoader
x: _dropMargin x: _dropMargin
y: _dropMargin y: _dropMargin
Connections {
target: dropDownLoader.item
onWidthChanged: _calcPositions()
onHeightChanged: _calcPositions()
}
} }
} }
} // Item - dropDownItem } // Item - dropDownItem
......
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