option.tolerance should always be defined in _hitTest()

This commit is contained in:
Jürg Lehni 2013-10-29 21:00:17 +01:00
parent ae4ddaeae5
commit f8d960d834
3 changed files with 3 additions and 4 deletions

View file

@ -1489,7 +1489,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
// this item does not have children, since we'd have to travel up the
// chain already to determine the rough bounds.
if (!this._children && !this.getRoughBounds()
.expand(options.tolerance)._containsPoint(point))
.expand(2 * options.tolerance)._containsPoint(point))
return null;
// Transform point to local coordinates but use untransformed point
// for bounds check above.

View file

@ -277,8 +277,7 @@ new function() { // Scope for _contains() and _hitTest() code.
if (this.hasStroke()) {
var shape = this._shape,
radius = this._radius,
strokeWidth = this.getStrokeWidth()
+ 2 * (options.tolerance || 0);
strokeWidth = this.getStrokeWidth() + 2 * options.tolerance;
switch (shape) {
case 'rectangle':
var center = getCornerCenter(this, point, strokeWidth);

View file

@ -1731,7 +1731,7 @@ var Path = PathItem.extend(/** @lends Path# */{
var style = this.getStyle(),
segments = this._segments,
closed = this._closed,
tolerance = options.tolerance || 0,
tolerance = options.tolerance,
radius = 0, join, cap, miterLimit,
that = this,
area, loc, res;