Added generic margin.
This commit is contained in:
parent
11e37af9c2
commit
102c187566
@ -95,14 +95,14 @@ func (o *debugOverlay) renderControl(ctx Context, control Control) {
|
|||||||
nameTextureHeight := float32(nameTexture.Height())
|
nameTextureHeight := float32(nameTexture.Height())
|
||||||
renderer.FillRectangle(pos.RectRel2D(nameTextureWidth, nameTextureHeight), color.Black)
|
renderer.FillRectangle(pos.RectRel2D(nameTextureWidth, nameTextureHeight), color.Black)
|
||||||
renderer.DrawTexturePoint(nameTexture, pos)
|
renderer.DrawTexturePoint(nameTexture, pos)
|
||||||
childPos := pos.Add2D(nameTextureWidth+8, 0)
|
childPos := pos.Add2D(nameTextureWidth+ctx.Style().Dimensions.Margin, 0)
|
||||||
for _, child := range node.Children {
|
for _, child := range node.Children {
|
||||||
if childPos.Y == maxY {
|
if childPos.Y == maxY {
|
||||||
childPos.Y = maxY + nameTextureHeight
|
childPos.Y = maxY + nameTextureHeight
|
||||||
}
|
}
|
||||||
renderHoverNode(childPos, child)
|
renderHoverNode(childPos, child)
|
||||||
maxY = childPos.Y
|
maxY = childPos.Y
|
||||||
childPos.Y += nameTextureHeight + 8
|
childPos.Y += nameTextureHeight + ctx.Style().Dimensions.Margin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderHoverNode(geom.PtF32(4, 4), o.hoverNodes)
|
renderHoverNode(geom.PtF32(4, 4), o.hoverNodes)
|
||||||
|
@ -12,6 +12,7 @@ var defaultPalette *Palette
|
|||||||
var defaultStyle *Style
|
var defaultStyle *Style
|
||||||
|
|
||||||
type Dimensions struct {
|
type Dimensions struct {
|
||||||
|
Margin float32
|
||||||
OutlineWidth float32
|
OutlineWidth float32
|
||||||
ScrollbarWidth float32
|
ScrollbarWidth float32
|
||||||
TextPadding float32
|
TextPadding float32
|
||||||
@ -67,6 +68,7 @@ type Style struct {
|
|||||||
|
|
||||||
func DefaultDimensions() *Dimensions {
|
func DefaultDimensions() *Dimensions {
|
||||||
return &Dimensions{
|
return &Dimensions{
|
||||||
|
Margin: 8.,
|
||||||
OutlineWidth: 2.,
|
OutlineWidth: 2.,
|
||||||
ScrollbarWidth: 16.,
|
ScrollbarWidth: 16.,
|
||||||
TextPadding: 8.,
|
TextPadding: 8.,
|
||||||
|
Loading…
Reference in New Issue
Block a user