mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(ui): adapt icon position labels based on bar orientation
- Add barIsVertical property to BarWidgetSettingsDialog - Pass barIsVertical from NSectionEditor to dialog - Show Top/Bottom for vertical bar, Left/Right for horizontal bar - Keep fallback to oppositeDirection when iconPosition not set - Fix BarPillVertical iconPosition mapping (left=top, right=bottom)
This commit is contained in:
@@ -50,8 +50,9 @@ Item {
|
||||
readonly property int maxPillHeight: rotateText ? Math.max(1, Math.round(textItem.implicitWidth + Style.margin2M + Math.round(iconCircle.height / 4))) : Math.max(1, Math.round(textItem.implicitHeight + Style.margin2M))
|
||||
|
||||
// Determine pill direction based on icon position (fallback to oppositeDirection if not set)
|
||||
readonly property bool openDownward: iconPosition === "right" || (iconPosition === "" && oppositeDirection)
|
||||
readonly property bool openUpward: iconPosition === "left" || (iconPosition === "" && !oppositeDirection)
|
||||
// For vertical bar: iconPosition="left" (top) means icon at top, text expands downward
|
||||
readonly property bool openDownward: (iconPosition === "left" || iconPosition === "right") ? (iconPosition === "left") : oppositeDirection
|
||||
readonly property bool openUpward: (iconPosition === "left" || iconPosition === "right") ? (iconPosition === "right") : !oppositeDirection
|
||||
|
||||
// Effective shown state (true if animated open or forced, but not if force closed)
|
||||
readonly property bool revealed: !forceClose && (forceOpen || showPill)
|
||||
|
||||
@@ -15,6 +15,7 @@ Popup {
|
||||
property string widgetId: ""
|
||||
property string sectionId: ""
|
||||
property var screen: null
|
||||
property bool barIsVertical: false
|
||||
property var settingsCache: ({})
|
||||
|
||||
readonly property real maxHeight: (screen ? screen.height : (parent ? parent.height : 800)) * 0.8
|
||||
@@ -185,6 +186,7 @@ Popup {
|
||||
}
|
||||
settingsLoader.setSource(source, {
|
||||
"screen": screen,
|
||||
"barIsVertical": barIsVertical,
|
||||
"widgetData": currentWidgetData,
|
||||
"widgetMetadata": BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
});
|
||||
|
||||
@@ -17,6 +17,9 @@ ColumnLayout {
|
||||
|
||||
signal settingsChanged(var settings)
|
||||
|
||||
// Bar orientation (per-screen) - passed from parent
|
||||
property bool barIsVertical: false
|
||||
|
||||
property string valueIcon: widgetData.icon !== undefined ? widgetData.icon : widgetMetadata.icon
|
||||
property string valueIconPosition: widgetData.iconPosition !== undefined ? widgetData.iconPosition : widgetMetadata.iconPosition
|
||||
property bool valueTextStream: widgetData.textStream !== undefined ? widgetData.textStream : widgetMetadata.textStream
|
||||
@@ -101,9 +104,19 @@ ColumnLayout {
|
||||
|
||||
NComboBox {
|
||||
id: iconPositionComboBox
|
||||
visible: valueShowIcon
|
||||
label: I18n.tr("bar.custom-button.icon-position-label")
|
||||
description: I18n.tr("bar.custom-button.icon-position-description")
|
||||
model: [
|
||||
model: barIsVertical ? [
|
||||
{
|
||||
name: I18n.tr("bar.custom-button.icon-position-top"),
|
||||
key: "left"
|
||||
},
|
||||
{
|
||||
name: I18n.tr("bar.custom-button.icon-position-bottom"),
|
||||
key: "right"
|
||||
}
|
||||
] : [
|
||||
{
|
||||
name: I18n.tr("bar.custom-button.icon-position-left"),
|
||||
key: "left"
|
||||
|
||||
Reference in New Issue
Block a user