diff --git a/core/display.js b/core/display.js index 5eab7969ba478dcaa0e63d278d1bf743dff54a73..8da80317f9edfab6e0b92e67ed9a8b953df430f1 100644 --- a/core/display.js +++ b/core/display.js @@ -602,8 +602,14 @@ // style width to a number, the canvas is cleared. // However, if you set the style width to a string // ('NNNpx'), the canvas is scaled without clearing. - this._target.style.width = Math.round(factor * vp.w) + 'px'; - this._target.style.height = Math.round(factor * vp.h) + 'px'; + var width = Math.round(factor * vp.w) + 'px'; + var height = Math.round(factor * vp.h) + 'px'; + + if ((this._target.style.width !== width) || + (this._target.style.height !== height)) { + this._target.style.width = width; + this._target.style.height = height; + } }, _setFillColor: function (color) {