Fix rigid body in which children thinks there was enough space
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d29d1f5054
commit
286a5e9c00
1 changed files with 21 additions and 6 deletions
|
@ -252,6 +252,9 @@ function getAvailableWidthsTwoLines(
|
||||||
rectLeft: number,
|
rectLeft: number,
|
||||||
rectRight: number
|
rectRight: number
|
||||||
): ISizePointer[] {
|
): ISizePointer[] {
|
||||||
|
// let object 1 be the unallocated space
|
||||||
|
// and object 2 be the rect
|
||||||
|
|
||||||
if (unallocatedSpaceRight < rectLeft ||
|
if (unallocatedSpaceRight < rectLeft ||
|
||||||
unalloctedSpaceLeft > rectRight
|
unalloctedSpaceLeft > rectRight
|
||||||
) {
|
) {
|
||||||
|
@ -269,6 +272,10 @@ function getAvailableWidthsTwoLines(
|
||||||
|
|
||||||
if (unalloctedSpaceLeft >= rectLeft) {
|
if (unalloctedSpaceLeft >= rectLeft) {
|
||||||
// object 2 is partially overlapping on the left
|
// object 2 is partially overlapping on the left
|
||||||
|
if (unallocatedSpaceRight - rectRight <= 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
x: rectRight,
|
x: rectRight,
|
||||||
|
@ -279,6 +286,10 @@ function getAvailableWidthsTwoLines(
|
||||||
|
|
||||||
if (rectRight >= unallocatedSpaceRight) {
|
if (rectRight >= unallocatedSpaceRight) {
|
||||||
// object 2 is partially overlapping on the right
|
// object 2 is partially overlapping on the right
|
||||||
|
if (unalloctedSpaceLeft - rectRight <= 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
x: unalloctedSpaceLeft,
|
x: unalloctedSpaceLeft,
|
||||||
|
@ -288,16 +299,20 @@ function getAvailableWidthsTwoLines(
|
||||||
}
|
}
|
||||||
|
|
||||||
// object 2 is overlapping in the middle
|
// object 2 is overlapping in the middle
|
||||||
return [
|
const sizePointers: ISizePointer[] = [];
|
||||||
{
|
if (rectLeft - unalloctedSpaceLeft > 0) {
|
||||||
|
sizePointers.push({
|
||||||
x: unalloctedSpaceLeft,
|
x: unalloctedSpaceLeft,
|
||||||
width: rectLeft - unalloctedSpaceLeft
|
width: rectLeft - unalloctedSpaceLeft
|
||||||
},
|
});
|
||||||
{
|
}
|
||||||
|
if (unallocatedSpaceRight - rectRight > 0) {
|
||||||
|
sizePointers.push({
|
||||||
x: rectRight,
|
x: rectRight,
|
||||||
width: unallocatedSpaceRight - rectRight
|
width: unallocatedSpaceRight - rectRight
|
||||||
|
});
|
||||||
}
|
}
|
||||||
];
|
return sizePointers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue