Skip to content

Commit

Permalink
last adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Sep 4, 2024
1 parent 668fe9b commit cf28ed6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 45 deletions.
12 changes: 0 additions & 12 deletions app/qml/components/MMDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ Drawer {
readonly property real drawerReservedVerticalSpace: topSpacer.height + mmDrawerHeader.height + contentSpacer.height + bottomSpacer.height
readonly property real drawerContentAvailableHeight: maxHeight - drawerReservedVerticalSpace // max height for your custom content item

property string leftButtonIcon: ""
property string leftButtonText: ""
property string leftButtonType: MMButton.Types.Primary
property bool leftButtonEnabled: true
signal leftButtonClicked

implicitHeight: contentHeight > maxHeight ? maxHeight : contentHeight
implicitWidth: ApplicationWindow.window?.width ?? 0

Expand Down Expand Up @@ -80,12 +74,6 @@ Drawer {

width: parent.width

leftButtonIcon: root.leftButtonIcon
leftButtonText: root.leftButtonText
leftButtonType: root.leftButtonType
leftButtonEnabled: root.leftButtonEnabled
onLeftButtonClicked: root.leftButtonClicked()

onCloseClicked: {
root.close()
}
Expand Down
29 changes: 5 additions & 24 deletions app/qml/components/MMDrawerHeader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ Rectangle {

property bool hasCloseButton: true

property string leftButtonIcon: ""
property string leftButtonText: ""
property string leftButtonType: MMButton.Types.Primary
property bool leftButtonEnabled: true

property alias closeButton: closeBtn
property alias leftButton: leftBtn
property alias topLeftItemContent: topLeftButtonGroup.children

color: __style.transparentColor

Expand All @@ -39,25 +34,11 @@ Rectangle {
implicitHeight: 60 * __dp
implicitWidth: ApplicationWindow.window?.width ?? 0

MMButton {
id: leftBtn

type: root.leftButtonType
text: root.leftButtonText
iconSourceLeft: root.leftButtonIcon
bgndColor: __style.lightGreenColor
size: MMButton.Sizes.Small
visible: root.leftButtonIcon

enabled: root.leftButtonEnabled

anchors {
left: parent.left
leftMargin: __style.pageMargins + __style.safeAreaLeft
verticalCenter: parent.verticalCenter
}
Item {
id: topLeftButtonGroup

onClicked: root.leftButtonClicked()
width: childrenRect.width
height: parent.height
}

Text {
Expand Down
27 changes: 18 additions & 9 deletions app/qml/gps/MMMeasureDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,41 @@ MMDrawer {
Component.onCompleted: root.open()

modal: false

//not interactive
interactive: false
closePolicy: Popup.CloseOnEscape

dropShadow: true

onClosed: root.measureFinished()

leftButtonText: closeShapeDone ? qsTr( "Repeat" ) : qsTr( "Undo" )
leftButtonIcon: closeShapeDone ? __style.syncIcon : __style.undoIcon
leftButtonType: MMButton.Types.Primary
leftButtonEnabled: closeShapeDone || canUndo
onLeftButtonClicked: closeShapeDone ? root.mapCanvas.mapToolComponent.repeatMeasure() : root.mapCanvas.mapToolComponent.mapTool.removePoint()

Behavior on implicitHeight {
PropertyAnimation { properties: "implicitHeight"; easing.type: Easing.InOutQuad }
}

drawerHeader.title: qsTr( "Measurement" )

drawerHeader.topLeftItemContent: MMButton {
type: MMButton.Types.Primary
text: closeShapeDone ? qsTr( "Repeat" ) : qsTr( "Undo" )
iconSourceLeft: closeShapeDone ? __style.syncIcon : __style.undoIcon
bgndColor: __style.lightGreenColor
size: MMButton.Sizes.Small
enabled: closeShapeDone || canUndo

anchors {
left: parent.left
leftMargin: __style.pageMargins + __style.safeAreaLeft
verticalCenter: parent.verticalCenter
}

onClicked: closeShapeDone ? root.mapCanvas.mapToolComponent.repeatMeasure() : root.mapCanvas.mapToolComponent.mapTool.removePoint()
}

drawerContent: Column {
id: mainColumn

width: parent.width
spacing: __style.margin40
spacing: __style.margin10

Row {
width: parent.width
Expand Down

0 comments on commit cf28ed6

Please sign in to comment.