Commit 664865f1 authored by Eike Hein's avatar Eike Hein

Fix Kickoff compact repr size hints in panel

Summary:
The old code was copy-pasted from Kicker but the wrong code block;
it was the code path for custom button image mode, not the regular
code path.

BUG:395594

Reviewers: broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D14285
parent 6d4f1bc2
......@@ -49,36 +49,58 @@ Item {
Plasmoid.compactRepresentation: MouseArea {
id: compactRoot
Layout.maximumWidth: inPanel ? units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? units.iconSizeHints.panel : -1
hoverEnabled: true
onClicked: plasmoid.expanded = !plasmoid.expanded
Layout.minimumWidth: {
if (!inPanel) {
return units.iconSizeHints.panel;
}
if (vertical) {
return -1;
} else {
return Math.min(units.iconSizeHints.panel, parent.height) * buttonIcon.aspectRatio;
}
}
Layout.minimumHeight: {
if (!inPanel) {
return units.iconSizeHints.panel;
}
if (vertical) {
return Math.min(units.iconSizeHints.panel, parent.width) * buttonIcon.aspectRatio;
} else {
return -1;
}
}
onWidthChanged: updateSizeHints()
onHeightChanged: updateSizeHints()
Layout.maximumWidth: {
if (!inPanel) {
return -1;
}
function updateSizeHints() {
if (kickoff.vertical) {
var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth));
compactRoot.Layout.minimumHeight = scaledHeight;
compactRoot.Layout.maximumHeight = scaledHeight;
compactRoot.Layout.minimumWidth = units.iconSizes.small;
compactRoot.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1;
if (vertical) {
return units.iconSizeHints.panel;
} else {
var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight));
compactRoot.Layout.minimumWidth = scaledWidth;
compactRoot.Layout.maximumWidth = scaledWidth;
compactRoot.Layout.minimumHeight = units.iconSizes.small;
compactRoot.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1;
return Math.min(units.iconSizeHints.panel, parent.height) * buttonIcon.aspectRatio;
}
}
Connections {
target: units.iconSizeHints
Layout.maximumHeight: {
if (!inPanel) {
return -1;
}
onPanelChanged: compactRoot.updateSizeHints()
if (vertical) {
return Math.min(units.iconSizeHints.panel, parent.width) * buttonIcon.aspectRatio;
} else {
return units.iconSizeHints.panel;
}
}
hoverEnabled: true
onClicked: plasmoid.expanded = !plasmoid.expanded
DropArea {
id: compactDragArea
anchors.fill: parent
......@@ -102,8 +124,6 @@ Item {
active: parent.containsMouse || compactDragArea.containsDrag
smooth: true
roundToIconSize: aspectRatio === 1
onSourceChanged: updateSizeHints()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment