limit corner radius

This commit is contained in:
lavrton
2015-01-22 15:46:53 +07:00
parent eba941e1c3
commit 4dfc65dba4
5 changed files with 45 additions and 17 deletions

View File

@@ -41,6 +41,7 @@
}
else {
// arcTo would be nicer, but browser support is patchy (Opera)
cornerRadius = Math.min(cornerRadius, width / 2, height / 2);
context.moveTo(cornerRadius, 0);
context.lineTo(width - cornerRadius, 0);
context.arc(width - cornerRadius, cornerRadius, cornerRadius, Math.PI * 3 / 2, 0, false);