Skip to content

Commit

Permalink
gizmo: add Disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Oct 30, 2024
1 parent 82d6fc9 commit 0ba6bb4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Gizmo.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type GizmoWidget struct {
view *ViewMatrix
projection *ProjectionMatrix
id ID
disabled bool
}

// Gizmo creates a new GizmoWidget.
Expand All @@ -76,6 +77,7 @@ func Gizmo(view *ViewMatrix, projection *ProjectionMatrix) *GizmoWidget {
view: view,
projection: projection,
id: GenAutoID("gizmo"),
disabled: false,
}
}

Expand All @@ -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...)
Expand All @@ -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)
Expand Down

0 comments on commit 0ba6bb4

Please sign in to comment.