From 0ba6bb4e30e0283b175d0570a875edbbc175decd Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 30 Oct 2024 10:28:17 +0100 Subject: [PATCH] gizmo: add Disabled --- Gizmo.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Gizmo.go b/Gizmo.go index 92ff9e31..4f7d2e75 100644 --- a/Gizmo.go +++ b/Gizmo.go @@ -67,6 +67,7 @@ type GizmoWidget struct { view *ViewMatrix projection *ProjectionMatrix id ID + disabled bool } // Gizmo creates a new GizmoWidget. @@ -76,6 +77,7 @@ func Gizmo(view *ViewMatrix, projection *ProjectionMatrix) *GizmoWidget { view: view, projection: projection, id: GenAutoID("gizmo"), + disabled: false, } } @@ -85,6 +87,12 @@ func (g *GizmoWidget) ID(id ID) *GizmoWidget { return g } +// Disable disables the GizmoWidget. +func (g *GizmoWidget) Disabled(b bool) *GizmoWidget { + g.disabled = b + return g +} + // Gizmos adds GizmoI elements to the GizmoWidget area. func (g *GizmoWidget) Gizmos(gizmos ...GizmoI) *GizmoWidget { g.gizmos = append(g.gizmos, gizmos...) @@ -95,6 +103,7 @@ func (g *GizmoWidget) Gizmos(gizmos ...GizmoI) *GizmoWidget { // Just to separate Global() and Build() methods. func (g *GizmoWidget) build() { imguizmo.PushIDStr(string(g.id)) + imguizmo.Enable(!g.disabled) for _, gizmo := range g.gizmos { gizmo.Gizmo(g.view, g.projection)