Skip to content

Commit

Permalink
#4902 - updated closest logic to grab items under images easily
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-sloboda committed Jul 12, 2024
1 parent 68b9cf5 commit 0c137fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/ketcher-react/src/script/editor/shared/closest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,13 @@ function findClosestRasterImage(
if (acc && acc.dist < distanceToPoint) {
return acc;
}
return { id, dist: distanceToPoint };
// We would like to grab items under the images and those items should have higher priority then images
// So we wanna make sure that those items can be grabbed without pixel-perfect pixel-hunting
const dist = Math.min(
distanceToPoint,
SELECTION_DISTANCE_COEFFICIENT / 3,
);
return { id, dist };
}
return acc;
},
Expand Down

0 comments on commit 0c137fd

Please sign in to comment.