Skip to content

Instantly share code, notes, and snippets.

@dherman
Created July 15, 2012 21:13
Show Gist options
  • Save dherman/3118659 to your computer and use it in GitHub Desktop.
Save dherman/3118659 to your computer and use it in GitHub Desktop.
canvas line connecting compat issue
<!doctype html>
<head>
<title>Canvas Test</title>
<style>
#c {
border: solid 1px black;
}
</style>
</head>
<body>
<canvas id=c width=300 height=300></canvas>
<script>
var cx = document.getElementById('c').getContext('2d');
// Draw two line segments. On Firefox and Safari they
// are connected, but on Chrome they have a missing pixel
// at the corner. What am I missing?
cx.moveTo(100.5, 200.5);
cx.lineTo(200.5, 200.5);
cx.stroke();
cx.moveTo(200.5, 200.5);
cx.lineTo(200.5, 100.5);
cx.stroke();
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment