applets/mediacontroller: Fix incorrect scale factor of backgroundImage

The scale factor was incorrect because it always compared with 1, which
caused the background image not being resized properly when height >
width.

This commit uses the same scale factor in ToolTipInstance.qml, so the
scale factor is correct again.
wilder-5.24
Fushan Wen 4 years ago committed by Nate Graham
parent 4e34ba26e6
commit 38338042c0
  1. 6
      applets/mediacontroller/contents/ui/ExpandedRepresentation.qml

@ -124,6 +124,7 @@ PlasmaExtras.Representation {
ShaderEffect {
id: backgroundImage
property real scaleFactor: 1.0
property Image source: albumArt
anchors.centerIn: parent
@ -153,8 +154,9 @@ PlasmaExtras.Representation {
when: plasmoid.expanded && backgroundImage.visible && albumArt.paintedWidth > 0
PropertyChanges {
target: backgroundImage
width: parent.width * Math.max(1, source.paintedWidth / source.paintedHeight)
height: parent.width * Math.max(1, source.paintedHeight / source.paintedWidth)
scaleFactor: Math.max(parent.width / source.paintedWidth, parent.height / source.paintedHeight)
width: Math.round(source.paintedWidth * scaleFactor)
height: Math.round(source.paintedHeight * scaleFactor)
}
}
}

Loading…
Cancel
Save