Commit ebfc2b53 authored by Bhushan Shah's avatar Bhushan Shah 📱
Browse files

[notifications] Fix notifications placement when aligned in center

When calculating the popup location for center alignment, we added the
popupEdgeDistance to it, which resulted in the notifications offset by
units.largeSpacing*2 to right.

It does not make sense to add popupEdgeDistance when notification is
aligned in horizontal center.
parent ecb99196
...@@ -345,12 +345,10 @@ QtObject { ...@@ -345,12 +345,10 @@ QtObject {
const rightMostX = screenRect.x + screenRect.width - popupEdgeDistance - popupEffectiveWidth; const rightMostX = screenRect.x + screenRect.width - popupEdgeDistance - popupEffectiveWidth;
// If available screen rect is narrower than the popup, center it in the available rect // If available screen rect is narrower than the popup, center it in the available rect
if (screenRect.width < popupEffectiveWidth) { if (screenRect.width < popupEffectiveWidth || effectivePopupLocation & Qt.AlignHCenter) {
popup.x = screenRect.x + (screenRect.width - popupEffectiveWidth) / 2 popup.x = screenRect.x + (screenRect.width - popupEffectiveWidth) / 2
} else if (effectivePopupLocation & Qt.AlignLeft) { } else if (effectivePopupLocation & Qt.AlignLeft) {
popup.x = leftMostX; popup.x = leftMostX;
} else if (effectivePopupLocation & Qt.AlignHCenter) {
popup.x = screenRect.x + popupEdgeDistance + (screenRect.width - popupEffectiveWidth) / 2;
} else if (effectivePopupLocation & Qt.AlignRight) { } else if (effectivePopupLocation & Qt.AlignRight) {
popup.x = rightMostX; popup.x = rightMostX;
} }
......
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