Skip to content

Commit 024e2af

Browse files
committed
slider: use self.confirmed
1 parent e35513a commit 024e2af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

system/ui/widgets/slider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _update_state(self):
100100
activated_pos = int(-self._bg_txt.width + self._circle_bg_txt.width)
101101
self._scroll_x_circle = max(min(self._scroll_x_circle, 0), activated_pos)
102102

103-
if self._confirmed_time > 0:
103+
if self.confirmed:
104104
# swiped left to confirm
105105
self._scroll_x_circle_filter.update(activated_pos)
106106

@@ -129,7 +129,7 @@ def _render(self, _):
129129
btn_x = bg_txt_x + self._bg_txt.width - self._circle_bg_txt.width + self._scroll_x_circle_filter.x
130130
btn_y = self._rect.y + (self._rect.height - self._circle_bg_txt.height) / 2
131131

132-
if self._confirmed_time == 0.0 or self._scroll_x_circle > 0:
132+
if not self.confirmed:
133133
self._label.set_text_color(rl.Color(255, 255, 255, int(255 * 0.65 * (1.0 - self.slider_percentage) * self._opacity_filter.x)))
134134
label_rect = rl.Rectangle(
135135
self._rect.x + 20,
@@ -140,7 +140,7 @@ def _render(self, _):
140140
self._label.render(label_rect)
141141

142142
# circle and arrow
143-
circle_bg_txt = self._circle_bg_pressed_txt if self._is_dragging_circle or self._confirmed_time > 0 else self._circle_bg_txt
143+
circle_bg_txt = self._circle_bg_pressed_txt if self._is_dragging_circle or self.confirmed else self._circle_bg_txt
144144
rl.draw_texture_ex(circle_bg_txt, rl.Vector2(btn_x, btn_y), 0.0, 1.0, white)
145145

146146
arrow_x = btn_x + (self._circle_bg_txt.width - self._circle_arrow_txt.width) / 2

0 commit comments

Comments
 (0)