From e5d2237829163a723f2591ba787a5f08ee1f4f5b Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 21 Dec 2013 05:42:26 -0800 Subject: [PATCH] Use floor instead of round for better sub-pixel accuracy. --- jquery.flot.crosshair.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.flot.crosshair.js b/jquery.flot.crosshair.js index 9aaf677..16e321e 100644 --- a/jquery.flot.crosshair.js +++ b/jquery.flot.crosshair.js @@ -147,12 +147,12 @@ The plugin also adds four public methods: ctx.beginPath(); if (c.mode.indexOf("x") != -1) { - var drawX = Math.round(crosshair.x) + adj; + var drawX = Math.floor(crosshair.x) + adj; ctx.moveTo(drawX, 0); ctx.lineTo(drawX, plot.height()); } if (c.mode.indexOf("y") != -1) { - var drawY = Math.round(crosshair.y) + adj; + var drawY = Math.floor(crosshair.y) + adj; ctx.moveTo(0, drawY); ctx.lineTo(plot.width(), drawY); }