Skip to content

Commit f8d960d

Browse files
committed
option.tolerance should always be defined in _hitTest()
1 parent ae4ddae commit f8d960d

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/item/Item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
14891489
// this item does not have children, since we'd have to travel up the
14901490
// chain already to determine the rough bounds.
14911491
if (!this._children && !this.getRoughBounds()
1492-
.expand(options.tolerance)._containsPoint(point))
1492+
.expand(2 * options.tolerance)._containsPoint(point))
14931493
return null;
14941494
// Transform point to local coordinates but use untransformed point
14951495
// for bounds check above.

src/item/Shape.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ new function() { // Scope for _contains() and _hitTest() code.
277277
if (this.hasStroke()) {
278278
var shape = this._shape,
279279
radius = this._radius,
280-
strokeWidth = this.getStrokeWidth()
281-
+ 2 * (options.tolerance || 0);
280+
strokeWidth = this.getStrokeWidth() + 2 * options.tolerance;
282281
switch (shape) {
283282
case 'rectangle':
284283
var center = getCornerCenter(this, point, strokeWidth);

src/path/Path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ var Path = PathItem.extend(/** @lends Path# */{
17311731
var style = this.getStyle(),
17321732
segments = this._segments,
17331733
closed = this._closed,
1734-
tolerance = options.tolerance || 0,
1734+
tolerance = options.tolerance,
17351735
radius = 0, join, cap, miterLimit,
17361736
that = this,
17371737
area, loc, res;

0 commit comments

Comments
 (0)