Fixed a bug where typing the letter h in a string field would hide the gui

This commit is contained in:
George Michael Brower 2011-04-18 17:18:52 -07:00
parent 08eb75861c
commit bfc6820597
3 changed files with 198 additions and 136 deletions

View File

@ -9,7 +9,7 @@ body {
} }
#container { #container {
max-width: 530px; max-width: 530px;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
@ -18,9 +18,9 @@ h1, h2, h3, h4, h5, h6 {
} }
hr { hr {
border: 0; border: 0;
height: 0; height: 0;
border-top: 1px dotted #ccc; border-top: 1px dotted #ccc;
} }
h1 { h1 {
@ -55,6 +55,7 @@ h2.section {
border-top: 1px dotted #ccc; border-top: 1px dotted #ccc;
-webkit-transition: color 0.15s linear; -webkit-transition: color 0.15s linear;
} }
h2.section:hover { h2.section:hover {
color: #00aeff; color: #00aeff;
} }
@ -67,23 +68,32 @@ div.collapsed h2, div.expanded h2 {
cursor: pointer; cursor: pointer;
} }
.last { margin-bottom: 0px !important; } .last {
.first { margin-top: 0px; } margin-bottom: 0px !important;
}
.first {
margin-top: 0px;
}
div.trans { div.trans {
border-top: 1px dotted #ccc; border-top: 1px dotted #ccc;
margin: 0px 0px 20px 0px; margin: 0px 0px 20px 0px;
} }
ol#secrets { ol#secrets {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
div.expanded h2:before { div.expanded h2:before {
content: '-'; content: '-';
} }
div.collapsed h2:before { div.collapsed h2:before {
content: '+'; content: '+';
} }
div.expanded h2:before, div.collapsed h2:before { div.expanded h2:before, div.collapsed h2:before {
font-weight: normal; font-weight: normal;
line-height: 2px; line-height: 2px;
@ -97,6 +107,7 @@ div.expanded h2:before, div.collapsed h2:before {
div.collapsable>div { div.collapsable>div {
padding-bottom: 10px; padding-bottom: 10px;
} }
div.collapsable { div.collapsable {
overflow: hidden; overflow: hidden;
clear: both; clear: both;
@ -117,7 +128,9 @@ div.collapsed .collapsable {
height: 0; height: 0;
} }
div.expanded { cursor: pointer; } div.expanded {
cursor: pointer;
}
#helvetica-demo { #helvetica-demo {
position: absolute; position: absolute;
@ -131,7 +144,7 @@ div.expanded { cursor: pointer; }
#notifier { #notifier {
position: fixed; position: fixed;
right: 0; right: 0;
top: 0; top: 300px;
width: 271px; width: 271px;
height: 142px; height: 142px;
background: url("assets/itgivesyouthis.jpg") center 0 no-repeat; background: url("assets/itgivesyouthis.jpg") center 0 no-repeat;
@ -182,7 +195,7 @@ a:active {
} }
footer { footer {
margin-top: 20px; margin-top: 20px;
background-color: #eee; background-color: #eee;
width: 510px; width: 510px;
padding: 10px; padding: 10px;
@ -207,15 +220,46 @@ code strong {
color: #e61d5f; color: #e61d5f;
} }
/* SPAN elements with the classes below are added by prettyprint. */ .str {
.str { color: #0fa954; } color: #0fa954;
.kwd { color: #e61d5f; } }
.com { color: #555; }
.typ { color: #ccc; } .kwd {
.lit { color: #00aeff; } color: #e61d5f;
.pun, .opn, .clo { color: #777; } }
.pln { color: #ccc; }
.tag { color: #555; } .com {
.atn { color: #555; } color: #555;
.atv { color: #777; } }
.dec { color: #606; }
.typ {
color: #ccc;
}
.lit {
color: #00aeff;
}
.pun, .opn, .clo {
color: #777;
}
.pln {
color: #ccc;
}
.tag {
color: #555;
}
.atn {
color: #555;
}
.atv {
color: #777;
}
.dec {
color: #606;
}

View File

@ -26,11 +26,16 @@ DAT.GUI.ControllerString = function() {
}, false); }, false);
input.addEventListener('blur', function() { input.addEventListener('blur', function() {
DAT.GUI.supressHotKeys = false;
if (_this.finishChangeFunction != null) { if (_this.finishChangeFunction != null) {
_this.finishChangeFunction.call(this, _this.getValue()); _this.finishChangeFunction.call(this, _this.getValue());
} }
}, false); }, false);
input.addEventListener('focus', function() {
DAT.GUI.supressHotKeys = true;
}, false);
this.updateDisplay = function() { this.updateDisplay = function() {
input.value = _this.getValue(); input.value = _this.getValue();
}; };

View File

@ -20,6 +20,9 @@ DAT.GUI = function(parameters) {
var listenInterval; var listenInterval;
// Set this to minified css if you don't want to attach style sheets
var inlineCSS = '';
// Sum total of heights of controllers in this gui // Sum total of heights of controllers in this gui
var controllerHeight; var controllerHeight;
@ -453,12 +456,21 @@ DAT.GUI = function(parameters) {
// 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 (e.keyCode == 72) { if (!DAT.GUI.supressHotKeys && e.keyCode == 72) {
DAT.GUI.toggleHide(); DAT.GUI.toggleHide();
} }
}, false); }, false);
if (inlineCSS != '') {
var styleSheet = document.createElement('style');
styleSheet.setAttribute('type', 'text/css');
styleSheet.innerHTML = inlineCSS;
document.head.appendChild(styleSheet);
}
} }
}; };
@ -473,6 +485,7 @@ 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) {