Skip to content

Instantly share code, notes, and snippets.

@xrmx
Created April 13, 2012 15:47
Show Gist options
  • Save xrmx/2377835 to your computer and use it in GitHub Desktop.
Save xrmx/2377835 to your computer and use it in GitHub Desktop.
ocanvas missing onmouseenter event with filled arc
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ocanvas.org/source/ocanvas-2.1.0.js"></script>
<script>
$(document).ready(function() {
var canvas = oCanvas.create({
canvas: '#foo'
});
var arc = canvas.display.arc({
x: canvas.width / 2,
y: canvas.height / 2,
radius: 10,
start: 0,
end: 360,
fill: '#f00'
});
canvas.addChild(arc);
var arc2 = canvas.display.arc({
x: canvas.width / 2 + 20,
y: canvas.height / 2 + 20,
radius: 5,
start: 0,
end: 360,
stroke: '10px #0cf'
});
canvas.addChild(arc2);
arc.bind('mouseenter', function() {
$('p').append("mousenter!");
});
arc2.bind('mouseenter', function() {
$('p').append("mousenter2!");
});
});
</script>
</head>
<body>
<canvas id="foo" width="100" height="100" style="background-color: #000"></canvas>
<p></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment