From 102c1875663b9213576e004c63bccb3a57b5d52a Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 13 Dec 2020 07:43:00 +0100 Subject: [PATCH] Added generic margin. --- ui/debug.go | 4 ++-- ui/style.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/debug.go b/ui/debug.go index eda7170..bdd7da9 100644 --- a/ui/debug.go +++ b/ui/debug.go @@ -95,14 +95,14 @@ func (o *debugOverlay) renderControl(ctx Context, control Control) { nameTextureHeight := float32(nameTexture.Height()) renderer.FillRectangle(pos.RectRel2D(nameTextureWidth, nameTextureHeight), color.Black) renderer.DrawTexturePoint(nameTexture, pos) - childPos := pos.Add2D(nameTextureWidth+8, 0) + childPos := pos.Add2D(nameTextureWidth+ctx.Style().Dimensions.Margin, 0) for _, child := range node.Children { if childPos.Y == maxY { childPos.Y = maxY + nameTextureHeight } renderHoverNode(childPos, child) maxY = childPos.Y - childPos.Y += nameTextureHeight + 8 + childPos.Y += nameTextureHeight + ctx.Style().Dimensions.Margin } } renderHoverNode(geom.PtF32(4, 4), o.hoverNodes) diff --git a/ui/style.go b/ui/style.go index 266db45..25f8004 100644 --- a/ui/style.go +++ b/ui/style.go @@ -12,6 +12,7 @@ var defaultPalette *Palette var defaultStyle *Style type Dimensions struct { + Margin float32 OutlineWidth float32 ScrollbarWidth float32 TextPadding float32 @@ -67,6 +68,7 @@ type Style struct { func DefaultDimensions() *Dimensions { return &Dimensions{ + Margin: 8., OutlineWidth: 2., ScrollbarWidth: 16., TextPadding: 8.,