In the list of breaking changes for fabricjs v2, one of the entries says:
"Click and drag on the canvas creates a rectangular selection. All the bounding boxes intersecting with this rectangle will be selected on mouse up creating a multi selection."
This turns up to be impractical on crowded canvases as it is hard to just select what you want.
Is there a way to only select objects which bounding rectangles are included in (as opposed to intersecting) the selection area?
I checked a bit in rc3 and the following mod does what I want:
I know it is brutal...
And I have no means to know if that breaks other things (at least not yet)
at line 11484 in the _collectObjects() function:
// if (currentObject.intersectsWithRect(selectionX1Y1, selectionX2Y2) ||
// currentObject.isContainedWithinRect(selectionX1Y1, selectionX2Y2) ||
// currentObject.containsPoint(selectionX1Y1) ||
// currentObject.containsPoint(selectionX2Y2)
// ) {
if (
currentObject.isContainedWithinRect(selectionX1Y1, selectionX2Y2)
) {
group.push(currentObject);
// only add one object if it's a click
if (isClick) {
break;
}
}