Skip to content

Commit

Permalink
fix: intersection issue with occlusion generation
Browse files Browse the repository at this point in the history
  • Loading branch information
debanjandhar12 committed Dec 9, 2023
1 parent 274eac7 commit 4d7d730
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ui/customized/OcclusionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,19 @@ const OcclusionEditorComponent : React.FC<{
}
let intersects = false;
for (const obj of fabricRef.current.getObjects()) {
const matrix = obj.calcTransformMatrix();
const objActualTop = matrix[5];
const objActualLeft = matrix[4];
if (doRectsCollide({
top: paragraph.bbox.y0,
left: paragraph.bbox.x0,
width: width,
height: height,
}, {
top: obj.top,
left: obj.left,
width: obj.getScaledWidth(),
height: obj.getScaledHeight(),
top: objActualTop - obj.height * obj.scaleY / 2,
left: objActualLeft - obj.width * obj.scaleX / 2,
width: obj.width * obj.scaleX,
height: obj.height * obj.scaleY,
})) {
intersects = true;
break;
Expand Down

0 comments on commit 4d7d730

Please sign in to comment.