mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
buildscript css
This commit is contained in:
parent
d730f43f65
commit
944a4ab7d3
@ -130,7 +130,7 @@
|
|||||||
<li><a href="https://github.com/jonobr1/dat.gui/raw/versions/gui.min
|
<li><a href="https://github.com/jonobr1/dat.gui/raw/versions/gui.min
|
||||||
.js"><strong>Download the minified source</strong></a>
|
.js"><strong>Download the minified source</strong></a>
|
||||||
<small
|
<small
|
||||||
id="buildsize">[22.8kb]
|
id="buildsize">[255.9kb]
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -6,10 +6,6 @@ DAT.GUI = function(parameters) {
|
|||||||
parameters = {};
|
parameters = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.height == undefined) {
|
|
||||||
parameters.height = 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
var MIN_WIDTH = 240;
|
var MIN_WIDTH = 240;
|
||||||
var MAX_WIDTH = 500;
|
var MAX_WIDTH = 500;
|
||||||
|
|
||||||
@ -23,9 +19,11 @@ DAT.GUI = function(parameters) {
|
|||||||
// Sum total of heights of controllers in this gui
|
// Sum total of heights of controllers in this gui
|
||||||
var controllerHeight;
|
var controllerHeight;
|
||||||
|
|
||||||
|
var curControllerContainerHeight = 0;
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
var open = true;
|
var open = false;
|
||||||
var width = 280;
|
var width = 280;
|
||||||
|
|
||||||
// Prevents checkForOverflow bug in which loaded gui appearance
|
// Prevents checkForOverflow bug in which loaded gui appearance
|
||||||
@ -47,10 +45,9 @@ DAT.GUI = function(parameters) {
|
|||||||
this.domElement.setAttribute('class', 'guidat');
|
this.domElement.setAttribute('class', 'guidat');
|
||||||
this.domElement.style.width = width + 'px';
|
this.domElement.style.width = width + 'px';
|
||||||
|
|
||||||
var curControllerContainerHeight = parameters.height;
|
|
||||||
var controllerContainer = document.createElement('div');
|
var controllerContainer = document.createElement('div');
|
||||||
controllerContainer.setAttribute('class', 'guidat-controllers');
|
controllerContainer.setAttribute('class', 'guidat-controllers');
|
||||||
controllerContainer.style.height = curControllerContainerHeight + 'px';
|
controllerContainer.style.height = '0px';
|
||||||
|
|
||||||
// Firefox hack to prevent horizontal scrolling
|
// Firefox hack to prevent horizontal scrolling
|
||||||
controllerContainer.addEventListener('DOMMouseScroll', function(e) {
|
controllerContainer.addEventListener('DOMMouseScroll', function(e) {
|
||||||
@ -74,10 +71,11 @@ DAT.GUI = function(parameters) {
|
|||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var toggleButton = document.createElement('a');
|
var toggleButton = document.createElement('a');
|
||||||
toggleButton.setAttribute('class', 'guidat-toggle');
|
toggleButton.setAttribute('class', 'guidat-toggle');
|
||||||
toggleButton.setAttribute('href', '#');
|
toggleButton.setAttribute('href', '#');
|
||||||
toggleButton.innerHTML = open ? closeString : openString;
|
toggleButton.innerHTML = openString;
|
||||||
|
|
||||||
var toggleDragged = false;
|
var toggleDragged = false;
|
||||||
var dragDisplacementY = 0;
|
var dragDisplacementY = 0;
|
||||||
@ -302,7 +300,7 @@ DAT.GUI = function(parameters) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = [this]; // Set first arg (parent) to this
|
var args = [this]; // Set first arg (parent) to this
|
||||||
for (var j = 0; j < arguments.length; j++) {
|
for (var j = 0; j < arguments.length; j++) {
|
||||||
args.push(arguments[j]);
|
args.push(arguments[j]);
|
||||||
}
|
}
|
||||||
@ -359,10 +357,13 @@ DAT.GUI = function(parameters) {
|
|||||||
'function': DAT.GUI.ControllerFunction
|
'function': DAT.GUI.ControllerFunction
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.reset = function() {
|
this.reset = function() {
|
||||||
// TODO ... Set all values back to their initials.
|
// TODO ... Set all values back to their initials.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DAT.GUI ... DAT.GUI
|
||||||
|
|
||||||
this.toggle = function() {
|
this.toggle = function() {
|
||||||
open ? this.close() : this.open();
|
open ? this.close() : this.open();
|
||||||
};
|
};
|
||||||
@ -372,7 +373,6 @@ DAT.GUI = function(parameters) {
|
|||||||
resizeTo = openHeight;
|
resizeTo = openHeight;
|
||||||
clearTimeout(resizeTimeout);
|
clearTimeout(resizeTimeout);
|
||||||
beginResize();
|
beginResize();
|
||||||
adaptToScrollbar();
|
|
||||||
open = true;
|
open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,6 @@ DAT.GUI = function(parameters) {
|
|||||||
resizeTo = 0;
|
resizeTo = 0;
|
||||||
clearTimeout(resizeTimeout);
|
clearTimeout(resizeTimeout);
|
||||||
beginResize();
|
beginResize();
|
||||||
adaptToScrollbar();
|
|
||||||
open = false;
|
open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,12 +396,13 @@ DAT.GUI = function(parameters) {
|
|||||||
|
|
||||||
var beginResize = function() {
|
var beginResize = function() {
|
||||||
|
|
||||||
curControllerContainerHeight = controllerContainer.offsetHeight;
|
|
||||||
curControllerContainerHeight += (resizeTo - curControllerContainerHeight)
|
curControllerContainerHeight += (resizeTo - curControllerContainerHeight)
|
||||||
* 0.6;
|
* 0.6;
|
||||||
|
|
||||||
if (Math.abs(curControllerContainerHeight - resizeTo) < 1) {
|
if (Math.abs(curControllerContainerHeight - resizeTo) < 1) {
|
||||||
curControllerContainerHeight = resizeTo;
|
curControllerContainerHeight = resizeTo;
|
||||||
|
adaptToScrollbar();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
resizeTimeout = setTimeout(beginResize, 1000 / 30);
|
resizeTimeout = setTimeout(beginResize, 1000 / 30);
|
||||||
}
|
}
|
||||||
@ -413,14 +413,15 @@ DAT.GUI = function(parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var adaptToScrollbar = function() {
|
var adaptToScrollbar = function() {
|
||||||
// Clears lingering scrollbar column
|
// Clears lingering slider column
|
||||||
_this.domElement.style.width = (width - 1) + 'px';
|
_this.domElement.style.width = (width + 1) + 'px';
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
_this.domElement.style.width = width + 'px';
|
_this.domElement.style.width = width + 'px';
|
||||||
}, 1);
|
}, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Load saved appearance:
|
// Load saved appearance:
|
||||||
|
|
||||||
if (DAT.GUI.guiIndex < DAT.GUI.savedAppearanceVars.length) {
|
if (DAT.GUI.guiIndex < DAT.GUI.savedAppearanceVars.length) {
|
||||||
@ -452,23 +453,13 @@ DAT.GUI = function(parameters) {
|
|||||||
DAT.GUI.allGuis.push(this);
|
DAT.GUI.allGuis.push(this);
|
||||||
|
|
||||||
// Add hide listener if this is the first DAT.GUI.
|
// Add hide listener if this is the first DAT.GUI.
|
||||||
|
|
||||||
if (DAT.GUI.allGuis.length == 1) {
|
if (DAT.GUI.allGuis.length == 1) {
|
||||||
|
|
||||||
window.addEventListener('keyup', function(e) {
|
window.addEventListener('keyup', function(e) {
|
||||||
// Hide on 'H'
|
// Hide on 'H'
|
||||||
if (!DAT.GUI.supressHotKeys && e.keyCode == 72) {
|
if (e.keyCode == 72) {
|
||||||
DAT.GUI.toggleHide();
|
DAT.GUI.toggleHide();
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
if (DAT.GUI.inlineCSS) {
|
|
||||||
var styleSheet = document.createElement('style');
|
|
||||||
styleSheet.setAttribute('type', 'text/css');
|
|
||||||
styleSheet.innerHTML = DAT.GUI.inlineCSS;
|
|
||||||
document.head.appendChild(styleSheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -483,7 +474,6 @@ DAT.GUI.autoPlaceContainer = null;
|
|||||||
DAT.GUI.allControllers = [];
|
DAT.GUI.allControllers = [];
|
||||||
DAT.GUI.allGuis = [];
|
DAT.GUI.allGuis = [];
|
||||||
|
|
||||||
DAT.GUI.supressHotKeys = false;
|
|
||||||
|
|
||||||
DAT.GUI.toggleHide = function() {
|
DAT.GUI.toggleHide = function() {
|
||||||
if (DAT.GUI.hidden) {
|
if (DAT.GUI.hidden) {
|
||||||
@ -534,7 +524,8 @@ DAT.GUI.savedAppearanceVars = [];
|
|||||||
|
|
||||||
DAT.GUI.getSaveString = function() {
|
DAT.GUI.getSaveString = function() {
|
||||||
|
|
||||||
var vals = [], i;
|
var vals = [],
|
||||||
|
i;
|
||||||
|
|
||||||
vals.push(DAT.GUI.allGuis.length);
|
vals.push(DAT.GUI.allGuis.length);
|
||||||
vals.push(document.body.scrollTop);
|
vals.push(document.body.scrollTop);
|
||||||
@ -694,4 +685,4 @@ if (DAT.GUI.getVarFromURL('saveString') != null) {
|
|||||||
DAT.GUI.load(DAT.GUI.getVarFromURL('saveString'));
|
DAT.GUI.load(DAT.GUI.getVarFromURL('saveString'));
|
||||||
}
|
}
|
||||||
|
|
||||||
window["DAT.GUI"] = DAT.GUI;
|
window["DAT.GUI"] = DAT.GUI;
|
@ -86,7 +86,7 @@ def build(src):
|
|||||||
|
|
||||||
cssfiles = source_list(src, '*.css')
|
cssfiles = source_list(src, '*.css')
|
||||||
css = '\n'.join([open(f).read() for f in cssfiles])
|
css = '\n'.join([open(f).read() for f in cssfiles])
|
||||||
css = re.sub('\W+','',css)
|
css = re.sub(r'[ \t\n\r]+',' ',css)
|
||||||
|
|
||||||
jsfiles = source_list(src, '*.js')
|
jsfiles = source_list(src, '*.js')
|
||||||
code = '\n'.join([open(f).read() for f in jsfiles])
|
code = '\n'.join([open(f).read() for f in jsfiles])
|
||||||
|
Loading…
Reference in New Issue
Block a user