Fix errors in Boolean Operations example.

This commit is contained in:
Jürg Lehni 2015-09-18 17:52:14 +02:00
parent 23443dc8f4
commit 5af391d333

View file

@ -360,10 +360,9 @@
function disperse(path, distance) { function disperse(path, distance) {
distance = distance || 10; distance = distance || 10;
if (! path instanceof CompoundPath || ! path instanceof Group) { return; }
var center = path.bounds.center; var center = path.bounds.center;
var children = path.children, i ,len; var children = path.children, i ,len;
for (var i = 0, len = children.length; i < len; i++) { for (var i = 0, len = children && children.length; i < len; i++) {
var cCenter = children[i].bounds.center; var cCenter = children[i].bounds.center;
var vec = cCenter.subtract(center); var vec = cCenter.subtract(center);
vec = (vec.isClose([0,0], 0.5))? vec : vec.normalize(distance); vec = (vec.isClose([0,0], 0.5))? vec : vec.normalize(distance);