Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed May 18, 2024
1 parent eb2bdbe commit e9f1548
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/Viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class Viewer extends TypedEventTarget<ViewerEvents> {
* Checks if the viewer is in fullscreen
*/
isFullscreenEnabled(): boolean {
return isFullscreenEnabled(this.parent);
return isFullscreenEnabled(this.parent, SYSTEM.isIphone);
}

/**
Expand Down Expand Up @@ -708,7 +708,7 @@ export class Viewer extends TypedEventTarget<ViewerEvents> {
*/
enterFullscreen() {
if (!this.isFullscreenEnabled()) {
requestFullscreen(this.parent);
requestFullscreen(this.parent, SYSTEM.isIphone);
}
}

Expand All @@ -717,7 +717,7 @@ export class Viewer extends TypedEventTarget<ViewerEvents> {
*/
exitFullscreen() {
if (this.isFullscreenEnabled()) {
exitFullscreen();
exitFullscreen(SYSTEM.isIphone);
}
}

Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/utils/browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SYSTEM } from '../data/system';
import { Point } from '../model';
import { angle, distance } from './math';

Expand Down Expand Up @@ -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;
Expand All @@ -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'));
Expand All @@ -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'));
Expand Down

0 comments on commit e9f1548

Please sign in to comment.