Added: support for real Fullscreen

This commit is contained in:
djmaze 2021-03-03 11:16:02 +01:00
parent 1a5bc09bb3
commit e770f28949
3 changed files with 31 additions and 32 deletions

View file

@ -217,7 +217,7 @@
border-radius: @rlLowBorderRadius; border-radius: @rlLowBorderRadius;
scroll-behavior: smooth; scroll-behavior: smooth;
.buttonUnFull, .buttonFull { .buttonFull {
display: inline-block; display: inline-block;
position: fixed; position: fixed;
right: 25px; right: 25px;
@ -244,10 +244,6 @@
} }
} }
.buttonUnFull {
display: none;
}
.loading { .loading {
text-align: center; text-align: center;
font-size: 24px; font-size: 24px;
@ -625,12 +621,3 @@ html:not(.rl-mobile) .messageItem {
display: none !important; display: none !important;
} }
} }
html.rl-message-fullscreen .messageItem {
.buttonUnFull {
display: inline-block !important;
}
.buttonFull {
display: none !important;
}
}

View file

@ -15,7 +15,7 @@ import {
MessageSetAction MessageSetAction
} from 'Common/EnumsUser'; } from 'Common/EnumsUser';
import { $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals'; import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals';
import { inFocus } from 'Common/Utils'; import { inFocus } from 'Common/Utils';
import { mailToHelper } from 'Common/UtilsUser'; import { mailToHelper } from 'Common/UtilsUser';
@ -253,7 +253,13 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
} }
}, },
fullScreenMode: value => $htmlCL.toggle('rl-message-fullscreen', value) fullScreenMode: value => {
if (this.oContent) {
value ? this.oContent.requestFullscreen() : doc.exitFullscreen();
} else {
$htmlCL.toggle('rl-message-fullscreen', value);
}
}
}); });
MessageStore.messageViewTrigger.subscribe(() => { MessageStore.messageViewTrigger.subscribe(() => {
@ -319,14 +325,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
return color; return color;
} }
fullScreen() {
this.fullScreenMode(true);
}
unFullScreen() {
this.fullScreenMode(false);
}
toggleFullScreen() { toggleFullScreen() {
try { try {
getSelection().removeAllRanges(); getSelection().removeAllRanges();
@ -403,16 +401,33 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0')); this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'));
this.oHeaderDom = dom.querySelector('.messageItemHeader'); let el = dom.querySelector('.messageItemHeader');
if (this.oHeaderDom) { this.oHeaderDom = el;
if (el) {
if (!this.resizeObserver) { if (!this.resizeObserver) {
this.resizeObserver = new ResizeObserver(this.checkHeaderHeight.debounce(50).bind(this)); this.resizeObserver = new ResizeObserver(this.checkHeaderHeight.debounce(50).bind(this));
} }
this.resizeObserver.observe(this.oHeaderDom); this.resizeObserver.observe(el);
} else if (this.resizeObserver) { } else if (this.resizeObserver) {
this.resizeObserver.disconnect(); this.resizeObserver.disconnect();
} }
let event = 'fullscreenchange';
el = dom.querySelector('.b-message-view-wrapper');
if (!el.requestFullscreen && el.webkitRequestFullscreen) {
el.requestFullscreen = el.webkitRequestFullscreen;
event = 'webkit'+event;
}
if (el.requestFullscreen) {
if (!doc.exitFullscreen && doc.webkitExitFullscreen) {
doc.exitFullscreen = doc.webkitExitFullscreen;
}
this.oContent = el;
el.addEventListener(event, () =>
this.fullScreenMode((doc.fullscreenElement || doc.webkitFullscreenElement) === el)
);
}
const eqs = (ev, s) => ev.target.closestWithin(s, dom); const eqs = (ev, s) => ev.target.closestWithin(s, dom);
dom.addEventListener('click', event => { dom.addEventListener('click', event => {
ThemeStore.isMobile() && leftPanelDisabled(true); ThemeStore.isMobile() && leftPanelDisabled(true);

View file

@ -237,11 +237,8 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div> <div>
<span class="buttonFull" data-bind="click: fullScreen"> <span class="buttonFull" data-bind="click: toggleFullScreen">
<i class="icon-arrows-out"></i> <i data-bind="css: { 'icon-arrows-out': !fullScreenMode(), 'icon-arrows-in': fullScreenMode }"></i>
</span>
<span class="buttonUnFull" data-bind="click: unFullScreen">
<i class="icon-arrows-in"></i>
</span> </span>
<div class="line-loading e-strip-animation" data-bind="visible: messageLoadingThrottle()"></div> <div class="line-loading e-strip-animation" data-bind="visible: messageLoadingThrottle()"></div>