Fixed memory leak

The original technique isn't horrible when it happens
once per mouse move but if used once per frame it completely
destroys the browser.

To see the leak in the chrome task manager - furiously move the
mouse and see the top cpu process keep rising in memory usage.
This commit is contained in:
Yuval Greenfield 2012-12-31 23:46:53 +02:00
parent b04eb2b98f
commit 27781d44ac

View file

@ -26,8 +26,8 @@
for (var i = 0; i < size - 1; i++) {
var nextSegment = segments[i + 1];
var position = path.segments[i].point;
var angle = (position - nextSegment.point).angle;
var vector = new Point({ angle: angle, length: 35 });
var vector = position - nextSegment.point;
vector.length = 35;
nextSegment.point = position - vector;
}
path.smooth();
@ -47,4 +47,4 @@
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>
</html>