1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-12 00:58:18 +03:00

improve positioning for primary/secconfigviews

This commit is contained in:
Michail Vourlakos 2020-07-10 20:27:10 +03:00
parent 8fabeb83ed
commit b22a184337
2 changed files with 12 additions and 10 deletions

View File

@ -267,8 +267,9 @@ void PrimaryConfigView::syncGeometry()
const auto location = m_latteView->containment()->location();
const auto scrGeometry = m_latteView->screenGeometry();
const auto availGeometry = m_availableScreenGeometry;
const auto canvasGeometry = m_latteView->positioner()->canvasGeometry();
int clearThickness = m_latteView->editThickness();
int canvasThickness = m_latteView->formFactor() == Plasma::Types::Vertical ? canvasGeometry.width() : canvasGeometry.height();
QPoint position{0, 0};
@ -288,19 +289,19 @@ void PrimaryConfigView::syncGeometry()
}
if (location == Plasma::Types::TopEdge) {
yPos = scrGeometry.y() + clearThickness;
yPos = scrGeometry.y() + canvasThickness;
} else if (location == Plasma::Types::BottomEdge) {
yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height();
yPos = scrGeometry.y() + scrGeometry.height() - canvasThickness - size.height();
}
}
break;
case Plasma::Types::Vertical: {
if (location == Plasma::Types::LeftEdge) {
xPos = scrGeometry.x() + clearThickness;
xPos = scrGeometry.x() + canvasThickness;
yPos = availGeometry.y() + (availGeometry.height() - size.height())/2;
} else if (location == Plasma::Types::RightEdge) {
xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width();
xPos = scrGeometry.x() + scrGeometry.width() - canvasThickness - size.width();
yPos = availGeometry.y() + (availGeometry.height() - size.height())/2;
}
}

View File

@ -111,8 +111,9 @@ void SecondaryConfigView::syncGeometry()
const auto location = m_latteView->containment()->location();
const auto scrGeometry = m_latteView->screenGeometry();
const auto availGeometry = m_parent->availableScreenGeometry();
const auto canvasGeometry = m_latteView->positioner()->canvasGeometry();
int clearThickness = m_latteView->editThickness();
int canvasThickness = m_latteView->formFactor() == Plasma::Types::Vertical ? canvasGeometry.width() : canvasGeometry.height();
int secondaryConfigSpacing = 2 * m_latteView->fontPixelSize();
@ -130,9 +131,9 @@ void SecondaryConfigView::syncGeometry()
}
if (location == Plasma::Types::TopEdge) {
yPos = scrGeometry.y() + clearThickness;
yPos = scrGeometry.y() + canvasThickness;
} else if (location == Plasma::Types::BottomEdge) {
yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height();
yPos = scrGeometry.y() + scrGeometry.height() - canvasThickness - size.height();
}
}
break;
@ -141,9 +142,9 @@ void SecondaryConfigView::syncGeometry()
yPos = availGeometry.y() + secondaryConfigSpacing;
if (location == Plasma::Types::LeftEdge) {
xPos = scrGeometry.x() + clearThickness;
xPos = scrGeometry.x() + canvasThickness;
} else if (location == Plasma::Types::RightEdge) {
xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width();
xPos = scrGeometry.x() + scrGeometry.width() - canvasThickness - size.width();
}
}
break;