Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created June 24, 2012 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/2981255 to your computer and use it in GitHub Desktop.
Save roundrobin/2981255 to your computer and use it in GitHub Desktop.
just another inlet to tributary
g.attr('id','canvas')
var numberOfRects = 1;
var drawSomething = function(d,i){
d3.event.preventDefault();
var touches = d3.svg.touches(this);
var x = d3.svg.mouse(this)[0];
var y = d3.svg.mouse(this)[1];
console.log(touches);
g.append('rect')
.attr('width',10)
.attr('height',10)
.attr('fill','red')
.attr('x',x)
.attr('y',y)
}
g.append('rect')
.attr('width',100)
.attr('height',100)
d3.select('#canvas')
.on("touchmove",drawSomething)
.on("mousemove",drawSomething)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment