Update fullscreen.js

This commit is contained in:
Karl Chen 2017-12-24 13:50:37 +08:00 committed by GitHub
parent 212db32d05
commit 8b9cc21c96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 10 deletions

View File

@ -36,8 +36,10 @@ class FullScreen {
}
}
request (type = 'browser', switchmode) {
if (!switchmode) {
request (type = 'browser') {
const anotherType = type === 'browser' ? 'web' : 'browser';
this.anotherTypeOn = this.isFullScreen(anotherType);
if (!this.anotherTypeOn) {
this.lastScrollPosition = utils.getScrollPosition();
}
@ -62,6 +64,10 @@ class FullScreen {
this.player.events.trigger('webfullscreen');
break;
}
if (this.anotherTypeOn) {
this.cancel(anotherType);
}
}
cancel (type = 'browser') {
@ -90,14 +96,7 @@ class FullScreen {
this.cancel(type);
}
else {
const anotherType = type === 'browser' ? 'web' : 'browser';
if (this.isFullScreen(anotherType)) {
this.request(type, true);
this.cancel(anotherType);
}
else {
this.request(type);
}
this.request(type);
}
}
}