MCPcopy Create free account
hub / github.com/bajrangCoder/setu / pointer_seek_target

Method pointer_seek_target

src/components/audio_player.rs:295–305  ·  view source on GitHub ↗
(&self, position: Point<Pixels>)

Source from the content-addressed store, hash-verified

293 let width = self.progress_bounds.size.width;
294 if width <= px(0.0) {
295 return None;
296 }
297
298 let inner_pos = position.x - self.progress_bounds.left();
299 let fraction = (inner_pos.clamp(px(0.0), width) / width).clamp(0.0, 1.0);
300 Some(total_duration.mul_f32(fraction))
301 }
302
303 fn clamp_to_duration(&self, position: Duration) -> Duration {
304 if let Some(total_duration) = self.total_duration {
305 position.min(total_duration)
306 } else {
307 position
308 }

Callers 1

seek_to_pointerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected