mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-06-09 11:40:43 -04:00
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:
parent
ee23877fd1
commit
9fa51a0457
3 changed files with 45 additions and 7 deletions
examples/Scripts
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue