diff --git a/libjx/code/JXHorizPartition.cpp b/libjx/code/JXHorizPartition.cpp index 3f8f0acb9..1ad6d2392 100644 --- a/libjx/code/JXHorizPartition.cpp +++ b/libjx/code/JXHorizPartition.cpp @@ -380,7 +380,8 @@ JXHorizPartition::RunInternalFTC } itsFTCSizes->AppendItem(w); - itsFTCMinSizes->AppendItem(JPartition::GetMinCompartmentSize(i) + delta); + const JCoordinate min = JPartition::GetMinCompartmentSize(i) + delta; + itsFTCMinSizes->AppendItem(delta >= 0 ? min : JMax(w, min)); sum += w; i++; } @@ -433,14 +434,14 @@ JXHorizPartition::FTCAdjustSize if (itsFTCSizes != nullptr) { - SetCompartmentSizes(*itsFTCSizes); - jdelete itsFTCSizes; - itsFTCSizes = nullptr; - SetMinCompartmentSizes(*itsFTCMinSizes); jdelete itsFTCMinSizes; itsFTCMinSizes = nullptr; + SetCompartmentSizes(*itsFTCSizes); + jdelete itsFTCSizes; + itsFTCSizes = nullptr; + if (itsSavedGeom != nullptr) { RestoreGeometry(*itsSavedGeom); diff --git a/libjx/code/JXVertPartition.cpp b/libjx/code/JXVertPartition.cpp index c4256ad6c..f9d602877 100644 --- a/libjx/code/JXVertPartition.cpp +++ b/libjx/code/JXVertPartition.cpp @@ -406,7 +406,8 @@ JXVertPartition::RunInternalFTC } itsFTCSizes->AppendItem(h); - itsFTCMinSizes->AppendItem(JPartition::GetMinCompartmentSize(i) + delta); + const JCoordinate min = JPartition::GetMinCompartmentSize(i) + delta; + itsFTCMinSizes->AppendItem(delta >= 0 ? min : JMax(h, min)); sum += h; i++; } @@ -433,14 +434,14 @@ JXVertPartition::FTCAdjustSize if (itsFTCSizes != nullptr) { - SetCompartmentSizes(*itsFTCSizes); - jdelete itsFTCSizes; - itsFTCSizes = nullptr; - SetMinCompartmentSizes(*itsFTCMinSizes); jdelete itsFTCMinSizes; itsFTCMinSizes = nullptr; + SetCompartmentSizes(*itsFTCSizes); + jdelete itsFTCSizes; + itsFTCSizes = nullptr; + if (itsSavedGeom != nullptr) { RestoreGeometry(*itsSavedGeom);