1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:38:10 +00:00

LibWeb: Move the media volume slider 1:1 with the mouse cursor

The volume control's slider is drawn in a rectangle shrunken by its
slider handle's size, so the handle did not move 1:1 with the user's
mouse movement.

To fix this, it will now check for a mousedown in the volume control
with a rectangle sized to fit any possible position of the handle, but
the volume value result will be calculated based on the center of the
handle instead. This allows it to move 1:1 with the mouse cursor.

Co-authored-by: trflynn89 <trflynn89@serenityos.org>
This commit is contained in:
Zaggy1024 2023-08-03 17:53:35 -05:00 committed by Tim Flynn
parent 3d19eebba0
commit 74636ccb57
3 changed files with 13 additions and 11 deletions

View file

@ -124,6 +124,7 @@ public:
Optional<CSSPixelRect> timeline_rect;
Optional<CSSPixelRect> speaker_button_rect;
Optional<CSSPixelRect> volume_rect;
Optional<CSSPixelRect> volume_scrub_rect;
};
CachedLayoutBoxes& cached_layout_boxes(Badge<Painting::MediaPaintable>) const { return m_layout_boxes; }