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)