[outliner] Fix positioning of tips box

This commit is contained in:
Nick O'Leary 2020-05-07 10:32:25 +01:00
parent 9f29149d87
commit 17891d373b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 14 additions and 6 deletions

View File

@ -28,6 +28,7 @@ RED.sidebar.info = (function() {
var selectedObject; var selectedObject;
var tipContainer;
var tipBox; var tipBox;
// TODO: remove this // TODO: remove this
@ -36,9 +37,11 @@ RED.sidebar.info = (function() {
}; };
function resizeStack() { function resizeStack() {
var h = $(content).parent().height(); if (panels) {
var h = $(content).parent().height() - tipContainer.outerHeight();
panels.resize(h) panels.resize(h)
} }
}
function init() { function init() {
content = document.createElement("div"); content = document.createElement("div");
@ -119,7 +122,7 @@ RED.sidebar.info = (function() {
// Tip Box // Tip Box
var tipContainer = $('<div class="red-ui-help-tips"></div>').appendTo(content); tipContainer = $('<div class="red-ui-help-tips"></div>').appendTo(content);
tipBox = $('<div class="red-ui-help-tip"></div>').appendTo(tipContainer); tipBox = $('<div class="red-ui-help-tip"></div>').appendTo(tipContainer);
var tipButtons = $('<div class="red-ui-help-tips-buttons"></div>').appendTo(tipContainer); var tipButtons = $('<div class="red-ui-help-tips-buttons"></div>').appendTo(tipContainer);
@ -503,6 +506,7 @@ RED.sidebar.info = (function() {
} }
function startTips() { function startTips() {
$(".red-ui-sidebar-info").addClass('show-tips'); $(".red-ui-sidebar-info").addClass('show-tips');
resizeStack();
if (enabled) { if (enabled) {
if (!startTimeout && !refreshTimeout) { if (!startTimeout && !refreshTimeout) {
if (tipCount === -1) { if (tipCount === -1) {
@ -516,6 +520,7 @@ RED.sidebar.info = (function() {
} }
function stopTips() { function stopTips() {
$(".red-ui-sidebar-info").removeClass('show-tips'); $(".red-ui-sidebar-info").removeClass('show-tips');
resizeStack();
clearInterval(refreshTimeout); clearInterval(refreshTimeout);
clearTimeout(startTimeout); clearTimeout(startTimeout);
refreshTimeout = null; refreshTimeout = null;

View File

@ -247,20 +247,23 @@ div.red-ui-info-table {
left:0; left:0;
right:0; right:0;
bottom: 0; bottom: 0;
height: 150px; height: 0;
transition: height 0.2s, padding 0.2s;
box-sizing: border-box; box-sizing: border-box;
border-top: 1px solid $secondary-border-color; border-top: 1px solid $secondary-border-color;
background-color: $secondary-background; background-color: $secondary-background;
padding: 20px; padding: 0;
box-shadow: 0 5px 20px 0px $shadow; box-shadow: 0 5px 20px 0px $shadow;
overflow-y: auto; overflow-y: auto;
} }
.red-ui-sidebar-info.show-tips { .red-ui-sidebar-info.show-tips {
.red-ui-sidebar-info-stack { .red-ui-sidebar-info-stack {
bottom: 150px; height: calc(100% - 150px);
} }
.red-ui-help-tips { .red-ui-help-tips {
display: block; display: block;
height: 150px;
padding: 20px;
} }
} }