From 3e7a2164506740266cb1e4b3a74f54176edac5af Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sat, 7 Oct 2017 08:32:02 +0200 Subject: [PATCH] Add TermScreen#backgroundImage --- js/term/screen.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/term/screen.js b/js/term/screen.js index 4a28355..f049049 100644 --- a/js/term/screen.js +++ b/js/term/screen.js @@ -305,6 +305,19 @@ module.exports = class TermScreen extends EventEmitter { this._scheduledSizeUpdate = setTimeout(() => this.updateSize(), 1) } + get backgroundImage () { + return this.canvas.style.backgroundImage + } + + set backgroundImage (value) { + this.canvas.style.backgroundImage = value ? `url(${value})` : '' + if (this.renderer.backgroundImage !== !!value) { + this.renderer.backgroundImage = !!value + this.renderer.resetDrawn() + this.scheduleDraw('background-image') + } + } + /** * Returns a CSS font string with this TermScreen's font settings and the * font modifiers.