Rename HDrawer "width" props, add horizontal prop
This commit is contained in:
parent
99034c7587
commit
a5e01fd3b9
@ -4,10 +4,10 @@ import "../utils.js" as Utils
|
|||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
id: drawer
|
id: drawer
|
||||||
x: vertical ? referenceSizeParent.width / 2 - width / 2 : 0
|
x: horizontal ? 0 : referenceSizeParent.width / 2 - width / 2
|
||||||
y: vertical ? 0 : referenceSizeParent.height / 2 - height / 2
|
y: vertical ? 0 : referenceSizeParent.height / 2 - height / 2
|
||||||
implicitWidth: vertical ? referenceSizeParent.width : calculatedWidth
|
implicitWidth: horizontal ? calculatedSize : referenceSizeParent.width
|
||||||
implicitHeight: vertical ? calculatedWidth : referenceSizeParent.height
|
implicitHeight: vertical ? calculatedSize : referenceSizeParent.height
|
||||||
|
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
@ -32,28 +32,30 @@ Drawer {
|
|||||||
|
|
||||||
property Item referenceSizeParent: parent
|
property Item referenceSizeParent: parent
|
||||||
|
|
||||||
property int normalWidth:
|
property int normalSize:
|
||||||
vertical ? referenceSizeParent.height : referenceSizeParent.width
|
horizontal ? referenceSizeParent.width : referenceSizeParent.height
|
||||||
property int minNormalWidth: resizeAreaWidth
|
property int minNormalSize: resizeAreaSize
|
||||||
property int maxNormalWidth:
|
property int maxNormalSize:
|
||||||
vertical ?
|
horizontal ?
|
||||||
referenceSizeParent.height - theme.minimumSupportedHeight :
|
referenceSizeParent.width - theme.minimumSupportedWidth :
|
||||||
referenceSizeParent.width - theme.minimumSupportedWidth
|
referenceSizeParent.height - theme.minimumSupportedHeight
|
||||||
|
|
||||||
property bool collapse:
|
property bool collapse:
|
||||||
(vertical ? window.height : window.width) < 400
|
(horizontal ? window.width : window.height) < 400
|
||||||
property int collapseExpandedWidth:
|
property int collapseExpandSize:
|
||||||
vertical ? referenceSizeParent.height : referenceSizeParent.width
|
horizontal ? referenceSizeParent.width : referenceSizeParent.height
|
||||||
|
|
||||||
property int resizeAreaWidth: theme.spacing / 2
|
property int resizeAreaSize: theme.spacing / 2
|
||||||
|
|
||||||
readonly property int calculatedWidth:
|
readonly property int calculatedSize:
|
||||||
collapse ?
|
collapse ?
|
||||||
collapseExpandedWidth :
|
collapseExpandSize :
|
||||||
Math.max(minNormalWidth, Math.min(normalWidth, maxNormalWidth))
|
Math.max(minNormalSize, Math.min(normalSize, maxNormalSize))
|
||||||
|
|
||||||
readonly property bool vertical:
|
readonly property bool horizontal:
|
||||||
edge === Qt.TopEdge || edge === Qt.BottomEdge
|
edge === Qt.LeftEdge || edge === Qt.RightEdge
|
||||||
|
|
||||||
|
readonly property bool vertical: ! horizontal
|
||||||
|
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
@ -69,9 +71,9 @@ Drawer {
|
|||||||
Item {
|
Item {
|
||||||
id: resizeArea
|
id: resizeArea
|
||||||
x: vertical || drawer.edge === Qt.RightEdge ? 0 : drawer.width-width
|
x: vertical || drawer.edge === Qt.RightEdge ? 0 : drawer.width-width
|
||||||
y: ! vertical || drawer.edge !== Qt.TopEdge ? 0 : drawer.height-height
|
y: horizontal || drawer.edge !== Qt.TopEdge ? 0 : drawer.height-height
|
||||||
width: vertical ? parent.width : resizeAreaWidth
|
width: horizontal ? resizeAreaSize : parent.width
|
||||||
height: vertical ? resizeAreaWidth : parent.height
|
height: vertical ? resizeAreaSize : parent.height
|
||||||
z: 999
|
z: 999
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@ -82,23 +84,23 @@ Drawer {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape:
|
cursorShape:
|
||||||
containsMouse || drag.active ?
|
containsMouse || drag.active ?
|
||||||
(vertical ? Qt.SizeVerCursor : Qt.SizeHorCursor) :
|
(horizontal ? Qt.SizeHorCursor : Qt.SizeVerCursor) :
|
||||||
Qt.ArrowCursor
|
Qt.ArrowCursor
|
||||||
|
|
||||||
onPressed: canResize = true
|
onPressed: canResize = true
|
||||||
onReleased: { canResize = false; userResized(drawer.normalWidth) }
|
onReleased: { canResize = false; userResized(drawer.normalSize) }
|
||||||
|
|
||||||
onMouseXChanged:
|
onMouseXChanged:
|
||||||
if (! vertical && canResize) {
|
if (horizontal && canResize) {
|
||||||
drawer.normalWidth =
|
drawer.normalSize =
|
||||||
drawer.calculatedWidth +
|
drawer.calculatedSize +
|
||||||
(drawer.edge === Qt.RightEdge ? -mouseX : mouseX)
|
(drawer.edge === Qt.RightEdge ? -mouseX : mouseX)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseYChanged:
|
onMouseYChanged:
|
||||||
if (vertical && canResize) {
|
if (vertical && canResize) {
|
||||||
drawer.normalWidth =
|
drawer.normalSize =
|
||||||
drawer.calculatedWidth +
|
drawer.calculatedSize +
|
||||||
(drawer.edge === Qt.BottomEdge ? -mouseY : mouseY)
|
(drawer.edge === Qt.BottomEdge ? -mouseY : mouseY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ HDrawer {
|
|||||||
id: roomSidePane
|
id: roomSidePane
|
||||||
color: theme.chat.roomSidePane.background
|
color: theme.chat.roomSidePane.background
|
||||||
edge: Qt.RightEdge
|
edge: Qt.RightEdge
|
||||||
normalWidth: buttonRepeater.childrenImplicitWidth
|
normalSize: buttonRepeater.childrenImplicitWidth
|
||||||
minNormalWidth:
|
minNormalSize:
|
||||||
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
|
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
|
||||||
|
|
||||||
HColumnLayout {
|
HColumnLayout {
|
||||||
|
@ -7,9 +7,9 @@ import "utils.js" as Utils
|
|||||||
HDrawer {
|
HDrawer {
|
||||||
id: debugConsole
|
id: debugConsole
|
||||||
edge: Qt.BottomEdge
|
edge: Qt.BottomEdge
|
||||||
width: vertical ? Math.min(window.width, 720) : calculatedWidth
|
width: horizontal ? calculatedSize : Math.min(window.width, 720)
|
||||||
height: vertical ? calculatedWidth : Math.min(window.width, 480)
|
height: vertical ? calculatedSize : Math.min(window.width, 480)
|
||||||
normalWidth: 360
|
normalSize: 360
|
||||||
z: 9999
|
z: 9999
|
||||||
|
|
||||||
property var target: null
|
property var target: null
|
||||||
|
@ -7,8 +7,8 @@ HDrawer {
|
|||||||
id: sidePane
|
id: sidePane
|
||||||
opacity: mainUI.accountsPresent ? 1 : 0
|
opacity: mainUI.accountsPresent ? 1 : 0
|
||||||
color: theme.sidePane.background
|
color: theme.sidePane.background
|
||||||
normalWidth: window.uiState.sidePaneManualWidth
|
normalSize: window.uiState.sidePaneManualWidth
|
||||||
minNormalWidth: theme.controls.avatar.size + theme.spacing * 2
|
minNormalSize: theme.controls.avatar.size + theme.spacing * 2
|
||||||
|
|
||||||
onUserResized: {
|
onUserResized: {
|
||||||
window.uiState.sidePaneManualWidth = newWidth
|
window.uiState.sidePaneManualWidth = newWidth
|
||||||
|
Loading…
x
Reference in New Issue
Block a user