fix tooltip so it does not get cut off by tree
This commit is contained in:
@@ -19,8 +19,12 @@
|
||||
|
||||
function setTooltipPosition(event) {
|
||||
|
||||
var viewportWidth = null;
|
||||
var viewportHeight = null;
|
||||
var container = $("#contentwrapper");
|
||||
var containerLeft = container[0].offsetLeft;
|
||||
var containerRight = containerLeft + container[0].offsetWidth;
|
||||
var containerTop = container[0].offsetTop;
|
||||
var containerBottom = containerTop + container[0].offsetHeight;
|
||||
|
||||
var elementHeight = null;
|
||||
var elementWidth = null;
|
||||
|
||||
@@ -31,10 +35,6 @@
|
||||
bottom: "inherit"
|
||||
};
|
||||
|
||||
// viewport size
|
||||
viewportWidth = $(window).innerWidth();
|
||||
viewportHeight = $(window).innerHeight();
|
||||
|
||||
// element size
|
||||
elementHeight = el.context.clientHeight;
|
||||
elementWidth = el.context.clientWidth;
|
||||
@@ -44,19 +44,33 @@
|
||||
|
||||
// check to see if element is outside screen
|
||||
// outside right
|
||||
if (position.left + elementWidth > viewportWidth) {
|
||||
position.right = 0;
|
||||
if (position.left + elementWidth > containerRight) {
|
||||
position.right = 10;
|
||||
position.left = "inherit";
|
||||
}
|
||||
|
||||
// outside bottom
|
||||
if (position.top + elementHeight > viewportHeight) {
|
||||
position.bottom = 0;
|
||||
if (position.top + elementHeight > containerBottom) {
|
||||
position.bottom = 10;
|
||||
position.top = "inherit";
|
||||
}
|
||||
|
||||
// outside left
|
||||
if (position.left < containerLeft) {
|
||||
position.left = containerLeft + 10;
|
||||
position.right = "inherit";
|
||||
}
|
||||
|
||||
// outside top
|
||||
if (position.top < containerTop) {
|
||||
position.top = 10;
|
||||
position.bottom = "inherit";
|
||||
}
|
||||
|
||||
scope.tooltipStyles = position;
|
||||
|
||||
el.css(position);
|
||||
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
Reference in New Issue
Block a user