Added generic margin.

This commit is contained in:
Sander Schobers 2020-12-13 07:43:00 +01:00
parent 11e37af9c2
commit 102c187566
2 changed files with 4 additions and 2 deletions

View File

@ -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)

View File

@ -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.,