mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Prevent OSD from being hidden when user works with UI
This commit is contained in:
parent
70b0fbafd0
commit
891cc78bdb
1 changed files with 48 additions and 1 deletions
|
@ -333,13 +333,21 @@ define(['playbackManager', 'dom', 'inputManager', 'datetime', 'itemHelper', 'med
|
||||||
osdPoster.innerHTML = '';
|
osdPoster.innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let osdLockCount = 0;
|
||||||
|
|
||||||
function showOsd() {
|
function showOsd() {
|
||||||
slideDownToShow(headerElement);
|
slideDownToShow(headerElement);
|
||||||
showMainOsdControls();
|
showMainOsdControls();
|
||||||
startOsdHideTimer();
|
if (!osdLockCount) {
|
||||||
|
startOsdHideTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideOsd() {
|
function hideOsd() {
|
||||||
|
if (osdLockCount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slideUpToHide(headerElement);
|
slideUpToHide(headerElement);
|
||||||
hideMainOsdControls();
|
hideMainOsdControls();
|
||||||
}
|
}
|
||||||
|
@ -352,6 +360,19 @@ define(['playbackManager', 'dom', 'inputManager', 'datetime', 'itemHelper', 'med
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lockOsd() {
|
||||||
|
osdLockCount++;
|
||||||
|
stopOsdHideTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
function unlockOsd() {
|
||||||
|
osdLockCount--;
|
||||||
|
// Restart hide timer if OSD is currently visible
|
||||||
|
if (currentVisibleMenu && !osdLockCount) {
|
||||||
|
startOsdHideTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function startOsdHideTimer() {
|
function startOsdHideTimer() {
|
||||||
stopOsdHideTimer();
|
stopOsdHideTimer();
|
||||||
osdHideTimeout = setTimeout(hideOsd, 3e3);
|
osdHideTimeout = setTimeout(hideOsd, 3e3);
|
||||||
|
@ -1196,10 +1217,20 @@ define(['playbackManager', 'dom', 'inputManager', 'datetime', 'itemHelper', 'med
|
||||||
|
|
||||||
function onWindowMouseDown(e) {
|
function onWindowMouseDown(e) {
|
||||||
clickedElement = e.srcElement;
|
clickedElement = e.srcElement;
|
||||||
|
lockOsd();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onWindowMouseUp() {
|
||||||
|
unlockOsd();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWindowTouchStart(e) {
|
function onWindowTouchStart(e) {
|
||||||
clickedElement = e.srcElement;
|
clickedElement = e.srcElement;
|
||||||
|
lockOsd();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onWindowTouchEnd() {
|
||||||
|
unlockOsd();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImgUrl(item, chapter, index, maxWidth, apiClient) {
|
function getImgUrl(item, chapter, index, maxWidth, apiClient) {
|
||||||
|
@ -1336,9 +1367,17 @@ define(['playbackManager', 'dom', 'inputManager', 'datetime', 'itemHelper', 'med
|
||||||
dom.addEventListener(window, window.PointerEvent ? 'pointerdown' : 'mousedown', onWindowMouseDown, {
|
dom.addEventListener(window, window.PointerEvent ? 'pointerdown' : 'mousedown', onWindowMouseDown, {
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
dom.addEventListener(window, window.PointerEvent ? 'pointerup' : 'mouseup', onWindowMouseUp, {
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
dom.addEventListener(window, 'touchstart', onWindowTouchStart, {
|
dom.addEventListener(window, 'touchstart', onWindowTouchStart, {
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
['touchend', 'touchcancel'].forEach((event) => {
|
||||||
|
dom.addEventListener(window, event, onWindowTouchEnd, {
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
require(['appRouter'], function(appRouter) {
|
require(['appRouter'], function(appRouter) {
|
||||||
appRouter.goHome();
|
appRouter.goHome();
|
||||||
|
@ -1356,9 +1395,17 @@ define(['playbackManager', 'dom', 'inputManager', 'datetime', 'itemHelper', 'med
|
||||||
dom.removeEventListener(window, window.PointerEvent ? 'pointerdown' : 'mousedown', onWindowMouseDown, {
|
dom.removeEventListener(window, window.PointerEvent ? 'pointerdown' : 'mousedown', onWindowMouseDown, {
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
dom.removeEventListener(window, window.PointerEvent ? 'pointerup' : 'mouseup', onWindowMouseUp, {
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
dom.removeEventListener(window, 'touchstart', onWindowTouchStart, {
|
dom.removeEventListener(window, 'touchstart', onWindowTouchStart, {
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
['touchend', 'touchcancel'].forEach((event) => {
|
||||||
|
dom.removeEventListener(window, event, onWindowTouchEnd, {
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
|
});
|
||||||
stopOsdHideTimer();
|
stopOsdHideTimer();
|
||||||
headerElement.classList.remove('osdHeader');
|
headerElement.classList.remove('osdHeader');
|
||||||
headerElement.classList.remove('osdHeader-hidden');
|
headerElement.classList.remove('osdHeader-hidden');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue