fix tooltips to not go offscreen as often

SVN revision: 79982
This commit is contained in:
Mike Blumenkrantz 2012-12-02 12:41:09 +00:00
parent feac52abde
commit 5446cde267
3 changed files with 23 additions and 4 deletions

View File

@ -734,3 +734,7 @@
2012-11-30 ChunEon Park (Hermet)
* emit the signals for content_set/unset text_set/unset one time!
2012-12-02 Mike Blumenkrantz
* Fix case where tooltips could go offscreen unnecessarily

View File

@ -69,6 +69,7 @@ Fixes:
* Fix the mapbuf to update it's content correcltly evenif they go outside of the buffer.
* Fix the naviframe to resize it's items which are inserted.
* Fix the naviframe to send signal emits one time for content show/hide, text show/hide.
* Fix case where tooltips could go offscreen unnecessarily
Removals:

View File

@ -426,22 +426,36 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
TTDBG("INIT (INTERPRETED)\n");
}
TTDBG("ADJUST (POINTER): tx=%d,ty=%d\n", tx, ty);
if (tx < 0)
if ((tx < 0) || (tx + tw > cw))
{
/* if we're offscreen, try to flip over the Y axis */
if (abs((tx + 2 * tw) - cw) < abs(tx))
if ((tx < 0) && (abs((tx + 2 * tw) - cw) < abs(tx)))
tx += tw;
else if (tx + tw > cw)
{
int test_x = tx - tw;
if ((test_x >= 0) || (tx + tw - cw > abs(test_x)))
tx -= tw;
}
}
else if ((tx > px) && (px > tw))
{
if (tx + tw < cw)
tx += tw;
}
if (ty < 0)
if ((ty < 0) || (ty + th > ch))
{
/* if we're offscreen, try to flip over the X axis */
if (abs((ty + 2 * th) - ch) < abs(ty))
if ((ty < 0) && (abs((ty + 2 * th) - ch) < abs(ty)))
ty += th;
else if (ty + th > ch)
{
int test_y = ty - th;
if ((test_y >= 0) || (ty + th - ch > abs(test_y)))
ty -= th;
}
}
else if ((ty > py) && (py > th))
{