summaryrefslogtreecommitdiff
path: root/gl.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-25 18:27:07 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-25 18:27:07 -0500
commit2baf965c7db4a3640cd120e050c61aa7de67448b (patch)
tree4ea6d87d6157b3d25eba24aa8805a10219c44a2f /gl.c
parent3ff107c7ca438749a8425feef9eefb67c7a8abfc (diff)
node resizing working
Diffstat (limited to 'gl.c')
-rw-r--r--gl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gl.c b/gl.c
index 9a35a1f..a30eb59 100644
--- a/gl.c
+++ b/gl.c
@@ -212,6 +212,10 @@ static void gl_geometry_rect(Rect r, u32 color_rgba) {
static void gl_geometry_rect_border(Rect r, float border_thickness, u32 color) {
float border_radius = border_thickness * 0.5f;
float x1 = r.pos.x, y1 = r.pos.y, x2 = x1 + r.size.x, y2 = y1 + r.size.y;
+
+ // make sure rectangle isn't too small
+ x2 = maxf(x2, x1 + 2 * border_radius);
+ y2 = maxf(y2, y1 + 2 * border_radius);
gl_geometry_rect(rect4(x1+border_radius, y1-border_radius, x2+border_radius, y1+border_radius), color);
gl_geometry_rect(rect4(x1-border_radius, y2-border_radius, x2-border_radius, y2+border_radius), color);