Fix RigidBody overlap on the right + Add tests
This commit is contained in:
parent
9f9ec8dc65
commit
fa2d8e3e6e
4 changed files with 17994 additions and 445 deletions
|
@ -301,7 +301,7 @@ function getAvailableWidthsTwoLines(
|
|||
|
||||
const isOverlappingOnTheRight = rectRight >= unallocatedSpaceRight;
|
||||
if (isOverlappingOnTheRight) {
|
||||
return getAvailableWidthsRight(unallocatedSpace.x, rectRight);
|
||||
return getAvailableWidthsRight(unallocatedSpace.x, rectX);
|
||||
}
|
||||
|
||||
return getAvailableWidthsMiddle(unallocatedSpace.x, unallocatedSpaceRight, rectX, rectRight);
|
||||
|
@ -320,31 +320,31 @@ function getAvailableWidthsLeft(unallocatedSpaceRight: number, rectRight: number
|
|||
];
|
||||
}
|
||||
|
||||
function getAvailableWidthsRight(unalloctedSpaceX: number, rectRight: number): ISizePointer[] {
|
||||
if (rectRight - unalloctedSpaceX <= 0) {
|
||||
function getAvailableWidthsRight(unallocatedSpaceX: number, rectX: number): ISizePointer[] {
|
||||
if (rectX - unallocatedSpaceX <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
x: unalloctedSpaceX,
|
||||
width: rectRight - unalloctedSpaceX
|
||||
x: unallocatedSpaceX,
|
||||
width: rectX - unallocatedSpaceX
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function getAvailableWidthsMiddle(
|
||||
unalloctedSpaceX: number,
|
||||
unallocatedSpaceX: number,
|
||||
unallocatedSpaceRight: number,
|
||||
rectX: number,
|
||||
rectRight: number
|
||||
): ISizePointer[] {
|
||||
const sizePointers: ISizePointer[] = [];
|
||||
|
||||
if (rectX - unalloctedSpaceX > 0) {
|
||||
if (rectX - unallocatedSpaceX > 0) {
|
||||
sizePointers.push({
|
||||
x: unalloctedSpaceX,
|
||||
width: rectX - unalloctedSpaceX
|
||||
x: unallocatedSpaceX,
|
||||
width: rectX - unallocatedSpaceX
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue