Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup

  • Loading branch information...
commit d29a93706af71bc68b1eff97f7e800cba8fc44eb 1 parent 57b36ad
mpd authored
Showing with 7 additions and 17 deletions.
  1. +6 −15 heatmap.js
  2. +1 −2  render_worker.js
View
21 heatmap.js
@@ -5,12 +5,10 @@ $(function () {
canvasHeight,
context = canvas.get(0).getContext('2d'),
cache = { toHue: {}, hueToRGB: {} },
- normalizeHeat,
- smoothHeat,
renderHeat,
toHue,
hueToRGB,
- heatMask,
+ mousemoveMask,
clickMask,
applyMask,
worker,
@@ -25,7 +23,7 @@ $(function () {
};
// mask we apply to a point that is moused over.
- heatMask = [
+ mousemoveMask = [
[0, 1, 0],
[1, 3, 1],
[0, 1, 0]
@@ -49,10 +47,9 @@ $(function () {
canvasHeight = canvas.attr('height');
applyMask = function (mask, eventX, eventY) {
- var key, i, j, initialI, initialJ,
- maskSeg;
+ var key, i, j, initialI, initialJ, maskSeg;
- // mask segment size: (length - 1) / 2, length should be odd
+ // mask segment size: truncation of length / 2; length should be odd
maskSeg = Math.floor(mask.length / 2);
initialI = eventX - maskSeg;
@@ -76,15 +73,9 @@ $(function () {
};
$('#trackme').click(function (event) {
- var eventX, eventY;
- eventX = event.pageX - this.offsetLeft;
- eventY = event.pageY - this.offsetTop;
- applyMask(clickMask, eventX, eventY);
+ applyMask(clickMask, event.pageX - this.offsetLeft, event.pageY - this.offsetTop);
}).mousemove(function (event) {
- var eventX, eventY;
- eventX = event.pageX - this.offsetLeft;
- eventY = event.pageY - this.offsetTop;
- applyMask(heatMask, eventX, eventY);
+ applyMask(mousemoveMask, event.pageX - this.offsetLeft, event.pageY - this.offsetTop);
});
renderHeat = function (heat) {
View
3  render_worker.js
@@ -23,7 +23,7 @@
];
/*
- * smooth out the edges with a gaussian blur
+ * smooth out the edges with a (pseudo) gaussian blur
* kernel taken from http://www.bv2.co.uk/?p=511
* so I don't have to tool around with that right now.
* replace with your own at your leisure.
@@ -106,7 +106,6 @@
for (key in heat) {
normalizedHeat[key] = Math.floor(255 * ((heat[key] - minHeat) / denominator));
-
}
return normalizedHeat;
Please sign in to comment.
Something went wrong with that request. Please try again.