Only keep > 0 geometry in CharMeasure

Fixes #494
This commit is contained in:
Daniel Imms 2017-01-19 18:02:09 -08:00
parent 5bd803382a
commit 9626b1e39d

View File

@ -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;