Skip to content

Commit

Permalink
fix another case
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Sep 15, 2023
1 parent 01edba0 commit 6ef18be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/canvas/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,9 @@ export class Canvas extends SelectableCanvas implements CanvasOptions {
const pointer = this.getPointer(e, true);
target =
// first search active objects for a target to remove
this.searchPossibleTargets(prevActiveObjects, pointer) ||
this.findTargetsTraversal(prevActiveObjects, pointer, {
searchStrategy: 'first-hit',
})[0] ||
// if not found, search under active selection for a target to add
// `prevActiveObjects` will be searched but we already know they will not be found
this.searchPossibleTargets(this._objects, pointer);
Expand Down
4 changes: 2 additions & 2 deletions src/canvas/SelectableCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,10 @@ export class SelectableCanvas<EventSpec extends CanvasEvents = CanvasEvents>
}

/**
* Function used to search inside objects an object that contains pointer in bounding box or that contains pointerOnCanvas when painted
* Function used to search objects for a object containing {@link pointer}
* @see {@link findTargetsTraversal}
* @param {FabricObject[]} [objects] objects array to look into
* @param {Object} [pointer] x,y object of point coordinates we want to check.
* @param {Object} [pointer] canvas element plane coordinates to check
* @return {FabricObject} **top most selectable object on screen** that contains {@link pointer}
*/
searchPossibleTargets(
Expand Down

0 comments on commit 6ef18be

Please sign in to comment.