Respect clip-items in Group#_getBounds()

Closes #956
This commit is contained in:
Jürg Lehni 2016-02-11 12:51:04 +01:00
parent 68c4541844
commit 6797d2eb11

View file

@ -167,6 +167,23 @@ var Group = Item.extend(/** @lends Group# */{
child.setClipMask(clipped);
},
_getBounds: function _getBounds(getter, matrix, cacheItem, internal) {
var clipItem = this._getClipItem(),
// We need to fall-back to bounds getter that do not take stroke
// into account
clipBoundsGetter = {
getStrokeBounds: 'getBounds',
getRoughBounds: 'getHandleBounds',
getInternalRoughBounds: 'getInternalBounds'
};
return clipItem
? clipItem._getCachedBounds(clipBoundsGetter[getter] || getter,
matrix && matrix.appended(clipItem._matrix),
cacheItem, internal)
: _getBounds.base.call(this, getter, matrix, cacheItem,
internal);
},
_hitTestChildren: function _hitTestChildren(point, options) {
var clipItem = this._getClipItem();
return (!clipItem || clipItem.contains(point))