Add custom overlay positioning and scaling options in configuration

This commit is contained in:
CodeDevMLH
2026-03-10 23:43:20 +01:00
parent bca2d577b9
commit b3b6296798
4 changed files with 40 additions and 8 deletions

View File

@@ -56,5 +56,9 @@ namespace Jellyfin.Plugin.MediaBarEnhanced.Configuration
public string CustomOverlayStyle { get; set; } = "Shadowed"; public string CustomOverlayStyle { get; set; } = "Shadowed";
public string CustomOverlayImageStyle { get; set; } = "None"; public string CustomOverlayImageStyle { get; set; } = "None";
public string CustomOverlayPriority { get; set; } = "Image"; public string CustomOverlayPriority { get; set; } = "Image";
public int CustomOverlayPositionX { get; set; } = 0;
public int CustomOverlayPositionY { get; set; } = 0;
public int CustomOverlayScale { get; set; } = 100;
} }
} }

View File

@@ -316,7 +316,24 @@
<div class="fieldDescription">Choose a visual effect to apply to your overlay image.</div> <div class="fieldDescription">Choose a visual effect to apply to your overlay image.</div>
</div> </div>
<h3 class="sectionTitle" style="margin-top:2em; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5em;">Layout Tweaks</h3>
<div style="display: flex; gap: 1em; flex-wrap: wrap;">
<div class="inputContainer" style="flex: 1; min-width: 150px;">
<label class="inputLabel inputLabelUnfocused" for="CustomOverlayPositionX">X Offset (% vw)</label>
<input is="emby-input" type="number" id="CustomOverlayPositionX" name="CustomOverlayPositionX" min="-50" max="50" step="1" />
<div class="fieldDescription">Horizontal nudge (negative = left, positive = right). Default is 0.</div>
</div>
<div class="inputContainer" style="flex: 1; min-width: 150px;">
<label class="inputLabel inputLabelUnfocused" for="CustomOverlayPositionY">Y Offset (% vh)</label>
<input is="emby-input" type="number" id="CustomOverlayPositionY" name="CustomOverlayPositionY" min="-50" max="50" step="1" />
<div class="fieldDescription">Vertical nudge (negative = up, positive = down). Default is 0.</div>
</div>
<div class="inputContainer" style="flex: 1; min-width: 150px;">
<label class="inputLabel inputLabelUnfocused" for="CustomOverlayScale">Scale (%)</label>
<input is="emby-input" type="number" id="CustomOverlayScale" name="CustomOverlayScale" min="50" max="200" step="1" />
<div class="fieldDescription">Overlay zoom level. Default is 100%.</div>
</div>
</div>
</div> </div>
<!-- ADVANCED TAB --> <!-- ADVANCED TAB -->
@@ -645,7 +662,8 @@
'IncludeWatchedContent', 'ShowPaginationDots', 'MaxParentalRating', 'IncludeWatchedContent', 'ShowPaginationDots', 'MaxParentalRating',
'MaxDaysRecent', 'ExcludeSeasonalContent', 'HideArrowsOnMobile', 'MaxDaysRecent', 'ExcludeSeasonalContent', 'HideArrowsOnMobile',
'EnableCustomOverlay', 'CustomOverlayText', 'CustomOverlayImageUrl', 'EnableCustomOverlay', 'CustomOverlayText', 'CustomOverlayImageUrl',
'CustomOverlayStyle', 'CustomOverlayImageStyle', 'CustomOverlayPriority' 'CustomOverlayStyle', 'CustomOverlayImageStyle', 'CustomOverlayPriority',
'CustomOverlayPositionX', 'CustomOverlayPositionY', 'CustomOverlayScale'
]; ];
// Manual mapping for MediaBarIsEnabled -> IsEnabled, to avoid conflicts with other plugins // Manual mapping for MediaBarIsEnabled -> IsEnabled, to avoid conflicts with other plugins
@@ -889,7 +907,8 @@
'IncludeWatchedContent', 'ShowPaginationDots', 'MaxParentalRating', 'IncludeWatchedContent', 'ShowPaginationDots', 'MaxParentalRating',
'MaxDaysRecent', 'ExcludeSeasonalContent', 'HideArrowsOnMobile', 'MaxDaysRecent', 'ExcludeSeasonalContent', 'HideArrowsOnMobile',
'EnableCustomOverlay', 'CustomOverlayText', 'CustomOverlayImageUrl', 'EnableCustomOverlay', 'CustomOverlayText', 'CustomOverlayImageUrl',
'CustomOverlayStyle', 'CustomOverlayImageStyle', 'CustomOverlayPriority' 'CustomOverlayStyle', 'CustomOverlayImageStyle', 'CustomOverlayPriority',
'CustomOverlayPositionX', 'CustomOverlayPositionY', 'CustomOverlayScale'
]; ];
keys.forEach(function (key) { keys.forEach(function (key) {

View File

@@ -1035,8 +1035,9 @@
/* Custom Overlay Styling */ /* Custom Overlay Styling */
.custom-overlay-container { .custom-overlay-container {
position: absolute; position: absolute;
top: 8vh; top: calc(8vh + var(--overlay-y, 0vh));
left: 4vw; left: calc(4vw + var(--overlay-x, 0vw));
transform: scale(var(--overlay-scale, 1));
z-index: 15; z-index: 15;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1082,9 +1083,9 @@
@media only screen and (max-width: 767px) and (orientation: portrait) { @media only screen and (max-width: 767px) and (orientation: portrait) {
.custom-overlay-container { .custom-overlay-container {
top: 15vh; top: calc(15vh + var(--overlay-y, 0vh));
left: 50%; left: calc(50% + var(--overlay-x, 0vw));
transform: translateX(-50%); transform: translateX(-50%) scale(var(--overlay-scale, 1));
width: 90%; width: 90%;
justify-content: center; justify-content: center;
text-align: center; text-align: center;

View File

@@ -3867,6 +3867,14 @@ const slidesInit = async () => {
const slidesContainer = document.getElementById("slides-container"); const slidesContainer = document.getElementById("slides-container");
if (slidesContainer) { if (slidesContainer) {
const posX = CONFIG.customOverlayPositionX || 0;
const posY = CONFIG.customOverlayPositionY || 0;
const scaleValue = (CONFIG.customOverlayScale !== undefined ? CONFIG.customOverlayScale : 100) / 100;
overlayContainer.style.setProperty('--overlay-x', `${posX}vw`);
overlayContainer.style.setProperty('--overlay-y', `${posY}vh`);
overlayContainer.style.setProperty('--overlay-scale', scaleValue);
slidesContainer.appendChild(overlayContainer); slidesContainer.appendChild(overlayContainer);
} }
}; };