Exposed last known key modifiers in context.
This commit is contained in:
parent
e7ada7fea0
commit
16d4e26cd0
@ -8,6 +8,7 @@ type Context interface {
|
||||
Animate()
|
||||
Fonts() *Fonts
|
||||
HasQuit() bool
|
||||
KeyModifiers() KeyModifier
|
||||
MousePosition() geom.PointF32
|
||||
Overlays() *Overlays
|
||||
Quit()
|
||||
@ -26,6 +27,7 @@ type context struct {
|
||||
quit chan struct{}
|
||||
renderer Renderer
|
||||
view Control
|
||||
modifiers KeyModifier
|
||||
mouse geom.PointF32
|
||||
tooltip *Tooltip
|
||||
overlays *Overlays
|
||||
@ -66,6 +68,8 @@ func (c *context) HasQuit() bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *context) KeyModifiers() KeyModifier { return c.modifiers }
|
||||
|
||||
func (c *context) MousePosition() geom.PointF32 { return c.mouse }
|
||||
|
||||
func (c *context) Overlays() *Overlays { return c.overlays }
|
||||
@ -97,6 +101,10 @@ func (c *context) Handle(e Event) {
|
||||
return
|
||||
case *MouseMoveEvent:
|
||||
c.mouse = e.Pos()
|
||||
case *KeyDownEvent:
|
||||
c.modifiers = e.Modifiers
|
||||
case *KeyUpEvent:
|
||||
c.modifiers = e.Modifiers
|
||||
}
|
||||
c.overlays.Handle(c, e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user