Skip to content

Commit

Permalink
Tried to add compatibility to IE
Browse files Browse the repository at this point in the history
  • Loading branch information
hrj committed Jul 28, 2010
1 parent 56c3eea commit d18016f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 37 deletions.
3 changes: 3 additions & 0 deletions blank.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 37 additions & 36 deletions demos/demos.js
Expand Up @@ -126,42 +126,43 @@ jQuery(window).load(function() {

// the first call initialises the svg
// the second call fetches the handle
canvasElm.svg();
ctx = canvasElm.svg('get');

// ctx = {'svg':svgContext, 'buffers' : []};
// initBuffers(svgContext);

function clickPoint(event) {
return {
x: event.pageX || (event.clientX +
(document.documentElement.scrollLeft || document.body.scrollLeft)),
y: event.pageY || (event.clientY +
(document.documentElement.scrollTop || document.body.scrollTop))
};
};

jQuery('#canvas').click(function(e) {
var position = clickPoint(e);
if (Math.random() < 0.5)
demos.top.createBall(world, position.x - canvasLeft, position.y - canvasTop);
else
createBox(world, position.x - canvasLeft, position.y - canvasTop, 10, 10, false);

e.stopPropagation();
return false;
}).dblclick(function(e) {e.stopPropagation();});

jQuery(window).keypress(function(e) {
if (e.altKey || e.ctrlKey) {
return
}
missedFrames = 11;
ctx.clear();
canvasElm.svg({'onLoad':function() {
ctx = canvasElm.svg('get');

// ctx = {'svg':svgContext, 'buffers' : []};
// initBuffers(svgContext);
setupPrevWorld();
return false;
});

step();
function clickPoint(event) {
return {
x: event.pageX || (event.clientX +
(document.documentElement.scrollLeft || document.body.scrollLeft)),
y: event.pageY || (event.clientY +
(document.documentElement.scrollTop || document.body.scrollTop))
};
};

jQuery('#canvas').click(function(e) {
var position = clickPoint(e);
if (Math.random() < 0.5)
demos.top.createBall(world, position.x - canvasLeft, position.y - canvasTop);
else
createBox(world, position.x - canvasLeft, position.y - canvasTop, 10, 10, false);

e.stopPropagation();
return false;
}).dblclick(function(e) {e.stopPropagation();});

jQuery(window).keypress(function(e) {
if (e.altKey || e.ctrlKey) {
return
}
missedFrames = 11;
ctx.clear();
// initBuffers(svgContext);
setupPrevWorld();
return false;
});

step();
}});
});
1 change: 0 additions & 1 deletion index.html
Expand Up @@ -9,7 +9,6 @@
<!-- START -->
<!--=============================-->
<!-- libs -->
<!--[if IE]><script type="text/javascript" src="lib/excanvas.js"></script><![endif]-->
<!--script src="lib/prototype-1.6.0.2.js"></script-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" ></script>
<script type="text/javascript">
Expand Down

0 comments on commit d18016f

Please sign in to comment.