windrobin / flashcanvas

Automatically exported from code.google.com/p/flashcanvas
0 stars 0 forks source link

Does not support onMouseMove event - which makes drag and dropping impossible #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a canvas
2. Bind an event handler to the mousemove event for the canvas, e.g.: 

myCanvas.onMouseMove = doSomething()

3. View the canvas and move the mouse

What is the expected output? What do you see instead?
- Expect the doSomething() to fire.

It seem like flashcanvas supports mouse click events, but not mouse move. 

Original issue reported on code.google.com by n321...@gmail.com on 10 Feb 2013 at 5:48

GoogleCodeExporter commented 9 years ago
FlashCanvas supports mousemove event.
Try the following example.

<!DOCTYPE html>
<html>
<head>
<!--[if lt IE 9]><script src="flashcanvas.js"></script><![endif]-->
<script>
var ctx;

window.onload = function() {
    var canvas = document.getElementById("canvas");
    ctx = canvas.getContext("2d");
    canvas.onmousemove = draw;
}

function draw(event) {
    event = event || window.event;
    var x = event.clientX;
    var y = event.clientY;
    ctx.fillStyle = "red";
    ctx.clearRect(0, 0, 600, 400);
    ctx.fillRect(x - 25, y - 25, 50, 50);
}
</script>
</head>
<body>
<canvas id="canvas" width="600" height="400"></canvas>
</body>
</html>

Original comment by revu...@gmail.com on 13 Feb 2013 at 5:25