Skip to content

Commit

Permalink
changes initial setup of the disks
Browse files Browse the repository at this point in the history
  • Loading branch information
maharshi-gor committed Feb 20, 2024
1 parent ec0c4bd commit 03a0b6c
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions fury/ui/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,14 +973,39 @@ def _set_position(self, coords):
else:
# Offset the slider line width by half the slider line height.
track_position[0] -= self.track.size[0] / 2.0

self.track.position = track_position

self.handles[0].position = self.handles[0].position.astype(float)
self.handles[1].position = self.handles[1].position.astype(float)

self.handles[0].center = (track_position[0], self.track.center[1])
self.handles[1].center = (track_position[0] + self.track.size[0],
self.track.center[1])
if self.orientation == 'horizontal':
x_pos0 = coords[0]
x_pos1 = coords[0] + self.track.size[0]
y_pos = coords[1] + self.handles[0].size[1] / 2.0

if hasattr(self, '_values'):
x_pos0 = self.ratio_to_coord(
self.value_to_ratio(self._values[0]))
x_pos1 = self.ratio_to_coord(
self.value_to_ratio(self._values[1]))

self.handles[0].center = (x_pos0, y_pos)
self.handles[1].center = (x_pos1, y_pos)

else:
y_pos0 = coords[1]
y_pos1 = coords[1] + self.track.size[1]
x_pos = coords[0] + self.handles[0].size[0] / 2.0

if hasattr(self, '_values'):
y_pos0 = self.ratio_to_coord(
self.value_to_ratio(self._values[0]))
y_pos1 = self.ratio_to_coord(
self.value_to_ratio(self._values[1]))

self.handles[0].center = (x_pos, y_pos0)
self.handles[1].center = (x_pos, y_pos1)

if self.orientation == 'horizontal':
# Position the text below the handles.
Expand Down

0 comments on commit 03a0b6c

Please sign in to comment.