Skip to content

Commit

Permalink
Add more view switch prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Dec 29, 2024
1 parent 5a90551 commit 1284628
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/PlanView/MissionItemEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
currentItemScope.focus = true
_root.clicked()
if (mainWindow.allowViewSwitch()) {
currentItemScope.focus = true
_root.clicked()
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/PlanView/PlanView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ Item {
onMapClicked: (mouse) => {
// Take focus to close any previous editing
editorMap.focus = true
if (!mainWindow.allowViewSwitch()) {
return
}
var coordinate = editorMap.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces)
coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
Expand Down
20 changes: 12 additions & 8 deletions src/QmlControls/ToolStripHoverButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ Button {
onCheckedChanged: toolStripAction.checked = checked

onClicked: {
dropPanel.hide()
if (!toolStripAction.dropPanelComponent) {
toolStripAction.triggered(this)
} else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0)
dropPanel.show(panelEdgeTopPoint, toolStripAction.dropPanelComponent, this)
checked = true
control.dropped(index)
if (mainWindow.allowViewSwitch()) {
dropPanel.hide()
if (!toolStripAction.dropPanelComponent) {
toolStripAction.triggered(this)
} else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0)
dropPanel.show(panelEdgeTopPoint, toolStripAction.dropPanelComponent, this)
checked = true
control.dropped(index)
}
} else if (checkable) {
checked = !checked
}
}

Expand Down

0 comments on commit 1284628

Please sign in to comment.