Skip to content

Commit 52d1380

Browse files
committed
Make shrinking proportional to the distance
1 parent 67954b1 commit 52d1380

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/bar.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,16 +736,13 @@ def _update_rail_with_animation(self, active_button):
736736
return True
737737

738738
diameter = 24
739-
reduced_diameter = 8 # New variable for reduced size during stretch
740739
if data.VERTICAL:
741740
pos_prop, size_prop = "margin-top", "min-height"
742-
other_size_prop, other_size_val = "min-width", reduced_diameter
743741
target_pos = (
744742
target_allocation.y + (target_allocation.height / 2) - (diameter / 2)
745743
)
746744
else:
747745
pos_prop, size_prop = "margin-left", "min-width"
748-
other_size_prop, other_size_val = "min-height", reduced_diameter
749746
target_pos = (
750747
target_allocation.x + (target_allocation.width / 2) - (diameter / 2)
751748
)
@@ -761,6 +758,13 @@ def _update_rail_with_animation(self, active_button):
761758
stretch_duration = 0.1
762759
shrink_duration = 0.15
763760

761+
reduced_diameter = max(2, int(diameter - abs(distance / 10.0)))
762+
763+
if data.VERTICAL:
764+
other_size_prop, other_size_val = "min-width", reduced_diameter
765+
else:
766+
other_size_prop, other_size_val = "min-height", reduced_diameter
767+
764768
stretch_css = f"""
765769
#workspace-rail {{
766770
transition-property: {pos_prop}, {size_prop};

0 commit comments

Comments
 (0)