1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add tooltips to debug elements

This commit is contained in:
Nick O'Leary 2018-10-05 17:56:42 +01:00
parent 22ede79799
commit 1161e4f6c1
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 27 additions and 10 deletions

View File

@ -81,33 +81,43 @@ RED.popover = (function() {
var divWidth = div.width();
var viewportTop = $(window).scrollTop();
var viewportLeft = $(window).scrollLeft();
var viewportBottom = viewportTop + $(window).height();
var viewportRight = viewportLeft + $(window).width();
var top = 0;
var left = 0;
if (direction === 'right') {
var d = direction;
if (d === 'right') {
top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top;
left = targetPos.left+targetWidth+deltaSizes[size].leftRight;
} else if (direction === 'left') {
} else if (d === 'left') {
top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top;
left = targetPos.left-deltaSizes[size].leftLeft-divWidth;
} else if (direction === 'bottom') {
} else if (d === 'bottom') {
top = targetPos.top+targetHeight+deltaSizes[size].top;
left = targetPos.left+targetWidth/2-divWidth/2 - deltaSizes[size].leftBottom;
if (top+divHeight > viewportBottom) {
direction = 'top'
if (left+divWidth > viewportRight) {
d = "left";
top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top;
left = targetPos.left-deltaSizes[size].leftLeft-divWidth;
if (top+divHeight+targetHeight/2 + 5 > viewportBottom) {
top -= (top+divHeight+targetHeight/2 - viewportBottom + 5)
}
} else if (top+divHeight > viewportBottom) {
d = 'top';
top = targetPos.top-deltaSizes[size].topTop-divHeight;
left = targetPos.left+targetWidth/2-divWidth/2 - deltaSizes[size].leftTop;
}
} else if (direction === 'top') {
} else if (d === 'top') {
top = targetPos.top-deltaSizes[size].topTop-divHeight;
left = targetPos.left+targetWidth/2-divWidth/2 - deltaSizes[size].leftTop;
if (top < 0) {
direction = 'bottom';
d = 'bottom';
top = targetPos.top+targetHeight+deltaSizes[size].top;
left = targetPos.left+targetWidth/2-divWidth/2 - deltaSizes[size].leftBottom;
}
}
div.addClass('red-ui-popover-'+direction).css({top: top, left: left});
div.addClass('red-ui-popover-'+d).css({top: top, left: left});
if (instant) {
div.show();

View File

@ -139,9 +139,10 @@
}
.red-ui-popover-key {
font-size: 11px;
font-family: monospace;
margin-left: 5px;
margin-left: 3px;
border: 1px solid #999;
border-radius:3px;
padding: 2px 3px;
padding: 1px 2px;
}

View File

@ -217,6 +217,9 @@
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*");
};
});
RED.popover.tooltip($("#debug-tab-open"),RED._('node-red:debug.sidebar.openWindow'));
$(window).unload(function() {
if (subWindow) {

View File

@ -221,6 +221,9 @@ RED.debug = (function() {
e.preventDefault();
clearMessageList(false);
});
RED.popover.tooltip(toolbar.find("#debug-tab-clear"),RED._('node-red:debug.sidebar.clearLog'));
return {
content: content,