From 9626b1e39db4ae2317f17822332dfcf5d7617343 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 19 Jan 2017 18:02:09 -0800 Subject: [PATCH] Only keep > 0 geometry in CharMeasure Fixes #494 --- src/utils/CharMeasure.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/CharMeasure.ts b/src/utils/CharMeasure.ts index 6ca5046a2c..3344fed2e8 100644 --- a/src/utils/CharMeasure.ts +++ b/src/utils/CharMeasure.ts @@ -44,10 +44,12 @@ export class CharMeasure extends EventEmitter { } private _doMeasure(): void { - const oldWidth = this._width; - const oldHeight = this._height; const geometry = this._measureElement.getBoundingClientRect(); - + // The element is likely currently display:none, we should retain the + // previous value. + if (geometry.width === 0 || geometry.height === 0) { + return; + } if (this._width !== geometry.width || this._height !== geometry.height) { this._width = geometry.width; this._height = geometry.height;