Improved comments.

This commit is contained in:
The Wobbler 2025-01-25 13:02:23 +01:00
parent f815e21aa8
commit 905f157ee0

View file

@ -28,8 +28,8 @@ class TrackProgressSlider(QSlider):
# old value calculation:
# value = self.maximum() * x // self.width()
# but we need that calculation because the handle width is limiting the range, and we need to set
# the slider handle's center to the click position, not the start of the handle
# but we need that new calculation because the handle width is limiting the range, and we need to set
# the slider handle's center to the click position, not to the start of the handle
# (self.width() - self.handle_width) calculates the usable width and
# (x - self.handle_width // 2) offsets the position by minus half of the handle width
value = self.maximum() * (x - self.handle_width // 2) // (self.width() - self.handle_width)