From 486e7893b37634b0b55246c758a6ea43354f6a84 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sun, 30 Jun 2013 23:03:43 -0400 Subject: [PATCH] light refactoring -- expose public hairlines --- extras/hairlines.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/extras/hairlines.js b/extras/hairlines.js index fb05058..2d72036 100644 --- a/extras/hairlines.js +++ b/extras/hairlines.js @@ -210,7 +210,7 @@ hairlines.prototype.updateHairlineInfo = function() { that.divFiller_(h.infoDiv, { closestRow: row, points: selPoints, - hairline: h, + hairline: that.createPublicHairline_(h), dygraph: g }); } else { @@ -313,6 +313,17 @@ hairlines.prototype.destroy = function() { */ /** + * @param {!Hairline} h Internal hairline. + * @return {!PublicHairline} Restricted public view of the hairline. + */ +hairlines.prototype.createPublicHairline_ = function(h) { + return { + xval: h.xval, + interpolated: h.interpolated + }; +}; + +/** * @return {!Array.} The current set of hairlines, ordered * from back to front. */ @@ -320,10 +331,7 @@ hairlines.prototype.get = function() { var result = []; for (var i = 0; i < this.hairlines_.length; i++) { var h = this.hairlines_[i]; - result.push({ - xval: h.xval, - interpolated: h.interpolated - }); + result.push(this.createPublicHairline_(h)); } return result; }; -- 2.7.4