Rename some HDrawer props for more clarity

This commit is contained in:
miruka 2019-12-10 14:19:25 -04:00
parent 29cf78fe18
commit 0578844eef
4 changed files with 14 additions and 14 deletions

View File

@ -30,25 +30,25 @@ Drawer {
property Item referenceSizeParent: parent property Item referenceSizeParent: parent
property int normalSize: property int preferredSize:
horizontal ? referenceSizeParent.width : referenceSizeParent.height horizontal ? referenceSizeParent.width : referenceSizeParent.height
property int minNormalSize: resizeAreaSize property int minimumSize: resizeAreaSize
property int maxNormalSize: property int maximumSize:
horizontal ? horizontal ?
referenceSizeParent.width - theme.minimumSupportedWidth : referenceSizeParent.width - theme.minimumSupportedWidth :
referenceSizeParent.height - theme.minimumSupportedHeight referenceSizeParent.height - theme.minimumSupportedHeight
property bool collapse: property bool collapse:
(horizontal ? window.width : window.height) < 400 (horizontal ? window.width : window.height) < 400
property int collapseExpandSize: property int peekSizeWhileCollapsed:
horizontal ? referenceSizeParent.width : referenceSizeParent.height horizontal ? referenceSizeParent.width : referenceSizeParent.height
property int resizeAreaSize: theme.spacing / 2 property int resizeAreaSize: theme.spacing / 2
readonly property int calculatedSize: readonly property int calculatedSize:
collapse ? collapse ?
collapseExpandSize : peekSizeWhileCollapsed :
Math.max(minNormalSize, Math.min(normalSize, maxNormalSize)) Math.max(minimumSize, Math.min(preferredSize, maximumSize))
readonly property int visibleSize: visible ? width * position : 0 readonly property int visibleSize: visible ? width * position : 0
@ -88,18 +88,18 @@ Drawer {
Qt.ArrowCursor Qt.ArrowCursor
onPressed: canResize = true onPressed: canResize = true
onReleased: { canResize = false; userResized(drawer.normalSize) } onReleased: {canResize = false; userResized(drawer.preferredSize)}
onMouseXChanged: onMouseXChanged:
if (horizontal && canResize) { if (horizontal && canResize) {
drawer.normalSize = drawer.preferredSize =
drawer.calculatedSize + drawer.calculatedSize +
(drawer.edge === Qt.RightEdge ? -mouseX : mouseX) (drawer.edge === Qt.RightEdge ? -mouseX : mouseX)
} }
onMouseYChanged: onMouseYChanged:
if (vertical && canResize) { if (vertical && canResize) {
drawer.normalSize = drawer.preferredSize =
drawer.calculatedSize + drawer.calculatedSize +
(drawer.edge === Qt.BottomEdge ? -mouseY : mouseY) (drawer.edge === Qt.BottomEdge ? -mouseY : mouseY)
} }

View File

@ -5,8 +5,8 @@ import "../../Base"
HDrawer { HDrawer {
id: roomSidePane id: roomSidePane
edge: Qt.RightEdge edge: Qt.RightEdge
normalSize: buttonRepeater.childrenImplicitWidth preferredSize: buttonRepeater.childrenImplicitWidth
minNormalSize: minimumSize:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0 buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
background: HColumnLayout{ background: HColumnLayout{

View File

@ -12,7 +12,7 @@ HDrawer {
y: vertical ? 0 : referenceSizeParent.height / 2 - height / 2 y: vertical ? 0 : referenceSizeParent.height / 2 - height / 2
width: horizontal ? calculatedSize : Math.min(window.width, 720) width: horizontal ? calculatedSize : Math.min(window.width, 720)
height: vertical ? calculatedSize : Math.min(window.height, 720) height: vertical ? calculatedSize : Math.min(window.height, 720)
normalSize: 400 preferredSize: 400
z: 9999 z: 9999
position: 0 position: 0

View File

@ -6,8 +6,8 @@ import "../utils.js" as Utils
HDrawer { HDrawer {
id: sidePane id: sidePane
color: theme.sidePane.background color: theme.sidePane.background
normalSize: window.uiState.sidePaneManualWidth || 300 preferredSize: window.uiState.sidePaneManualWidth || 300
minNormalSize: theme.controls.avatar.size + theme.spacing * 2 minimumSize: theme.controls.avatar.size + theme.spacing * 2
onUserResized: { onUserResized: {
window.uiState.sidePaneManualWidth = newWidth window.uiState.sidePaneManualWidth = newWidth