diff --git a/src/qml/MapCanvas.qml b/src/qml/MapCanvas.qml index 888120f5f2..153973c773 100644 --- a/src/qml/MapCanvas.qml +++ b/src/qml/MapCanvas.qml @@ -35,6 +35,7 @@ Item { property bool hovered: false property bool pinched: pinchHandler.active property bool freehandDigitizing: false + property bool isMapRotationEnabled: false // for signals, type can be "stylus" for any device click or "touch" @@ -346,7 +347,7 @@ Item { DragHandler { target: null - enabled: interactive + enabled: interactive && isMapRotationEnabled acceptedDevices: PointerDevice.Stylus | PointerDevice.Mouse acceptedModifiers: Qt.ShiftModifier grabPermissions: PointerHandler.TakeOverForbidden @@ -421,7 +422,7 @@ Item { } onRotationChanged: { - if ( active ) + if ( active && isMapRotationEnabled ) { if (rotationTresholdReached) { diff --git a/src/qml/QFieldSettings.qml b/src/qml/QFieldSettings.qml index 806fe8f7e8..ea10eb783e 100644 --- a/src/qml/QFieldSettings.qml +++ b/src/qml/QFieldSettings.qml @@ -23,6 +23,7 @@ Page { property alias fingerTapDigitizing: registry.fingerTapDigitizing property alias mouseAsTouchScreen: registry.mouseAsTouchScreen property alias enableInfoCollection: registry.enableInfoCollection + property alias enableMapRotation: registry.enableMapRotation property alias quality: registry.quality Component.onCompleted: { @@ -45,6 +46,7 @@ Page { property bool fingerTapDigitizing: false property bool mouseAsTouchScreen: false property bool enableInfoCollection: true + property bool enableMapRotation: true property double quality: 1.0 onEnableInfoCollectionChanged: { @@ -78,6 +80,12 @@ Page { settingAlias: "showBookmarks" isVisible: true } + ListElement { + title: qsTr( "Enable map rotation" ) + description: qsTr( "When switched on, the map can be rotated by the user." ) + settingAlias: "enableMapRotation" + isVisible: true + } } ListModel { diff --git a/src/qml/imports/Theme/Theme.qml b/src/qml/imports/Theme/Theme.qml index cd3722bb18..02e0621c72 100644 --- a/src/qml/imports/Theme/Theme.qml +++ b/src/qml/imports/Theme/Theme.qml @@ -77,9 +77,9 @@ QtObject { readonly property int popupScreenEdgeMargin: 40 - readonly property int menuItemIconlessLeftPadding: 54 - readonly property int menuItemLeftPadding: 14 - readonly property int menuItemCheckLeftPadding: 20 + readonly property int menuItemIconlessLeftPadding: 52 + readonly property int menuItemLeftPadding: 12 + readonly property int menuItemCheckLeftPadding: 16 function getThemeIcon(name) { var ppiName diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 4b09d8c1db..b743ecf957 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -455,6 +455,7 @@ ApplicationWindow { !sketcher.visible && !overlayFeatureFormDrawer.visible interactive: isEnabled && !screenLocker.enabled + isMapRotationEnabled: qfieldSettings.enableMapRotation incrementalRendering: true quality: qfieldSettings.quality forceDeferredLayersRepaint: trackings.count > 0 @@ -2636,12 +2637,14 @@ ApplicationWindow { var xValue = Number( displayPoint.x ).toLocaleString( Qt.locale(), 'f', isGeographic ? 7 : 3 ) var yLabel = isGeographic ? qsTr( 'Lat' ) : 'Y' var yValue = Number( displayPoint.y ).toLocaleString( Qt.locale(), 'f', isGeographic ? 7 : 3 ) - xItem.text = isXY + const xItemText = isXY ? xLabel + ': ' + xValue : yLabel + ': ' + yValue - yItem.text = isXY + const yItemText = isXY ? yLabel + ': ' + yValue : xLabel + ': ' + xValue + + cordinateItem.text = xItemText + " " + yItemText } topMargin: sceneTopMargin @@ -2675,19 +2678,18 @@ ApplicationWindow { MenuSeparator { width: parent.width; height: canvasMenuActionsToolbar.children.length > 0 ? undefined : 0 } MenuItem { - id: xItem - text: "" - height: 48 - font: Theme.defaultFont - enabled:false - } + id: cordinateItem + text: "" + height: 48 + leftPadding: Theme.menuItemLeftPadding + font: Theme.defaultFont + icon.source: Theme.getThemeVectorIcon( "ic_copy_black_24dp" ) - MenuItem { - id: yItem - text: "" - height: 48 - font: Theme.defaultFont - enabled:false + onTriggered: { + const displayPoint = GeometryUtils.reprojectPoint(canvasMenu.point, mapCanvas.mapSettings.destinationCrs, projectInfo.coordinateDisplayCrs) + platformUtilities.copyTextToClipboard(StringUtils.pointInformation(displayPoint, projectInfo.coordinateDisplayCrs)) + displayToast(qsTr('Coordinates copied to clipboard')); + } } MenuSeparator { width: parent.width } @@ -2727,18 +2729,19 @@ ApplicationWindow { } MenuItem { - id: copyCoordinatesItem - text: qsTr( "Copy Coordinates" ) + id: lockMapRotation + text: "Enable Map Rotation" height: 48 - leftPadding: Theme.menuItemLeftPadding + leftPadding: Theme.menuItemCheckLeftPadding font: Theme.defaultFont - icon.source: Theme.getThemeVectorIcon( "ic_copy_black_24dp" ) + checkable: true + checked: qfieldSettings.enableMapRotation + indicator.height: 20 + indicator.width: 20 + indicator.implicitHeight: 24 + indicator.implicitWidth: 24 - onTriggered: { - var displayPoint = GeometryUtils.reprojectPoint(canvasMenu.point, mapCanvas.mapSettings.destinationCrs, projectInfo.coordinateDisplayCrs) - platformUtilities.copyTextToClipboard(StringUtils.pointInformation(displayPoint, projectInfo.coordinateDisplayCrs)) - displayToast(qsTr('Coordinates copied to clipboard')); - } + onTriggered: qfieldSettings.enableMapRotation = checked } MenuSeparator { width: parent.width }