diff --git a/gui.css b/gui.css
index db30521..b464006 100644
--- a/gui.css
+++ b/gui.css
@@ -1,18 +1,19 @@
#guidat {
position: fixed;
- bottom: 0;
width: 100%;
+ height: 100%;
left: 0;
-
+ top: 0;
z-index: 1001;
}
-.guidat * {
+.guidat {
+ float: right;
padding: 0px;
- margin: 0px;
+ margin: 0px 20px 0px 0px;
}
-.guidat-time {
+.guidat-scrubber {
width: 75%;
float: right;
margin-top: -3px;
@@ -40,16 +41,11 @@
overflow-y: auto;
overflow-x: hidden;
background-color: rgba(0,0,0,0.1);
- /*
- -moz-transition: height .2s ease-out;
- -webkit-transition: height .2s ease-out;
- transition: height .2s ease-out;
- */
}
.guidat-controllers hr {
-height: 0;
-border-top: 1px solid #000;
+ height: 0;
+ border-top: 1px solid #000;
}
a.guidat-toggle {
@@ -116,9 +112,9 @@ a.guidat-toggle:hover {
.guidat-controller.string input {
border: 0;
+ width: 125px;
color: #1ed36f;
margin-right: 2px;
- width: 10.5%;
}
.guidat-controller.boolean {
@@ -130,10 +126,10 @@ a.guidat-toggle:hover {
}
.guidat-controller.number input[type=text] {
- width: 3%;
margin-left: 5px;
margin-right: 2px;
color: #00aeff;
+ width: 35px;
}
.guidat .guidat-controller.boolean input {
@@ -170,7 +166,7 @@ a.guidat-toggle:hover {
.guidat-slider-bg {
background-color: #222;
cursor: ew-resize;
- width: 7%;
+ width: 85px;
margin-top: 2px;
float: right;
height: 21px;
@@ -180,3 +176,24 @@ a.guidat-toggle:hover {
background-color: #00aeff;
height: 20px;
}
+
+/* Styles for timed GUI */
+
+.guidat.time {
+ position: absolute;
+ width: 100%;
+ bottom: 0;
+ left: 0;
+}
+
+.time .guidat-slider-bg {
+ width: 7%;
+}
+
+.time .guidat-controller.string input {
+ width: 10.6%;
+}
+.time .guidat-controller.number input[type=text] {
+ width: 3%;
+}
+
diff --git a/gui.js b/gui.js
index c85ce3c..0c24739 100644
--- a/gui.js
+++ b/gui.js
@@ -1,6 +1,8 @@
var GUI = function() {
var _this = this;
+ // For use with GUIScrubber
+ this.timer = null;
var MIN_WIDTH = 240;
var MAX_WIDTH = 500;
@@ -33,15 +35,15 @@ var GUI = function() {
var resizeTo = 0;
var resizeTimeout;
+ var width = 280;
+
this.domElement = document.createElement('div');
this.domElement.setAttribute('class', 'guidat');
- this.domElement.style.width = "100%";//width+'px';
+ this.domElement.style.width = width+'px';
var controllerContainer = document.createElement('div');
controllerContainer.setAttribute('class', 'guidat-controllers');
- // For use with GUIScrubber
- this.timer = null;
// Firefox hack to prevent horizontal scrolling
controllerContainer.addEventListener('DOMMouseScroll', function(e) {
@@ -82,7 +84,7 @@ var GUI = function() {
my = e.pageY;
mx = e.pageX;
- var dmy = pmy-my;
+ var dmy = _this.timer ? pmy - my : my - pmy;
if (!open) {
if (dmy < 0) {
@@ -94,7 +96,7 @@ var GUI = function() {
}
}
- // TODO: Flip this if you want to resize to the left.
+ // TODO: Flip this if you want to resize to the right.
var dmx = pmx - mx;
if (dmy > 0 &&
@@ -107,11 +109,16 @@ var GUI = function() {
dragDisplacementY += dmy;
dragDisplacementX += dmx;
openHeight += dmy;
- //width += dmx;
+
curControllerContainerHeight += dmy;
controllerContainer.style.height = openHeight+'px';
- width = GUI.constrain(width, MIN_WIDTH, MAX_WIDTH);
- //_this.domElement.style.width = width+'px';
+
+ if (!_this.timer) {
+ width += dmx;
+ width = GUI.constrain(width, MIN_WIDTH, MAX_WIDTH);
+ _this.domElement.style.width = width+'px';
+ }
+
checkForOverflow();
};
@@ -134,29 +141,31 @@ var GUI = function() {
}, false);
+ var correctWidth = function() {
+ // Clears lingering slider column
+ _this.domElement.style.width = (width+1)+'px';
+ setTimeout(function() {
+ _this.domElement.style.width = width+'px';
+ }, 1);
+ };
+
document.addEventListener('mouseup', function(e) {
if (togglePressed && !toggleDragged) {
_this.toggle();
- // Clears lingering slider column
- // _this.domElement.style.width = (width+1)+'px';
- setTimeout(function() {
- // _this.domElement.style.width = width+'px';
- }, 1);
+ if (!_this.timer) {
+ correctWidth();
+ }
}
if (togglePressed && toggleDragged) {
- if (dragDisplacementX == 0) {
+ if (dragDisplacementX == 0 && !_this.timer) {
- // Clears lingering slider column
- _this.domElement.style.width = (width+1)+'px';
- setTimeout(function() {
- _this.domElement.style.width = width+'px';
- }, 1);
-
+ correctWidth();
+
}
if (openHeight > controllerHeight) {
@@ -178,13 +187,10 @@ var GUI = function() {
openHeight = resizeTo;
beginResize();
}
- }
-
-
+ }
}
-
document.removeEventListener('mousemove', resize, false);
e.preventDefault();
toggleDragged = false;
@@ -194,8 +200,8 @@ var GUI = function() {
}, false);
- this.domElement.appendChild(toggleButton);
this.domElement.appendChild(controllerContainer);
+ this.domElement.appendChild(toggleButton);
if (GUI.autoPlace) {
if(GUI.autoPlaceContainer == null) {
@@ -297,8 +303,8 @@ var GUI = function() {
// Have we already added this?
if (alreadyControlled(object, propertyName)) {
- // GUI.error("Controller for \"" + propertyName+"\" already added.");
- // return;
+ GUI.error("Controller for \"" + propertyName+"\" already added.");
+ return;
}
var value = object[propertyName];
@@ -449,7 +455,6 @@ var GUI = function() {
// Load saved appearance:
if (GUI.guiIndex < GUI.savedAppearanceVars.length) {
-
width = parseInt(GUI.savedAppearanceVars[GUI.guiIndex][1]);
//_this.domElement.style.width = width+"px";
diff --git a/index.html b/index.html
index 6ede8da..342c340 100644
--- a/index.html
+++ b/index.html
@@ -21,9 +21,11 @@
-
-
+
@@ -34,11 +36,16 @@