From 6566286e7861b41ee239e263f5e762d69fb0d55a Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 15 Mar 2012 16:46:05 -0600 Subject: [PATCH] fix scrollbar appearing --- track.html | 14 +++++++++++--- track.js | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/track.html b/track.html index ee763e8..ff3ae63 100644 --- a/track.html +++ b/track.html @@ -7,11 +7,19 @@ html { background: black; text-align: center; + color: white; +} +html, body, canvas { + padding: 0; + margin: 0; + border: 0; +} +#debug { + position: absolute; + background-color: rgba(0, 0, 0, 0.7); } - - - +

diff --git a/track.js b/track.js index efafa99..8cd4ce4 100644 --- a/track.js +++ b/track.js @@ -16,7 +16,10 @@ var rp = 1; // Radius of a piece var JAMMER = 0; var PIVOT = 1; -var dragging = false; +function debug(msg) { + var e = document.getElementById("debug"); + e.innerHTML = msg; +} function player(color, type) { var e = document.createElement("canvas"); @@ -38,6 +41,7 @@ function player(color, type) { var x = (evt.pageX - window.innerWidth/2) / scale; var y = (evt.pageY - window.innerHeight/2) / scale; + debug(x + "
" + y); e.moveTo(x, y); } @@ -116,7 +120,9 @@ function start() { canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); - scale = Math.min(window.innerWidth / 100, window.innerHeight / 60); + var win_width = window.innerWidth; + var win_height = window.innerHeight - 5; // FF won't let me use all height + scale = Math.min(win_width / 100, win_height / 60); canvas.width = scale * 100; canvas.height = scale * 60; @@ -191,7 +197,7 @@ function start() { var p = player(team?"#080":"#f0f", pos); if (pos == JAMMER) { - p.moveTo(halflen-30-rp, ri + rp*(5 + 4*team)); + p.moveTo(halflen - 30 - rp, ri + rp*(team*4 + 4)); } else { p.moveTo(halflen-rp - team * (rp*3), ri + rp*(2.5*pos)); }