Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll events should register when mouse is over a region #74

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for reflex-vty

## Unreleased

* Change `inputInFocusedRegion` to filter mouse scroll wheel input based on if the region under than the mouse rather than using mouse drag tracking

## 0.5.0.0

* *Breaking change*:
Expand All @@ -9,7 +13,6 @@
* `scrollableText` can be configured to remain scrolled to the bottom on new output, either always or whenever the user is scrolled to the bottom and new output appears.
* Added a new `scrollable` widget in `Reflex.Vty.Widget.Scroll` that allows vertical scrolling when an `Image` is taller than the widget's height.
* Add `ctrlc`, a convenience function that returns an event that fires when a Ctrl+c keypress is detected
* Change `inputInFocusedRegion` to filter mouse scroll wheel input based on if the region is in focus rather than mouse drag tracking
* Fix several issues with wide chars, cursor position and word wrapping in Zipper.hs
* Add `centerText` function to Reflex.Vty.Widget.Box

Expand Down
4 changes: 2 additions & 2 deletions src/Reflex/Vty/Widget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
V.EvKey _ _ | not focused -> Nothing

-- filter scroll wheel input based on mouse position
x@(V.EvMouseDown _ _ btn _) | btn == V.BScrollUp || btn == V.BScrollDown -> case tracking of
ev@(V.EvMouseDown x y btn _) | btn == V.BScrollUp || btn == V.BScrollDown -> case tracking of
trck@(Tracking _) -> Just (trck, Nothing)
_ -> Just (WaitingForInput, if focused then Just x else Nothing)
_ -> Just (WaitingForInput, if withinRegion reg x y then Just (V.EvMouseDown (x - l) (y - t) btn m) else Nothing)

Check failure on line 242 in src/Reflex/Vty/Widget.hs

View workflow job for this annotation

GitHub Actions / GHC 8.4.4 on ubuntu-latest

Variable not in scope: m :: [V.Modifier]

Check failure on line 242 in src/Reflex/Vty/Widget.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on ubuntu-latest

Variable not in scope: m :: [V.Modifier]

Check failure on line 242 in src/Reflex/Vty/Widget.hs

View workflow job for this annotation

GitHub Actions / GHC 8.4.4 on ubuntu-latest

Variable not in scope: m :: [V.Modifier]

Check failure on line 242 in src/Reflex/Vty/Widget.hs

View workflow job for this annotation

GitHub Actions / GHC 8.10.7 on ubuntu-latest

Variable not in scope: m :: [V.Modifier]

-- only do tracking for l/m/r mouse buttons
V.EvMouseDown x y btn m ->
Expand Down
Loading