![]() # Objective The position for track clicks in `core_slider` is calculated incorrectly when using `UiScale`. ## Solution `trigger.event().pointer_location.position` uses logical window coordinates, that is: `position = physical_position / window_scale_factor` while `ComputedNodeTarget::scale_factor` returns the window scale factor multiplied by Ui Scale: `target_scale_factor = window_scale_factor * ui_scale` So to get the physical position need to divide by the `UiScale`: ``` position * target_scale_factor / ui_scale = (physical_postion / window_scale_factor) * (window_scale_factor * ui_scale) / ui_scale = physical_position ``` I thought this was fixed during the slider PR review, but must have got missed somewhere or lost in a merge. ## Testing Can test using the `core_widgets` example` with `.insert_resource(UiScale(2.))` added to the bevy app. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |