remove hardcoded assumption that dat.gui work as fixed position #build

This commit is contained in:
Artur Trzęsiok 2018-05-25 09:10:53 +02:00
parent 3faf42f502
commit fe5bb21f59
5 changed files with 491 additions and 493 deletions

View File

@ -2015,16 +2015,15 @@ Common.extend(GUI.prototype,
onResize: function onResize() { onResize: function onResize() {
var root = this.getRoot(); var root = this.getRoot();
if (root.scrollable) { if (root.scrollable) {
var top = dom.getOffset(root.__ul).top;
var h = 0; var h = 0;
Common.each(root.__ul.childNodes, function (node) { Common.each(root.__ul.childNodes, function (node) {
if (!(root.autoPlace && node === root.__save_row)) { if (!(root.autoPlace && node === root.__save_row)) {
h += dom.getHeight(node); h += dom.getHeight(node);
} }
}); });
if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) { if (root.domElement.clientHeight - CLOSE_BUTTON_HEIGHT < h) {
dom.addClass(root.domElement, GUI.CLASS_TOO_TALL); dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + 'px'; root.__ul.style.height = root.domElement.clientHeight - CLOSE_BUTTON_HEIGHT + 'px';
} else { } else {
dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL); dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
root.__ul.style.height = 'auto'; root.__ul.style.height = 'auto';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2009,16 +2009,15 @@ Common.extend(GUI.prototype,
onResize: function onResize() { onResize: function onResize() {
var root = this.getRoot(); var root = this.getRoot();
if (root.scrollable) { if (root.scrollable) {
var top = dom.getOffset(root.__ul).top;
var h = 0; var h = 0;
Common.each(root.__ul.childNodes, function (node) { Common.each(root.__ul.childNodes, function (node) {
if (!(root.autoPlace && node === root.__save_row)) { if (!(root.autoPlace && node === root.__save_row)) {
h += dom.getHeight(node); h += dom.getHeight(node);
} }
}); });
if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) { if (root.domElement.clientHeight - CLOSE_BUTTON_HEIGHT < h) {
dom.addClass(root.domElement, GUI.CLASS_TOO_TALL); dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + 'px'; root.__ul.style.height = root.domElement.clientHeight - CLOSE_BUTTON_HEIGHT + 'px';
} else { } else {
dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL); dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
root.__ul.style.height = 'auto'; root.__ul.style.height = 'auto';

File diff suppressed because one or more lines are too long