mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Tray: use getPillDirection logic to place chevron to the correct position based on bar section
This commit is contained in:
@@ -198,6 +198,36 @@ Rectangle {
|
||||
spacing: Style.marginXS
|
||||
flow: isVertical ? Flow.TopToBottom : Flow.LeftToRight
|
||||
|
||||
// Drawer opener (before items if opposite direction)
|
||||
NIconButton {
|
||||
id: chevronIconBefore
|
||||
visible: root.drawerEnabled && dropdownItems.length > 0 && BarService.getPillDirection(root)
|
||||
tooltipText: I18n.tr("tooltips.open-tray-dropdown")
|
||||
tooltipDirection: BarService.getTooltipDirection()
|
||||
density: Settings.data.bar.density
|
||||
baseSize: Style.capsuleHeight
|
||||
applyUiScale: false
|
||||
colorBg: Settings.data.colorSchemes.darkMode ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary
|
||||
colorFg: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mOnPrimary
|
||||
colorBorder: Color.transparent
|
||||
colorBorderHover: Color.transparent
|
||||
icon: {
|
||||
switch (barPosition) {
|
||||
case "bottom":
|
||||
return "caret-up"
|
||||
case "left":
|
||||
return "caret-right"
|
||||
case "right":
|
||||
return "caret-left"
|
||||
case "top":
|
||||
default:
|
||||
return "caret-down"
|
||||
}
|
||||
}
|
||||
onClicked: toggleDrawer(this)
|
||||
onRightClicked: toggleDrawer(this)
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: root.filteredItems
|
||||
@@ -311,10 +341,10 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Drawer opener
|
||||
// Drawer opener (after items if normal direction)
|
||||
NIconButton {
|
||||
id: chevronIcon
|
||||
visible: root.drawerEnabled && dropdownItems.length > 0
|
||||
id: chevronIconAfter
|
||||
visible: root.drawerEnabled && dropdownItems.length > 0 && !BarService.getPillDirection(root)
|
||||
tooltipText: I18n.tr("tooltips.open-tray-dropdown")
|
||||
tooltipDirection: BarService.getTooltipDirection()
|
||||
density: Settings.data.bar.density
|
||||
@@ -337,12 +367,8 @@ Rectangle {
|
||||
return "caret-down"
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
toggleDrawer(this)
|
||||
}
|
||||
onRightClicked: {
|
||||
toggleDrawer(this)
|
||||
}
|
||||
onClicked: toggleDrawer(this)
|
||||
onRightClicked: toggleDrawer(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user