| 243 | } |
| 244 | |
| 245 | fn render_braille( |
| 246 | &self, |
| 247 | frame: &mut Frame, |
| 248 | area: Rect, |
| 249 | animations_enabled: bool, |
| 250 | base_style: Style, |
| 251 | ) { |
| 252 | let (symbol, color) = if !self.active { |
| 253 | ("·", self.inactive_color) |
| 254 | } else if !animations_enabled { |
| 255 | ("⋯", self.inactive_color) |
| 256 | } else { |
| 257 | ( |
| 258 | BRAILLE_FRAMES[self.frame_index % BRAILLE_FRAMES.len()], |
| 259 | self.base_color, |
| 260 | ) |
| 261 | }; |
| 262 | let mut spans = vec![Span::styled(symbol, Style::default().fg(color))]; |
| 263 | let trailing = usize::from(area.width).saturating_sub(1); |
| 264 | if trailing > 0 { |
| 265 | spans.push(Span::styled( |
| 266 | " ".repeat(trailing), |
| 267 | Style::default().fg(color), |
| 268 | )); |
| 269 | } |
| 270 | let line = Line::from(spans); |
| 271 | frame.render_widget(Paragraph::new(line).style(base_style), area); |
| 272 | } |
| 273 | |
| 274 | fn scanner_state(&self) -> ScannerState { |
| 275 | let frame = self.frame_index % self.knight_total_frames.max(1); |