Implement Item#controlBounds and Path#controlBounds, and test it in StrokeBounds example. This is a first step towards fast hit-testing.

This commit is contained in:
Jürg Lehni 2011-07-01 12:51:18 +02:00
parent ee23877fd1
commit 9fa51a0457
3 changed files with 45 additions and 7 deletions
examples/Scripts

View file

@ -23,7 +23,6 @@
}
var path = makePath();
path.fullySelected = true;
path.strokeColor = 'black';
path.strokeCap = 'butt';
path.strokeJoin = 'round';
@ -70,6 +69,7 @@
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
path.fullySelected = true;
path.scale(1.5, new Point(300, 0));
var rect = new Path.Rectangle(path.strokeBounds);
rect.strokeWidth = 0.25;
@ -79,6 +79,11 @@
rect.strokeWidth = 0.25;
rect.strokeColor = 'red';
rect.fillColor = null;
console.log(path.controlBounds);
var rect = new Path.Rectangle(path.controlBounds);
rect.strokeWidth = 0.25;
rect.strokeColor = 'green';
rect.fillColor = null;
}
project.activeLayer.position = view.center;