Commit 07992bc4 authored by Nate Graham's avatar Nate Graham 🔩

[notifications] Fix margins of close button timeout indicator

The previous calculation multiplied the DPR by `units.smallSpacing`, which was not correct; we wanted DPR added to the existing margin, not multiplied by it.

Also using Math.floor is safer since Math.round sometimes rounds up (e.g. in case DPR is 2.501) which can cause undesirable effects.

BUG: 425911
parent 1917ebdb
......@@ -225,7 +225,7 @@ RowLayout {
Charts.PieChart {
id: chart
anchors.fill: parent
anchors.margins: Math.round(units.devicePixelRatio * units.smallSpacing)
anchors.margins: units.smallSpacing + Math.floor(units.devicePixelRatio)
opacity: (notificationHeading.remainingTime > 0 && notificationHeading.remainingTime < notificationHeading.timeout) ? 1 : 0
Behavior on opacity {
......@@ -237,7 +237,7 @@ RowLayout {
valueSources: Charts.SingleValueSource { value: notificationHeading.remainingTime }
colorSource: Charts.SingleValueSource { value: theme.highlightColor }
thickness: Math.round(units.devicePixelRatio) * 5
thickness: Math.floor(units.devicePixelRatio) * 5
  • On the machine I am currently using devicePixelRatio is 0.9something and this evaluates to 0 :(

  • :/

    How is that possible? What are your resolution, scale factor, and font DPI set to?

  • 1920x1080, no scale, fonts are default Screenshot_2020-10-26_14_42_15

    Edited by David Redondo
  • That seems like a bizarre bug in how PlasmaCore.Units computes devicePixelRatio. It should be 1.0 in your case.

Please register or sign in to reply
transform: Scale { origin.x: chart.width / 2; xScale: -1 }
}
......
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