Replace MouseScrollUnit::SCROLL_UNIT_CONVERSION_FACTOR with a Resource#24512
Replace MouseScrollUnit::SCROLL_UNIT_CONVERSION_FACTOR with a Resource#24512stevehello166 wants to merge 15 commits into
MouseScrollUnit::SCROLL_UNIT_CONVERSION_FACTOR with a Resource#24512Conversation
|
@MyCodingSpace5, take a look at this PR and how it evolves :) It should make clear what I meant by a resource here, and how work is done in open source. |
| .add_message::<MouseWheel>() | ||
| .init_resource::<AccumulatedMouseMotion>() | ||
| .init_resource::<AccumulatedMouseScroll>() | ||
| .insert_resource(MouseScrollUnit::Pixel) |
There was a problem hiding this comment.
I think the idea is to insert a conversion factor as a resource, one that users can look up instead of the constant SCROLL_UNIT_CONVERSION_FACTOR.
It can start out equal to that constant; adapting it to the platform is for later work.
There was a problem hiding this comment.
Alright, I reverted the previous changes and added MouseScrollPixelsPerLine resource. I'm not entirely sure about the name of the resource given it's length. However, it is more descriptive than SCROLL_UNIT_CONVERSION_FACTOR.
There was a problem hiding this comment.
That's a totally fine name: I don't think this will come up often.
d9618e6 to
cd0964b
Compare
MouseScrollUnit with a ResourceMouseScrollUnit::SCROLL_UNIT_CONVERSION_FACTOR with a Resource
alice-i-cecile
left a comment
There was a problem hiding this comment.
Looking good, but I think we can add a couple helper methods and make this much nicer :)
amtep
left a comment
There was a problem hiding this comment.
Some confusion around to_lines and to_pixels, otherwise looks good :)
Objective
Fixes #24508
Solution
Replace
MouseScrollUnitwith a Resource of the same name and remove it from the structs and events related to scrolling. More work still needs to be done to make sure that the value inMouseScrollUnitis actually respectedTesting