improve fullscreen behavior and address other review comments

This commit is contained in:
dkanada
2026-07-26 17:06:51 +09:00
parent b7e4dd9e5d
commit 003b417073
5 changed files with 14 additions and 21 deletions
+1 -3
View File
@@ -2266,9 +2266,7 @@ export class PlaybackManager {
options.items = items;
return player.play(options).then(() => {
onPlaybackStarted(player, options, player.streamInfo, player.streamInfo?.mediaSource);
});
return player.play(options);
}
const getAdditionalParts = async (items, mediaSourceId, startIndex) => {
-6
View File
@@ -16,12 +16,6 @@ export declare global {
'viewshow': CustomEvent;
}
interface Document {
webkitIsFullScreen?: boolean;
webkitCancelFullscreen?(): void;
webkitEnterFullscreen?(): void;
}
const __COMMIT_SHA__: string;
const __JF_BUILD_VERSION__: string;
const __PACKAGE_JSON_NAME__: string;
+8 -8
View File
@@ -46,12 +46,10 @@ const BookOsd: FC<BookOsdProps> = ({
const [fullscreen, setFullscreen] = useState(false);
const updateFullscreen = useCallback((state: boolean) => {
if (Screenfull.isEnabled) {
if (Screenfull.isEnabled && Screenfull.isFullscreen !== state) {
void Screenfull.toggle();
} else if (window.NativeShell) {
state ? window.NativeShell.enableFullscreen() : window.NativeShell.disableFullscreen();
} else if (document.webkitEnterFullscreen || document.webkitCancelFullscreen) {
state ? document.webkitEnterFullscreen?.() : document.webkitCancelFullscreen?.();
}
}, []);
@@ -135,11 +133,13 @@ const BookOsd: FC<BookOsdProps> = ({
/>
)}
<IconButton
onClick={onClickFullscreen}
icon={fullscreen ? 'fullscreen_exit' : 'fullscreen'}
title={globalize.translate(fullscreen ? 'ExitFullscreen' : 'Fullscreen')}
/>
{(Screenfull.isEnabled || window.NativeShell) && (
<IconButton
onClick={onClickFullscreen}
icon={fullscreen ? 'fullscreen_exit' : 'fullscreen'}
title={globalize.translate(fullscreen ? 'ExitFullscreen' : 'Fullscreen')}
/>
)}
</div>
</div>
);
+1 -1
View File
@@ -277,7 +277,7 @@ export class ComicsPlayer {
this.pageCount = this.archiveSource.urls.length;
this.currentPage = options.startPositionTicks / 10000 || 0;
this.currentSrc = () => this.currentPage;
this.currentSrc = () => downloadUrl;
this.swiperInstance = new Swiper(elem.querySelector('.slideshowSwiperContainer'), {
direction: 'horizontal',
+4 -3
View File
@@ -223,6 +223,7 @@ export class PdfPlayer {
});
return downloadTask.promise.then(book => {
if (this.cancellationToken) return;
this.currentSrc = () => downloadHref;
this.book = book;
this.loaded = true;
@@ -267,7 +268,7 @@ export class PdfPlayer {
// load any missing pages in the cache
for (const page of pages) {
if (!this.pages[page] || this.dimensions !== window.innerWidth + window.innerHeight) {
if (!this.pages[page] || this.cacheWidth !== window.innerWidth || this.cacheHeight !== window.innerHeight) {
this.pages[page] = document.createElement('canvas');
this.renderPage(this.pages[page], parseInt(page.slice(4), 10));
@@ -277,10 +278,10 @@ export class PdfPlayer {
// show the requested page
canvas?.parentNode.replaceChild(this.pages[prefix + number], canvas);
this.currentSrc = () => this.pages[prefix + number];
// track size so we can render all pages again when the screen has changed
this.dimensions = window.innerWidth + window.innerHeight;
this.cacheWidth = window.innerWidth;
this.cacheHeight = window.innerHeight;
// delete all pages outside the cache area
for (const page in this.pages) {