mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
recalculate relativelly offset by value
This commit is contained in:
parent
e5456fe55b
commit
dd4c4342e0
1 changed files with 3 additions and 2 deletions
|
|
@ -70,18 +70,19 @@ class NiceSlider(QtWidgets.QSlider):
|
|||
)
|
||||
|
||||
_range = self.maximum() - self.minimum()
|
||||
_offset = self.value() - self.minimum()
|
||||
if horizontal:
|
||||
_handle_half = rect.height() / 2
|
||||
_handle_size = _handle_half * 2
|
||||
width = rect.width() - _handle_size
|
||||
pos_x = ((width / _range) * self.value())
|
||||
pos_x = ((width / _range) * _offset)
|
||||
pos_y = rect.center().y() - _handle_half + 1
|
||||
else:
|
||||
_handle_half = rect.width() / 2
|
||||
_handle_size = _handle_half * 2
|
||||
height = rect.height() - _handle_size
|
||||
pos_x = rect.center().x() - _handle_half + 1
|
||||
pos_y = height - ((height / _range) * self.value())
|
||||
pos_y = height - ((height / _range) * _offset)
|
||||
|
||||
handle_rect = QtCore.QRect(
|
||||
pos_x, pos_y, _handle_size, _handle_size
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue