mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Wrote failing test for strokeBounds on paths with a single segment and strokeColor. Implemented fix for failing test.
This commit is contained in:
parent
758c9b6146
commit
73b1b9843a
2 changed files with 13 additions and 1 deletions
|
@ -2672,7 +2672,11 @@ statics: {
|
|||
// Calculate the corner points of butt and square caps
|
||||
var point = segment._point,
|
||||
loc = segment.getLocation(),
|
||||
normal = loc.getNormal().normalize(radius);
|
||||
normal;
|
||||
if (!loc) {
|
||||
return;
|
||||
}
|
||||
normal = loc.getNormal().normalize(radius);
|
||||
if (area) {
|
||||
addPoint(point.subtract(normal));
|
||||
addPoint(point.add(normal));
|
||||
|
|
|
@ -74,6 +74,14 @@ test('path.strokeBounds on path without stroke', function() {
|
|||
compareRectangles(path.strokeBounds, { x: 121, y: 275.068, width: 149.49305, height: 145.87682 });
|
||||
});
|
||||
|
||||
test('path.strokeBounds on path with single segment and stroke color', function() {
|
||||
var path = new Path([
|
||||
new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625))
|
||||
]);
|
||||
path.style.strokeColor = 'black';
|
||||
compareRectangles(path.strokeBounds, { x: 121, y: 334, width: 0, height: 0 });
|
||||
});
|
||||
|
||||
test('path.bounds & path.strokeBounds with stroke styles', function() {
|
||||
function makePath() {
|
||||
var path = new Path();
|
||||
|
|
Loading…
Reference in a new issue