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