Separate method to reposition tooltip

This commit is contained in:
YUKI Hiroshi 2016-02-19 20:48:39 +09:00
parent f7f1ab7762
commit 13bf7d0fc0

View File

@ -432,15 +432,23 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
var tooltip = this.tabFullTooltip; var tooltip = this.tabFullTooltip;
{ {
this.setTooltipPosition(x, y);
let style = tooltip.style; let style = tooltip.style;
style.marginLeft = x+'px';
style.marginTop = y+'px';
style.maxWidth = style.minWidth = w+'px'; style.maxWidth = style.minWidth = w+'px';
style.maxHeight = style.minHeight = h+'px'; style.maxHeight = style.minHeight = h+'px';
} }
tooltip.openPopupAtScreen(basePosition.x, basePosition.y, false); tooltip.openPopupAtScreen(basePosition.x, basePosition.y, false);
}).bind(this), Math.max(delay, 0), this); }).bind(this), Math.max(delay, 0), this);
}, },
setTooltipPosition : function FTM_setTooltipPosition(aX, aY, aScreen)
{
var tooltip = this.tabFullTooltip;
var style = tooltip.style;
var box = tooltip.boxObject;
var aScreen = aScreen || this.getCurrentScreen(box);
style.marginLeft = aX+'px';
style.marginTop = aY+'px';
},
cancel : function FTM_cancel() cancel : function FTM_cancel()
{ {
@ -622,8 +630,7 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
if (tooltipTopEdge >= currentScreen.allowedHeight) if (tooltipTopEdge >= currentScreen.allowedHeight)
updatedY = (Math.max(currentScreen.top, currentScreen.allowedHeight - currentH) - basePosition.y)+'px'; updatedY = (Math.max(currentScreen.top, currentScreen.allowedHeight - currentH) - basePosition.y)+'px';
style.marginLeft = updatedX; this.setTooltipPosition(updatedX, updatedY, currentScreen);
style.marginTop = updatedY;
log(' => expanded dimensions: ', { log(' => expanded dimensions: ', {
x : updatedX, x : updatedX,
y : updatedY y : updatedY