mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 15:08:18 -07:00
fix: Move calculation logic to lib_mpv subtitles
This commit is contained in:
parent
c446210e6a
commit
5fac088e2d
8 changed files with 42 additions and 63 deletions
|
|
@ -1,12 +1,9 @@
|
|||
import 'dart:math' as math;
|
||||
|
||||
import 'package:fladder/models/settings/subtitle_settings_model.dart';
|
||||
|
||||
class SubtitlePositionCalculator {
|
||||
static const double _fallbackMenuHeightPercentage = 0.15;
|
||||
static const double _dynamicSubtitlePadding =
|
||||
0.00; // Currently unused (0%). Reserved for future implementation of a user-adjustable slider to control subtitle positioning
|
||||
// relative to the player menu
|
||||
static const double _fallbackSubtitlePadding = 0.01; // 1% padding for conservative fallback positioning
|
||||
static const double _maxSubtitleOffset = 0.85;
|
||||
|
||||
static double calculateOffset({
|
||||
|
|
@ -20,17 +17,14 @@ class SubtitlePositionCalculator {
|
|||
}
|
||||
|
||||
double menuHeightPercentage;
|
||||
double subtitlePadding;
|
||||
|
||||
if (menuHeight != null && screenHeight > 0) {
|
||||
menuHeightPercentage = menuHeight / screenHeight;
|
||||
subtitlePadding = _dynamicSubtitlePadding;
|
||||
} else {
|
||||
menuHeightPercentage = _fallbackMenuHeightPercentage;
|
||||
subtitlePadding = _fallbackSubtitlePadding;
|
||||
}
|
||||
|
||||
final minSafeOffset = menuHeightPercentage + subtitlePadding;
|
||||
final minSafeOffset = menuHeightPercentage;
|
||||
|
||||
if (settings.verticalOffset >= minSafeOffset) {
|
||||
return math.min(settings.verticalOffset, _maxSubtitleOffset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue