From c845184c536961979679184df8fd511c57880cf8 Mon Sep 17 00:00:00 2001 From: PartyDonut <42371342+PartyDonut@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:43:34 +0100 Subject: [PATCH] bugfix: Fix trick play overflow (#186) Co-authored-by: PartyDonut --- .../video_player/components/video_progress_bar.dart | 4 ++-- lib/widgets/shared/trick_play_image.dart | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/screens/video_player/components/video_progress_bar.dart b/lib/screens/video_player/components/video_progress_bar.dart index 738ff02..10bca8b 100644 --- a/lib/screens/video_player/components/video_progress_bar.dart +++ b/lib/screens/video_player/components/video_progress_bar.dart @@ -268,10 +268,10 @@ class _ChapterProgressSliderState extends ConsumerState { final chapter = (currentStream?.chapters ?? []).getChapterFromDuration(currentDuration); final trickPlay = currentStream?.trickPlay; final screenWidth = MediaQuery.of(context).size.width; - final calculatedPosition = _chapterPosition.clamp(-50, screenWidth - (chapterCardWidth + 45)).toDouble(); + final calculatedPosition = _chapterPosition; final offsetDifference = _chapterPosition - calculatedPosition; return Positioned( - left: calculatedPosition, + left: calculatedPosition.clamp(-10, screenWidth - (chapterCardWidth + 45)), child: IgnorePointer( child: AnimatedOpacity( opacity: visible ? 1 : 0, diff --git a/lib/widgets/shared/trick_play_image.dart b/lib/widgets/shared/trick_play_image.dart index ecba7c3..92fa94c 100644 --- a/lib/widgets/shared/trick_play_image.dart +++ b/lib/widgets/shared/trick_play_image.dart @@ -103,19 +103,16 @@ class _TrickPlayPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - // Define the source rectangle from the image Rect srcRect = Rect.fromLTWH( offset.dx, offset.dy, model.width.toDouble(), model.height.toDouble(), - ); // Adjust these values to control the part of the image to display + ); - // Define the destination rectangle on the canvas + Paint paint = Paint()..filterQuality = FilterQuality.high; Rect dstRect = Rect.fromLTWH(0, 0, size.width, size.height); - - // Draw the image part onto the canvas - canvas.drawImageRect(image, srcRect, dstRect, Paint()); + canvas.drawImageRect(image, srcRect, dstRect, paint); } @override