Author: igel457
New Revision: 31407
URL: http://www.egroupware.org/viewvc/egroupware?rev=31407&view=rev
Log:
Made tooltip positioning code work better
Modified:
branches/etemplate2/etemplate/js/widgets.js
Modified: branches/etemplate2/etemplate/js/widgets.js
URL: http://www.egroupware.org/viewvc/egroupware/branches/etemplate2/etemplate/js/widgets.js?rev=31407&r1=31406&r2=31407&view=diff
— branches/etemplate2/etemplate/js/widgets.js (original)
+++ branches/etemplate2/etemplate/js/widgets.js Tue Jul 13 14:48:42 2010
@@ -277,9 +277,50 @@
{
if (this.tooltip_div)
{
-
//Calculate the cursor_rectangle - this is a space the tooltip might -
//not overlap with -
var cursor_rect = { -
left: (this.x - 8), -
top: (this.y - 8), -
right: (this.x + 8), -
bottom: (this.y + 8) -
}; -
//Calculate how much space is left on each side of the rectangle -
var window_width = $(document).width(); -
var window_height = $(document).height(); -
var space_left = { -
left: (cursor_rect.left), -
top: (cursor_rect.top), -
right: (window_width - cursor_rect.right), -
bottom: (window_height - cursor_rect.bottom) -
}; -
//Get the width and the height of the tooltip -
var tooltip_width = this.tooltip_div.width(); -
if (tooltip_width > 300) tooltip_width = 300; -
var tooltip_height = this.tooltip_div.height(); -
if (space_left.right < tooltip_width) { -
this.tooltip_div.css('left', cursor_rect.left - tooltip_width); -
} else if (space_left.left >= tooltip_width) { -
this.tooltip_div.css('left', cursor_rect.right); -
} else { -
this.tooltip_div.css('left', cursor_rect.right); -
this.tooltip_div.css('max-width', space_left.right); -
} -
if (space_left.bottom < tooltip_height) { -
this.tooltip_div.css('top', cursor_rect.top - tooltip_height); -
} else if (space_left.top >= tooltip_height) { -
this.tooltip_div.css('top', cursor_rect.bottom); -
} else { -
this.tooltip_div.css('top', cursor_rect.bottom); -
this.tooltip_div.css('max-height', space_left.bottom); -
} -
this.tooltip_div.fadeIn(100);
-
this.tooltip_div.css('left', (this.x + 8) + 'px'); -
}this.tooltip_div.css('top', (this.y + 8) + 'px');
}
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first – http://p.sf.net/sfu/sprint-com-first
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs