MCPcopy
hub / github.com/g3n/engine / onMouse

Method onMouse

gui/button.go:137–159  ·  view source on GitHub ↗

onMouseEvent process subscribed mouse events

(evname string, ev interface{})

Source from the content-addressed store, hash-verified

135
136// onMouseEvent process subscribed mouse events
137func (b *Button) onMouse(evname string, ev interface{}) {
138
139 if !b.Enabled() {
140 return
141 }
142
143 switch evname {
144 case OnMouseDown:
145 Manager().SetKeyFocus(b)
146 b.pressed = true
147 b.update()
148 case OnMouseUpOut:
149 fallthrough
150 case OnMouseUp:
151 if b.pressed && b.mouseOver {
152 b.Dispatch(OnClick, nil)
153 }
154 b.pressed = false
155 b.update()
156 default:
157 return
158 }
159}
160
161// onKey processes subscribed key events
162func (b *Button) onKey(evname string, ev interface{}) {

Callers

nothing calls this directly

Calls 5

updateMethod · 0.95
ManagerFunction · 0.85
SetKeyFocusMethod · 0.80
EnabledMethod · 0.65
DispatchMethod · 0.65

Tested by

no test coverage detected