UI: Center preview spacing lines

Currently, the spacing lines begin in the middle of the box and then are
their width wide towards one direction. This means that the larger they
are, the more off-center their middle is.
This commit changes them to start at half their width left/top of the
center and end half the width to the right/bottom of the center, putting
the middle in the center.
This commit is contained in:
gxalpha
2024-05-05 20:42:47 +02:00
committed by Ryan Foster
parent 67e4853b7d
commit 41650479fe

View File

@@ -1758,13 +1758,16 @@ static void DrawLine(float x1, float y1, float x2, float y2, float thickness,
gs_render_start(true);
gs_vertex2f(x1, y1);
gs_vertex2f(x1 + (xSide * (thickness / scale.x)),
y1 + (ySide * (thickness / scale.y)));
gs_vertex2f(x2 + (xSide * (thickness / scale.x)),
y2 + (ySide * (thickness / scale.y)));
gs_vertex2f(x2, y2);
gs_vertex2f(x1, y1);
gs_vertex2f(x1 - (xSide * (thickness / scale.x) / 2),
y1 + (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x1 + (xSide * (thickness / scale.x) / 2),
y1 - (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x2 + (xSide * (thickness / scale.x) / 2),
y2 + (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x2 - (xSide * (thickness / scale.x) / 2),
y2 - (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x1 - (xSide * (thickness / scale.x) / 2),
y1 + (ySide * (thickness / scale.y) / 2));
gs_vertbuffer_t *line = gs_render_save();