Make fullscreen mode work again

pull/1/head
cpsdqs 7 years ago
parent 50913f3331
commit 4547ea668a
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 28
      js/term/index.js

@ -138,28 +138,28 @@ module.exports = function (opts) {
let isFullscreen = false let isFullscreen = false
let properFullscreen = false let properFullscreen = false
let fitScreen = false let fitScreen = false
let screenPadding = screen.window.padding let screenPadding = screen.layout.window.padding
let fitScreenIfNeeded = function fitScreenIfNeeded () { let fitScreenIfNeeded = function fitScreenIfNeeded () {
if (isFullscreen) { if (isFullscreen) {
fullscreenIcon.className = 'icn-resize-small' fullscreenIcon.className = 'icn-resize-small'
if (properFullscreen) { if (properFullscreen) {
screen.window.fitIntoWidth = window.screen.width screen.layout.window.fitIntoWidth = window.screen.width
screen.window.fitIntoHeight = window.screen.height screen.layout.window.fitIntoHeight = window.screen.height
screen.window.padding = 0 screen.layout.window.padding = 0
} else { } else {
screen.window.fitIntoWidth = window.innerWidth screen.layout.window.fitIntoWidth = window.innerWidth
if (qs('#term-nav').classList.contains('hidden')) { if (qs('#term-nav').classList.contains('hidden')) {
screen.window.fitIntoHeight = window.innerHeight screen.layout.window.fitIntoHeight = window.innerHeight
} else { } else {
screen.window.fitIntoHeight = window.innerHeight - 24 screen.layout.window.fitIntoHeight = window.innerHeight - 24
} }
screen.window.padding = 0 screen.layout.window.padding = 0
} }
} else { } else {
fullscreenIcon.className = 'icn-resize-full' fullscreenIcon.className = 'icn-resize-full'
screen.window.fitIntoWidth = fitScreen ? window.innerWidth - 4 : 0 screen.layout.window.fitIntoWidth = fitScreen ? window.innerWidth - 4 : 0
screen.window.fitIntoHeight = fitScreen ? window.innerHeight : 0 screen.layout.window.fitIntoHeight = fitScreen ? window.innerHeight : 0
screen.window.padding = screenPadding screen.layout.window.padding = screenPadding
} }
} }
fitScreenIfNeeded() fitScreenIfNeeded()
@ -213,11 +213,11 @@ module.exports = function (opts) {
isFullscreen = true isFullscreen = true
fitScreenIfNeeded() fitScreenIfNeeded()
screen.updateSize() screen.layout.updateSize()
if (properFullscreen) { if (properFullscreen) {
if (screen.canvas.requestFullscreen) screen.canvas.requestFullscreen() if (screen.layout.canvas.requestFullscreen) screen.layout.canvas.requestFullscreen()
else screen.canvas.webkitRequestFullscreen() else screen.layout.canvas.webkitRequestFullscreen()
} else { } else {
document.body.classList.add('pseudo-fullscreen') document.body.classList.add('pseudo-fullscreen')
} }

Loading…
Cancel
Save