Team:StuyGem NYC

From 2014hs.igem.org

(Difference between revisions)
Line 201: Line 201:
-
  function getMousePos(canvas, evt) {
+
function getMousePos(canvas, evt) {
-
var rect = canvas.getBoundingClientRect();
+
        var rect = canvas.getBoundingClientRect();
-
return {
+
        return {
-
  x: evt.clientX - rect.left,
+
          x: evt.clientX - rect.left,
-
  y: evt.clientY - rect.top
+
          y: evt.clientY - rect.top
-
};
+
        };
-
  }
+
      }
  canvas.addEventListener('mousemove', function(evt){
  canvas.addEventListener('mousemove', function(evt){
  var mousePos = getMousePos(canvas, evt);
  var mousePos = getMousePos(canvas, evt);
-
                 if ((mousePos.x < 250) && (mousePos.y < 250)) {
+
                 if ((parseInt(mousePos.x) < 250) && (parseInt(mousePos.y) < 250)) {
                 imageObj.src = 'https://static.igem.org/mediawiki/2014hs/4/42/TeamOn.png';
                 imageObj.src = 'https://static.igem.org/mediawiki/2014hs/4/42/TeamOn.png';
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/7/79/Parts.png';
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/7/79/Parts.png';

Revision as of 03:34, 18 April 2014


StuyGem NYC





Get in touch!

Visit Our Twitter Page!