Fix rigid body in which children thinks there was enough space
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Eric NGUYEN 2022-08-17 15:12:38 +02:00
parent d29d1f5054
commit 286a5e9c00

View file

@ -252,6 +252,9 @@ function getAvailableWidthsTwoLines(
rectLeft: number,
rectRight: number
): ISizePointer[] {
// let object 1 be the unallocated space
// and object 2 be the rect
if (unallocatedSpaceRight < rectLeft ||
unalloctedSpaceLeft > rectRight
) {
@ -269,6 +272,10 @@ function getAvailableWidthsTwoLines(
if (unalloctedSpaceLeft >= rectLeft) {
// object 2 is partially overlapping on the left
if (unallocatedSpaceRight - rectRight <= 0) {
return [];
}
return [
{
x: rectRight,
@ -279,6 +286,10 @@ function getAvailableWidthsTwoLines(
if (rectRight >= unallocatedSpaceRight) {
// object 2 is partially overlapping on the right
if (unalloctedSpaceLeft - rectRight <= 0) {
return [];
}
return [
{
x: unalloctedSpaceLeft,
@ -288,16 +299,20 @@ function getAvailableWidthsTwoLines(
}
// object 2 is overlapping in the middle
return [
{
const sizePointers: ISizePointer[] = [];
if (rectLeft - unalloctedSpaceLeft > 0) {
sizePointers.push({
x: unalloctedSpaceLeft,
width: rectLeft - unalloctedSpaceLeft
},
{
});
}
if (unallocatedSpaceRight - rectRight > 0) {
sizePointers.push({
x: rectRight,
width: unallocatedSpaceRight - rectRight
}
];
});
}
return sizePointers;
}
/**