From: Dan Vanderkam Date: Wed, 18 Jul 2012 15:24:28 +0000 (-0500) Subject: pull out encapsuation breakages X-Git-Tag: v1.0.0~223 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=c560c848f1334c9dadaf5ac7b70dec6f4bd45c00;p=dygraphs.git pull out encapsuation breakages --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 720ab80..a8b9807 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -306,14 +306,18 @@ DygraphCanvasRenderer.prototype._drawSeries = function( ctx.strokeStyle = color; ctx.lineWidth = strokeWidth; - for (var i = iter.start_; i < iter.end_; i++) { - point = iter.array_[i]; - if (iter.predicate_) { - while (i < iter.end_ && !iter.predicate_(iter.array_, i)) { + var arr = iter.array_; + var limit = iter.end_; + var predicate = iter.predicate_; + + for (var i = iter.start_; i < limit; i++) { + point = arr[i]; + if (predicate) { + while (i < limit && !predicate(arr, i)) { i++; } - if (i == iter.end_) break; - point = iter.array_[i]; + if (i == limit) break; + point = arr[i]; } if (point.canvasy === null || point.canvasy != point.canvasy) {