Add helper function IsPointInWindow
This commit is contained in:
parent
36db160533
commit
6d6629d3c0
|
@ -173,7 +173,7 @@ func (s *Supervisor) Loop(ev *event.State) error {
|
||||||
if err == ErrStopPropagation || handled {
|
if err == ErrStopPropagation || handled {
|
||||||
// A widget in the active window has accepted an event. Do not pass
|
// A widget in the active window has accepted an event. Do not pass
|
||||||
// the event also to lower widgets.
|
// the event also to lower widgets.
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run events for the other widgets not in a managed window.
|
// Run events for the other widgets not in a managed window.
|
||||||
|
|
|
@ -151,6 +151,19 @@ func (s *Supervisor) FocusWindow(win *Window) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsPointInWindow returns whether the given Point overlaps with a window managed
|
||||||
|
// by the Supervisor.
|
||||||
|
func (s *Supervisor) IsPointInWindow(point render.Point) bool {
|
||||||
|
node := s.winFocus
|
||||||
|
for node != nil {
|
||||||
|
if point.Inside(AbsoluteRect(node.window)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
node = node.next
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// presentWindows draws the windows from bottom to top.
|
// presentWindows draws the windows from bottom to top.
|
||||||
func (s *Supervisor) presentWindows(e render.Engine) {
|
func (s *Supervisor) presentWindows(e render.Engine) {
|
||||||
item := s.winBottom
|
item := s.winBottom
|
||||||
|
|
Loading…
Reference in New Issue
Block a user