diff --git a/packages/core/src/Viewer.ts b/packages/core/src/Viewer.ts index 8a33ea21f..aaa0d2c38 100644 --- a/packages/core/src/Viewer.ts +++ b/packages/core/src/Viewer.ts @@ -286,7 +286,7 @@ export class Viewer extends TypedEventTarget { * Checks if the viewer is in fullscreen */ isFullscreenEnabled(): boolean { - return isFullscreenEnabled(this.parent); + return isFullscreenEnabled(this.parent, SYSTEM.isIphone); } /** @@ -708,7 +708,7 @@ export class Viewer extends TypedEventTarget { */ enterFullscreen() { if (!this.isFullscreenEnabled()) { - requestFullscreen(this.parent); + requestFullscreen(this.parent, SYSTEM.isIphone); } } @@ -717,7 +717,7 @@ export class Viewer extends TypedEventTarget { */ exitFullscreen() { if (this.isFullscreenEnabled()) { - exitFullscreen(); + exitFullscreen(SYSTEM.isIphone); } } diff --git a/packages/core/src/utils/browser.ts b/packages/core/src/utils/browser.ts index 0d07496c2..03188e4d8 100644 --- a/packages/core/src/utils/browser.ts +++ b/packages/core/src/utils/browser.ts @@ -1,4 +1,3 @@ -import { SYSTEM } from '../data/system'; import { Point } from '../model'; import { angle, distance } from './math'; @@ -131,8 +130,8 @@ let fullscreenElement: HTMLElement; /** * Detects if fullscreen is enabled */ -export function isFullscreenEnabled(elt: HTMLElement): boolean { - if (SYSTEM.isIphone) { +export function isFullscreenEnabled(elt: HTMLElement, isIphone = false): boolean { + if (isIphone) { return elt === fullscreenElement; } else { return document.fullscreenElement === elt; @@ -142,8 +141,8 @@ export function isFullscreenEnabled(elt: HTMLElement): boolean { /** * Enters fullscreen mode */ -export function requestFullscreen(elt: HTMLElement) { - if (SYSTEM.isIphone) { +export function requestFullscreen(elt: HTMLElement, isIphone = false) { + if (isIphone) { fullscreenElement = elt; elt.classList.add('psv-fullscreen-emulation'); document.dispatchEvent(new Event('fullscreenchange')); @@ -155,8 +154,8 @@ export function requestFullscreen(elt: HTMLElement) { /** * Exits fullscreen mode */ -export function exitFullscreen() { - if (SYSTEM.isIphone) { +export function exitFullscreen(isIphone = false) { + if (isIphone) { fullscreenElement.classList.remove('psv-fullscreen-emulation'); fullscreenElement = null; document.dispatchEvent(new Event('fullscreenchange'));