Tooltip noisy assert


#1

Hi !

When my software create very big tooltip
it throw some noisy jlimit assertion at juce_TooltipWindow.cpp line 100.

 jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..[/code]

Reproduced with last Juce version built with Visual Studio 2010.
Running on Window 7 64bit with dual screen configuration with possible negative screen coordinate.

To correct this issue i've changed the following code:
[code]    x = jlimit (parentArea.getX(), parentArea.getRight()  - w, x);
    y = jlimit (parentArea.getY(), parentArea.getBottom() - h, y);

By this one:

[code] int lowLimit = parentArea.getX();
int highLimit = parentArea.getRight() - w;
if (highLimit < lowLimit)
std::swap (lowLimit, highLimit);
x = jlimit (lowLimit, highLimit, x);

lowLimit = parentArea.getY();
highLimit = parentArea.getBottom() - h;
if (highLimit < lowLimit)
  std::swap (lowLimit, highLimit);
y = jlimit (lowLimit, highLimit, y);[/code]

Hope this can help.

Thanks in advance for your concern about this issue.


#2

Thanks Alex, I’ve tidied that up now, so it shouldn’t bother you again.


#3

Your nicer fix solves my problem perfectly.

Thanks again for your reactivity.