|
|
@ -523,7 +523,7 @@ window.TermScreen = class TermScreen { |
|
|
|
* Updates the canvas size if it changed |
|
|
|
* Updates the canvas size if it changed |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
updateSize () { |
|
|
|
updateSize () { |
|
|
|
this._window.devicePixelRatio = window.devicePixelRatio || 1 |
|
|
|
this._window.devicePixelRatio = this._windowScale * (window.devicePixelRatio || 1) |
|
|
|
|
|
|
|
|
|
|
|
let didChange = false |
|
|
|
let didChange = false |
|
|
|
for (let key in this.windowState) { |
|
|
|
for (let key in this.windowState) { |
|
|
@ -537,7 +537,6 @@ window.TermScreen = class TermScreen { |
|
|
|
const { |
|
|
|
const { |
|
|
|
width, |
|
|
|
width, |
|
|
|
height, |
|
|
|
height, |
|
|
|
devicePixelRatio, |
|
|
|
|
|
|
|
gridScaleX, |
|
|
|
gridScaleX, |
|
|
|
gridScaleY, |
|
|
|
gridScaleY, |
|
|
|
fitIntoWidth, |
|
|
|
fitIntoWidth, |
|
|
@ -550,7 +549,6 @@ window.TermScreen = class TermScreen { |
|
|
|
let realHeight = height * cellSize.height |
|
|
|
let realHeight = height * cellSize.height |
|
|
|
|
|
|
|
|
|
|
|
if (fitIntoWidth && fitIntoHeight) { |
|
|
|
if (fitIntoWidth && fitIntoHeight) { |
|
|
|
if (realWidth > fitIntoWidth || realHeight > fitIntoHeight) { |
|
|
|
|
|
|
|
let terminalAspect = realWidth / realHeight |
|
|
|
let terminalAspect = realWidth / realHeight |
|
|
|
let fitAspect = fitIntoWidth / fitIntoHeight |
|
|
|
let fitAspect = fitIntoWidth / fitIntoHeight |
|
|
|
|
|
|
|
|
|
|
@ -563,11 +561,10 @@ window.TermScreen = class TermScreen { |
|
|
|
realWidth = fitIntoWidth |
|
|
|
realWidth = fitIntoWidth |
|
|
|
realHeight = realWidth / terminalAspect |
|
|
|
realHeight = realWidth / terminalAspect |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (fitIntoWidth) { |
|
|
|
} else if (fitIntoWidth && realWidth > fitIntoWidth) { |
|
|
|
|
|
|
|
realHeight = fitIntoWidth / (realWidth / realHeight) |
|
|
|
realHeight = fitIntoWidth / (realWidth / realHeight) |
|
|
|
realWidth = fitIntoWidth |
|
|
|
realWidth = fitIntoWidth |
|
|
|
} else if (fitIntoHeight && realHeight > fitIntoHeight) { |
|
|
|
} else if (fitIntoHeight) { |
|
|
|
realWidth = fitIntoHeight * (realWidth / realHeight) |
|
|
|
realWidth = fitIntoHeight * (realWidth / realHeight) |
|
|
|
realHeight = fitIntoHeight |
|
|
|
realHeight = fitIntoHeight |
|
|
|
} |
|
|
|
} |
|
|
@ -575,6 +572,8 @@ window.TermScreen = class TermScreen { |
|
|
|
// store new window scale
|
|
|
|
// store new window scale
|
|
|
|
this._windowScale = realWidth / (width * cellSize.width) |
|
|
|
this._windowScale = realWidth / (width * cellSize.width) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let devicePixelRatio = this._window.devicePixelRatio = this._windowScale * window.devicePixelRatio |
|
|
|
|
|
|
|
|
|
|
|
this.canvas.width = width * devicePixelRatio * cellSize.width |
|
|
|
this.canvas.width = width * devicePixelRatio * cellSize.width |
|
|
|
this.canvas.style.width = `${realWidth}px` |
|
|
|
this.canvas.style.width = `${realWidth}px` |
|
|
|
this.canvas.height = height * devicePixelRatio * cellSize.height |
|
|
|
this.canvas.height = height * devicePixelRatio * cellSize.height |
|
|
|