Update Circles example.

This commit is contained in:
Jonathan Puckey 2011-04-23 16:30:29 +02:00
parent 29e27c932e
commit 38a1ce0b6a

View file

@ -6,13 +6,21 @@
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
// All newly created items will receive
// these style properties:
document.currentStyle = {
fillColor: 'white',
strokeColor: 'black'
};
var path;
function onMouseDrag(event) {
if (path) path.remove();
var distance = (event.downPoint - event.point).length;
path = new Path.Circle(event.downPoint, distance);
path.strokeColor = 'black';
path.fillColor = 'white';
// The radius is the distance between the position
// where the user clicked and the current position
// of the mouse.
var radius = (event.downPoint - event.point).length;
path = new Path.Circle(event.downPoint, radius);
};
function onMouseUp(event) {