Fix #7181. The active set solver can only handle positive values and the offset was not added everywhere.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40497 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-02-14 21:45:44 +00:00
parent ea23d8ecd6
commit 13a19d84df
3 changed files with 11 additions and 9 deletions
@@ -467,14 +467,14 @@ Tab::~Tab()
float
Tab::Position() const
{
return (float)fVariable->Value();
return (float)fVariable->Value() - kMakePositiveOffset;
}
void
Tab::SetPosition(float position)
{
fVariable->SetValue(position);
fVariable->SetValue(position + kMakePositiveOffset);
}
@@ -86,6 +86,10 @@ class SATGroup;
typedef BObjectList<Crossing> CrossingList;
// make all coordinates positive needed for the solver
const float kMakePositiveOffset = 5000;
class Tab : public BReferenceable {
public:
enum orientation_t
@@ -57,9 +57,6 @@ GroupCookie::~GroupCookie()
}
const float kBigOffset = 5000;
void
GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
{
@@ -68,7 +65,7 @@ GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
BRect frame = triggerWindow->CompleteWindowFrame();
// Make it also work for solver which don't support negative variables
frame.OffsetBy(kBigOffset, kBigOffset);
frame.OffsetBy(kMakePositiveOffset, kMakePositiveOffset);
// adjust window size soft constraints
fWidthConstraint->SetRightSide(frame.Width());
@@ -122,9 +119,10 @@ GroupCookie::MoveWindow(int32 workspace)
Desktop* desktop = window->Desktop();
BRect frame = fSATWindow->CompleteWindowFrame();
BRect frameSAT(fLeftBorder->Value() - kBigOffset,
fTopBorder->Value() - kBigOffset, fRightBorder->Value() - kBigOffset,
fBottomBorder->Value() - kBigOffset);
BRect frameSAT(fLeftBorder->Value() - kMakePositiveOffset,
fTopBorder->Value() - kMakePositiveOffset,
fRightBorder->Value() - kMakePositiveOffset,
fBottomBorder->Value() - kMakePositiveOffset);
desktop->MoveWindowBy(window, round(frameSAT.left - frame.left),
round(frameSAT.top - frame.top), workspace);