Overhauled mouse events

Everything gets an image.Point instead of an x y pair, and most
things now get modifiers.
This commit is contained in:
Sasha Koshka 2023-04-20 14:44:54 -04:00
parent eaee284aaf
commit 53f78cb0e7
12 changed files with 183 additions and 69 deletions

View File

@ -189,6 +189,7 @@ func (window *window) handleButtonPress (
point := image.Pt(int(buttonEvent.EventX), int(buttonEvent.EventY)) point := image.Pt(int(buttonEvent.EventX), int(buttonEvent.EventY))
insideWindow := point.In(window.canvas.Bounds()) insideWindow := point.In(window.canvas.Bounds())
scrolling := buttonEvent.Detail >= 4 && buttonEvent.Detail <= 7 scrolling := buttonEvent.Detail >= 4 && buttonEvent.Detail <= 7
modifiers := window.modifiersFromState(buttonEvent.State)
if !insideWindow && window.shy && !scrolling { if !insideWindow && window.shy && !scrolling {
window.Close() window.Close()