Skip to content

Commit

Permalink
Merge pull request #2822 from MerginMaps/Button-propagates-clicks-fro…
Browse files Browse the repository at this point in the history
…m-toolbar_CU-861mp5x42

Revamp mapcanvas gesture handlers & fix propagation issues
  • Loading branch information
tomasMizera authored Oct 5, 2023
2 parents d5605dc + 8401095 commit 6775145
Show file tree
Hide file tree
Showing 11 changed files with 336 additions and 521 deletions.
2 changes: 1 addition & 1 deletion app/qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ set(MM_QML
map/Crosshair.qml
map/Highlight.qml
map/LoadingIndicator.qml
map/MapCanvas.qml
map/MMMapCanvas.qml
map/MapWrapper.qml
map/PositionMarker.qml
map/RecordingToolbar.qml
Expand Down
16 changes: 10 additions & 6 deletions app/qml/NumberSpin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ Item {
width: imageDecrease.width * 3
height: imageDecrease.height * 3

TapHandler {
onTapped: function(eventPoint, button) {
if (minValue <= root.value - 1) root.value -=1
MouseArea {
anchors.fill: parent

onClicked: {
if (minValue <= root.value - 1) root.value -=1
}
}
}
Expand All @@ -86,9 +88,11 @@ Item {
width: imageIncrease.width * 3
height: imageIncrease.height * 3

TapHandler {
onTapped: function(eventPoint, button) {
if (maxValue >= root.value + 1) root.value +=1
MouseArea {
anchors.fill: parent

onClicked: {
if (maxValue >= root.value + 1) root.value +=1
}
}
}
Expand Down
24 changes: 16 additions & 8 deletions app/qml/SettingsPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ Item {
onCheckedChanged: __appSettings.autoCenterMapChecked = checked
}

TapHandler {
onTapped: function(eventPoint, button) {
MouseArea {
anchors.fill: parent

onClicked: {
autoCenterMapSwitch.toggle()
}
}
Expand Down Expand Up @@ -217,8 +219,10 @@ Item {
onCheckedChanged: __appSettings.gpsAccuracyWarning = checked
}

TapHandler {
onTapped: function(eventPoint, button) {
MouseArea {
anchors.fill: parent

onClicked: {
accuracyWarningSwitch.toggle()
}
}
Expand Down Expand Up @@ -300,8 +304,10 @@ Item {
onCheckedChanged: __appSettings.reuseLastEnteredValues = checked
}

TapHandler {
onTapped: function(eventPoint, button) {
MouseArea {
anchors.fill: parent

onClicked: {
rememberValuesSwitch.toggle()
}
}
Expand All @@ -320,8 +326,10 @@ Item {
onCheckedChanged: __appSettings.autosyncAllowed = checked
}

TapHandler {
onTapped: function(eventPoint, button) {
MouseArea {
anchors.fill: parent

onClicked: {
autosyncSwitch.toggle()
}
}
Expand Down
16 changes: 9 additions & 7 deletions app/qml/components/MainPanelButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ Rectangle {
anchors.fill: parent
enabled: root.enabled && handleClicks

TapHandler {
onTapped: function(eventPoint, button) {
root.activated()
}
MouseArea {
anchors.fill: parent

onLongPressed: {
root.activatedOnHold()
}
onClicked: {
root.activated()
}

onPressAndHold: {
root.activatedOnHold()
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions app/qml/components/MapFloatButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ Item {
Item {
anchors.fill: parent

TapHandler {
onTapped: function(eventPoint, button) {
MouseArea {
anchors.fill: parent

onClicked: {
root.clicked()
}

onLongPressed: function() {
onPressAndHold: {
root.pressAndHold()
}
}
Expand Down
26 changes: 14 additions & 12 deletions app/qml/editor/AbstractEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Item {
x: leftActionContainer.actionAllowed ? parent.x - customStyle.fields.sideMargin : parent.x
height: parent.height

TapHandler {
onPressedChanged: {
if ( !pressed ) {
root.leftActionClicked()
}
MouseArea {
anchors.fill: parent

onReleased: {
root.leftActionClicked()
}
}
}
Expand All @@ -79,8 +79,10 @@ Item {
height: parent.height
width: parent.width - ( leftActionContainer.width + rightActionContainer.width )

TapHandler {
onSingleTapped: {
MouseArea {
anchors.fill: parent

onClicked: {
root.contentClicked()
}
}
Expand All @@ -101,11 +103,11 @@ Item {
width: rightActionContainer.actionAllowed ? parent.width + customStyle.fields.sideMargin : parent.width
height: parent.height

TapHandler {
onPressedChanged: {
if ( !pressed ) {
root.rightActionClicked()
}
MouseArea {
anchors.fill: parent

onReleased: {
root.rightActionClicked()
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,6 @@ ApplicationWindow {
// if feature preview panel is opened
return formsStackManager.takenVerticalSpace - mainPanel.height
}
else if ( stateManager.state === "projects" || stateManager.state === "misc" )
{
//
// Due to an upstream bug in Qt, see #2387 and #2425 for more info
//
return window.height
}
else if ( gpsDataPageLoader.active )
{
//
// Block also GPS data page clicks propagation.
// Due to an upstream bug in Qt, see #2387 and #2425 for more info
//
return window.height
}

return 0
}
Expand Down Expand Up @@ -253,11 +238,6 @@ ApplicationWindow {
width: window.width
height: InputStyle.rowHeightHeader

//
// In order to workaround the QTBUG-108689 - we need to disable main panel's buttons when something else occupies the space
//
enabled: mainPanel.height > map.mapExtentOffset

y: window.height - height

visible: map.state === "view"
Expand Down
Loading

0 comments on commit 6775145

Please sign in to comment.