From 4924f6f06a7744a97b8e05bde122414bf4afd849 Mon Sep 17 00:00:00 2001 From: Ian Pearce Date: Mon, 6 Oct 2014 03:05:27 +0800 Subject: [PATCH] Slightly DRYer --- CanvasTextWrapper.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CanvasTextWrapper.js b/CanvasTextWrapper.js index d199c59..8a73d3b 100644 --- a/CanvasTextWrapper.js +++ b/CanvasTextWrapper.js @@ -68,13 +68,11 @@ // use previous font size, not the one that broke the while condition this.setFontSize(--fontSize); - var lines = this.getWrappedText(elementWidth); - var textBlockHeight = lines.length * this.lineHeight; - } else { - var lines = this.getWrappedText(elementWidth); - var textBlockHeight = lines.length * this.lineHeight; } + var lines = this.getWrappedText(elementWidth); + var textBlockHeight = lines.length * this.lineHeight; + // set vertical align for the whole text block this.setTextVerticalAlign(textPos, textBlockHeight);