Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup. move canvas stuff to the actual html

  • Loading branch information...
commit 24ea10c85c2237f07a6c410aaa014b607c87797a 1 parent 2b8f838
mpd authored
Showing with 5 additions and 11 deletions.
  1. +1 −0  heatmap.html
  2. +4 −11 heatmap.js
View
1  heatmap.html
@@ -9,6 +9,7 @@
<div id="result_container" style="position: relative;">
<img id="result" src="http://i.imgur.com/T3Zox.jpg" />
+ <canvas id="overlay" style="position: absolute; top: 0; left: 0;"></canvas>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
View
15 heatmap.js
@@ -1,23 +1,17 @@
$(function () {
var heat = {},
- canvas,
- context,
+ canvas = $('#overlay'),
+ context = canvas.get(0).getContext('2d'),
cache = { toHue: {}, hueToRGB: {}},
normalizeHeat,
renderHeat,
toHue,
hueToRGB;
- canvas = $('<canvas id="overlay"></canvas>');
-
- canvas.css({
- position: 'absolute',
- top: 0,
- left: 0
- }).attr({
+ canvas.attr({
width: $('#result').width(),
height: $('#result').height()
- }).appendTo($('#result_container'));
+ });
$('#trackme').mousemove(function (event) {
var key, eventX, eventY, i, j;
@@ -76,7 +70,6 @@ $(function () {
renderHeat = function (heat) {
var x, y, splitArray, rgb;
- context = canvas.get(0).getContext('2d');
$.each(heat, function(key, value) {
splitArray = key.split(',');
Please sign in to comment.
Something went wrong with that request. Please try again.