webdial

Incomplete JS port of moondial.
git clone https://code.literati.org/webdial.git
Log | Files | Refs

commit 3465a0e213d91dbec820f2ef46912b3cc8325890
parent 034fb507ac2b54cebe4e7fe9663c393b4104aa82
Author: Sean Lynch <seanl@literati.org>
Date:   Wed,  7 Sep 2011 22:11:35 -0700

Try more stuff

Diffstat:
Mwebdial.js | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/webdial.js b/webdial.js @@ -5,11 +5,11 @@ function WebDial(canvas) { var w = canvas.width(); var h = canvas.height(); function lon2x(lon) { - return (lon + 180.0) * w / 360.0; + return Math.round((lon + 180.0) * w / 360.0); } function lat2y(lat) { - return (90.0 - lat) * h / 180.0; + return Math.round((90.0 - lat) * h / 180.0); } var ctx = canvas[0].getContext("2d"); @@ -20,7 +20,7 @@ function WebDial(canvas) { console.debug("Drawing", points.length, "points"); ctx.beginPath(); var lastPoint = points[points.length-1]; - console.debug(lon2x(lastPoint[0]), lat2y(lastPoint[1])); + console.debug(lon2x(lastPoint[1]), lat2y(lastPoint[0])); ctx.moveTo(lon2x(lastPoint[0]), lat2y(lastPoint[1])); $.each(points, function(j, point) { ctx.lineTo(lon2x(point[0]), lat2y(point[1]));