Closed MercuriusXeno closed 1 day ago
Hindsight - i'm not a huge fan of the pattern differences between overridden buttons (set it and forget it, it clears the override on release organically) and this new flag (you have to put it back when you're done).
I experimented a bit with trying to make something more temporary but it's a broad departure from what this PR does.
Open to ideas.
Thanks for the pull request! We could maybe update the old state once when the method is called though, so it'd only be suppressed until the scroll wheel changes again (just like button suppression only applies until it changes again).
Changed the style per your suggestion, wound up being a much cleaner impl
Merged into develop
for the upcoming SMAPI 4.1.0. Thanks for the help!
Exposes a new method in
IInputHandler
namedSuppressScrollWheel
, which causesSInputState
to updateGame1.oldMouseState
to a copy of itself withScrollWheelValue
synced to the latest value, each tick, so that changes are ignored, for the duration of the suppression.Mods must proactively reset the suppression state to false to restore scrolling when they're done doing whatever they need to do with scrolling.
Note that this preserves
MouseWheelChangedEvent
firing by design. I didn't consider the use cases or ramification too deeply beyond the initial assumption that mods would still need the event to fire, so this may need further discussion.Feel free to issue any corrections if there's style issues, I do not mind the cleanup work.