diff --git a/app/qml/components/MMDrawer.qml b/app/qml/components/MMDrawer.qml index a8c0d40f9..11bde9f55 100644 --- a/app/qml/components/MMDrawer.qml +++ b/app/qml/components/MMDrawer.qml @@ -18,10 +18,12 @@ Drawer { property alias drawerHeader: mmDrawerHeader property alias content: contentGroup.children - property double drawerSpacing: __style.spacing40 // Change this to 20 if using searchbar + property double drawerSpacing: __style.spacing20 + property double drawerBottomMargin: __style.margin8 // set to 0 to draw behind navigation bar property real maxHeight: ( ApplicationWindow.window?.height ?? 0 ) - __style.safeAreaTop + signal backClicked() implicitHeight: contentHeight > maxHeight ? maxHeight : contentHeight implicitWidth: ApplicationWindow.window?.width ?? 0 @@ -55,13 +57,20 @@ Drawer { height: parent.height / 2 y: parent.height / 2 } + + Keys.onReleased: function( event ) { + if ( event.key === Qt.Key_Back || event.key === Qt.Key_Escape ) { + root.backClicked() + event.accepted = true + } + } } contentItem: Column { id: mainColumn anchors.fill: parent - spacing: root.drawerSpacing + spacing: 0 height: mmDrawerHeader.height + contentGroup.height + root.drawerSpacing @@ -75,6 +84,11 @@ Drawer { } } + Item { + width: parent.width + height: root.drawerSpacing + } + Item { id: contentGroup @@ -106,6 +120,12 @@ Drawer { // center the content x: leftPadding } + + // Bottom spacer + Item { + width: parent.width + height: root.drawerBottomMargin > 0 ? __style.safeAreaBottom + root.drawerBottomMargin :0 + } } QtObject { diff --git a/app/qml/components/MMPage.qml b/app/qml/components/MMPage.qml index a6a04dab0..17eedf7a9 100644 --- a/app/qml/components/MMPage.qml +++ b/app/qml/components/MMPage.qml @@ -17,6 +17,7 @@ Page { property alias content: contentGroup.children property double pageSpacing: __style.spacing40 // Change this to 20 if using searchbar + property real pageBottomMargin: __style.margin20 // Set to 0 to draw behind navigation bar signal backClicked() @@ -63,7 +64,7 @@ Page { return minRightPadding } - height: parent.height - root.pageSpacing + height: parent.height - root.pageSpacing - root.pageBottomMargin width: parent.width - leftPadding - rightPadding // center the content diff --git a/app/qml/gps/MMStakeoutPanel.qml b/app/qml/gps/MMStakeoutPanel.qml index 5a5e4d618..b4a551122 100644 --- a/app/qml/gps/MMStakeoutPanel.qml +++ b/app/qml/gps/MMStakeoutPanel.qml @@ -17,15 +17,10 @@ import mm 1.0 as MM import "../components" import "../map" -import "." -import ".." -Drawer { +MMDrawer { id: root - property int gpsIconHeight: 70 - property int gpsIconWidth: 58 - property var mapCanvas property var targetPair: null @@ -43,15 +38,6 @@ Drawer { signal autoFollowClicked() signal stakeoutFinished() - width: ApplicationWindow.window.width - height: roundedRect.childrenRect.height + borderRectangle.height - edge: Qt.BottomEdge - focus: true - dim: true - interactive: false - dragMargin: 0 - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - Component.onCompleted: { root.open() } @@ -79,242 +65,180 @@ Drawer { } } - Keys.onReleased: function( event ) { - if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) { - event.accepted = true; - endStakeout() - } - } + onBackClicked: endStakeout() StateGroup { id: distanceState states: [ - State { - name: "longRange" - when: root.remainingDistance >= root.closeRangeModeDistanceThreshold || root.remainingDistance < 0 - }, - State { - name: "closeRange" - when: root.remainingDistance >= 0 && root.remainingDistance < root.closeRangeModeDistanceThreshold - } + State { + name: "longRange" + when: root.remainingDistance >= root.closeRangeModeDistanceThreshold || root.remainingDistance < 0 + }, + State { + name: "closeRange" + when: root.remainingDistance >= 0 && root.remainingDistance < root.closeRangeModeDistanceThreshold + } ] } - Rectangle { - id: borderRectangle - - color: roundedRect.color - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: 2 * radius - anchors.topMargin: -radius - radius: 20 * __dp - } - - Rectangle { - id: roundedRect - - anchors.fill: parent - color: __style.whiteColor - - MMPageHeader { - id: header + drawerHeader.title: qsTr("Stake out") - backVisible: false + content: Column { + id: mainColumn - title: qsTr("Stake out") - titleFont: __style.t2 - - MMRoundButton { - id: closeBtn - - anchors.right: parent.right - anchors.rightMargin: __style.pageMargins - anchors.verticalCenter: parent.verticalCenter - - iconSource: __style.closeIcon - iconColor: __style.forestColor - - bgndColor: __style.lightGreenColor - bgndHoverColor: __style.mediumGreenColor - - onClicked: close() - } - } - - Column { - id: mainColumn + width: parent.width + spacing: __style.margin12 + Row { width: parent.width - anchors.left: parent.left - anchors.right: parent.right - anchors.top: header.bottom - anchors.leftMargin: __style.pageMargins - anchors.rightMargin: __style.pageMargins - anchors.topMargin: __style.pageMargins - - spacing: __style.margin12 - - Row { - width: parent.width - height: __style.row67 - - MMGpsDataText{ - titleText: qsTr( "Feature" ) - descriptionText: root.targetPair ? __inputUtils.featureTitle( root.targetPair, __activeProject.qgsProject ) : "" - } + height: __style.row67 - MMGpsDataText{ - titleText: qsTr( "Distance" ) - descriptionText: remainingDistance >= 0 ?__inputUtils.formatDistanceInProjectUnit( remainingDistance, 2 ) : qsTr( "N/A" ) - alignmentRight: true - } + MMGpsDataText{ + titleText: qsTr( "Feature" ) + descriptionText: root.targetPair ? __inputUtils.featureTitle( root.targetPair, __activeProject.qgsProject ) : "" } - MMLine { - visible: distanceState.state === "closeRange" + MMGpsDataText{ + titleText: qsTr( "Distance" ) + descriptionText: remainingDistance >= 0 ?__inputUtils.formatDistanceInProjectUnit( remainingDistance, 2 ) : qsTr( "N/A" ) + alignmentRight: true } + } - ScrollView { - id: gpsScrollView - - width: parent.width - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AlwaysOff - - visible: root.state === "closeRange" + MMLine { + visible: distanceState.state === "closeRange" + } - Column { - width:parent.width - anchors.fill: parent - spacing: 0 + ScrollView { + id: gpsScrollView - Item { - id: closeRangeModeComponent - - height: 200 * __dp - width: parent.width - - states: [ - State { - name: "atTarget" - when: root.remainingDistance < root.targetReachedDistanceThreshold - }, - State { - name: "notAtTarget" - when: state !== "atTarget" - } - ] + width: parent.width + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AlwaysOff + + visible: root.state === "closeRange" + + Column { + width:parent.width + anchors.fill: parent + spacing: 0 + + Item { + id: closeRangeModeComponent + + height: 200 * __dp + width: parent.width + + states: [ + State { + name: "atTarget" + when: root.remainingDistance < root.targetReachedDistanceThreshold + }, + State { + name: "notAtTarget" + when: state !== "atTarget" + } + ] - state: "notAtTarget" + state: "notAtTarget" - // enable antialiasing - layer.enabled: true - layer.samples: 4 + // enable antialiasing + layer.enabled: true + layer.samples: 4 - Shape { - id: rootShape + Shape { + id: rootShape - property real centerX: width / 2 - property real centerY: height / 2 + property real centerX: width / 2 + property real centerY: height / 2 - anchors.fill: parent + anchors.fill: parent - ShapePath { - strokeColor: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor - fillColor: closeRangeModeComponent.state === "notAtTarget" ? "white" : __style.lightGreenColor + ShapePath { + strokeColor: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor + fillColor: closeRangeModeComponent.state === "notAtTarget" ? "white" : __style.lightGreenColor - strokeWidth: 2 * __dp + strokeWidth: 2 * __dp - PathAngleArc { - id: innerArc + PathAngleArc { + id: innerArc - centerX: rootShape.centerX - centerY: rootShape.centerY + centerX: rootShape.centerX + centerY: rootShape.centerY - radiusX: outerArc.radiusX / 2 - radiusY: outerArc.radiusY / 2 + radiusX: outerArc.radiusX / 2 + radiusY: outerArc.radiusY / 2 - startAngle: 0 - sweepAngle: 360 - } + startAngle: 0 + sweepAngle: 360 } + } - ShapePath { - strokeColor: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor - fillColor: "transparent" + ShapePath { + strokeColor: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor + fillColor: "transparent" - strokeWidth: 2 * __dp + strokeWidth: 2 * __dp - PathAngleArc { - id: outerArc + PathAngleArc { + id: outerArc - property real outerRadius: rootShape.height / 2.5 + property real outerRadius: rootShape.height / 2.5 - centerX: rootShape.centerX - centerY: rootShape.centerY + centerX: rootShape.centerX + centerY: rootShape.centerY - radiusX: outerRadius * __dp - radiusY: outerRadius * __dp + radiusX: outerRadius * __dp + radiusY: outerRadius * __dp - startAngle: 0 - sweepAngle: 360 - } + startAngle: 0 + sweepAngle: 360 } } + } - // Target X icon - MMIcon { - source: __style.closeIcon - size: rootShape.height / 12 - color: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor - x: rootShape.centerX - width / 2 - y: rootShape.centerY - height / 2 - } - - // Position indicator with direction - Item { - id: positionIndicatorItem - - MM.PositionDirection { - id: positionDirection + // Target X icon + MMIcon { + source: __style.closeIcon + size: rootShape.height / 12 + color: closeRangeModeComponent.state === "notAtTarget" ? __style.greyColor : __style.lightGreenColor + x: rootShape.centerX - width / 2 + y: rootShape.centerY - height / 2 + } - positionKit: __positionKit - compass: MM.Compass { id: ccompass } - } + // Position indicator with direction + Item { + id: positionIndicatorItem - MM.MapPosition { - id: mapPositionSource + MM.PositionDirection { + id: positionDirection - mapSettings: root.mapCanvas.mapSettings - positionKit: __positionKit - onScreenPositionChanged: root.updatePosition() - } + positionKit: __positionKit + compass: MM.Compass { id: ccompass } + } - MMPositionMarker { - id: positionMarker + MMPositionMarker { + id: positionMarker - property real bearing: root.targetPair ? __inputUtils.angleBetweenGpsAndFeature( - __positionKit.positionCoordinate, - root.targetPair, - root.mapCanvas.mapSettings ) : 0 + property real bearing: root.targetPair ? __inputUtils.angleBetweenGpsAndFeature( + __positionKit.positionCoordinate, + root.targetPair, + root.mapCanvas.mapSettings ) : 0 - xPos: ( rootShape.centerX + ( Math.sin( -bearing ) * root.remainingDistance ) * outerArc.outerRadius / root.closeRangeModeDistanceThreshold * __dp ) - width / 2 - yPos: ( rootShape.centerY + ( Math.cos( -bearing ) * root.remainingDistance ) * outerArc.outerRadius / root.closeRangeModeDistanceThreshold * __dp ) - height + xPos: ( rootShape.centerX + ( Math.sin( -bearing ) * root.remainingDistance ) * outerArc.outerRadius / root.closeRangeModeDistanceThreshold * __dp ) - width / 2 + yPos: ( rootShape.centerY + ( Math.cos( -bearing ) * root.remainingDistance ) * outerArc.outerRadius / root.closeRangeModeDistanceThreshold * __dp ) - height - hasDirection: positionDirection.hasDirection + hasDirection: positionDirection.hasDirection - direction: positionDirection.direction - hasPosition: __positionKit.hasPosition + direction: positionDirection.direction + hasPosition: __positionKit.hasPosition - horizontalAccuracy: __positionKit.horizontalAccuracy - accuracyRingSize: mapPositionSource.screenAccuracy + horizontalAccuracy: __positionKit.horizontalAccuracy + accuracyRingSize: 0 // do not show any accuracy ring in stakeout mode - trackingMode: closeRangeModeComponent.state === "notAtTarget" + trackingMode: closeRangeModeComponent.state === "notAtTarget" - } } } } @@ -322,5 +246,3 @@ Drawer { } } } - -