[theme] Fix horizontal separator alignment

This commit is contained in:
David Capello 2025-04-02 09:32:34 -03:00
parent 537ccd393f
commit 7167969963
3 changed files with 25 additions and 18 deletions

View File

@ -709,7 +709,7 @@
<style id="workspace_splitter"> <style id="workspace_splitter">
<background color="workspace" /> <background color="workspace" />
</style> </style>
<style id="horizontal_separator" border-left="2" border-top="4" border-right="2" border-bottom="0"> <style id="horizontal_separator" border="2">
<background color="window_face" /> <background color="window_face" />
<background-border part="separator_horz" align="middle" /> <background-border part="separator_horz" align="middle" />
<text color="separator_label" x="4" align="left middle" /> <text color="separator_label" x="4" align="left middle" />

View File

@ -702,7 +702,7 @@
<style id="workspace_splitter"> <style id="workspace_splitter">
<background color="workspace" /> <background color="workspace" />
</style> </style>
<style id="horizontal_separator" border-left="2" border-top="4" border-right="2" border-bottom="0"> <style id="horizontal_separator" border="2">
<background color="window_face" /> <background color="window_face" />
<background-border part="separator_horz" align="middle" /> <background-border part="separator_horz" align="middle" />
<text color="separator_label" x="4" align="left middle" /> <text color="separator_label" x="4" align="left middle" />

View File

@ -413,38 +413,45 @@ void Theme::paintLayer(Graphics* g,
switch (layer.align()) { switch (layer.align()) {
// Horizontal line // Horizontal line
case MIDDLE: case MIDDLE: {
const float y = guiscaled_center(rc.y, rc.h, layer.spriteBounds().h);
for (int x = rc.x; x < rc.x2(); x += layer.spriteBounds().w) { for (int x = rc.x; x < rc.x2(); x += layer.spriteBounds().w) {
draw(layer.spriteBounds().x, draw(layer.spriteBounds().x,
layer.spriteBounds().y, layer.spriteBounds().y,
x, x,
rc.y + rc.h / 2 - layer.spriteBounds().h / 2,
layer.spriteBounds().w,
layer.spriteBounds().h);
}
break;
// Vertical line
case CENTER:
for (int y = rc.y; y < rc.y2(); y += layer.spriteBounds().h) {
draw(layer.spriteBounds().x,
layer.spriteBounds().y,
rc.x + rc.w / 2 - layer.spriteBounds().w / 2,
y, y,
layer.spriteBounds().w, layer.spriteBounds().w,
layer.spriteBounds().h); layer.spriteBounds().h);
} }
break; break;
}
// One instance // Vertical line
case CENTER | MIDDLE: case CENTER: {
const float x = guiscaled_center(rc.x, rc.w, layer.spriteBounds().w);
for (int y = rc.y; y < rc.y2(); y += layer.spriteBounds().h) {
draw(layer.spriteBounds().x, draw(layer.spriteBounds().x,
layer.spriteBounds().y, layer.spriteBounds().y,
rc.x + rc.w / 2 - layer.spriteBounds().w / 2, x,
rc.y + rc.h / 2 - layer.spriteBounds().h / 2, y,
layer.spriteBounds().w,
layer.spriteBounds().h);
}
break;
}
// One instance
case CENTER | MIDDLE: {
const float x = guiscaled_center(rc.x, rc.w, layer.spriteBounds().w);
const float y = guiscaled_center(rc.y, rc.h, layer.spriteBounds().h);
draw(layer.spriteBounds().x,
layer.spriteBounds().y,
x,
y,
layer.spriteBounds().w, layer.spriteBounds().w,
layer.spriteBounds().h); layer.spriteBounds().h);
break; break;
}
// Pattern // Pattern
case 0: case 0: