hooked class attributeses properly on Number Controller and Slider

This commit is contained in:
Jono Brandel 2011-02-10 14:51:52 -08:00
parent 765ade71e9
commit d3cc444cad
3 changed files with 7 additions and 1 deletions

View File

@ -85,6 +85,7 @@ GUI.NumberController = function() {
numberField.focus(); numberField.focus();
numberField.select(); numberField.select();
} }
if(slider) slider.domElement.className = slider.domElement.className.replace(' active', '');
draggedNumberField = false; draggedNumberField = false;
clickedNumberField = false; clickedNumberField = false;
if (_this.finishChangeFunction != null) { if (_this.finishChangeFunction != null) {
@ -106,6 +107,8 @@ GUI.NumberController = function() {
GUI.makeUnselectable(_this.parent.domElement); GUI.makeUnselectable(_this.parent.domElement);
GUI.makeUnselectable(numberField); GUI.makeUnselectable(numberField);
if(slider) slider.domElement.className += ' active';
py = y; py = y;
y = e.pageY; y = e.pageY;
var dy = py - y; var dy = py - y;

View File

@ -46,6 +46,7 @@ GUI.Slider = function(numberController, min, max, step, initValue) {
x = px = e.pageX; x = px = e.pageX;
_this.domElement.setAttribute('class', 'guidat-slider-bg active'); _this.domElement.setAttribute('class', 'guidat-slider-bg active');
_this.fg.setAttribute('class', 'guidat-slider-fg active'); _this.fg.setAttribute('class', 'guidat-slider-fg active');
numberController.domElement.className += ' active';
onDrag(e); onDrag(e);
document.addEventListener('mouseup', mouseup, false); document.addEventListener('mouseup', mouseup, false);
}, false); }, false);
@ -54,6 +55,7 @@ GUI.Slider = function(numberController, min, max, step, initValue) {
var mouseup = function(e) { var mouseup = function(e) {
_this.domElement.setAttribute('class', 'guidat-slider-bg'); _this.domElement.setAttribute('class', 'guidat-slider-bg');
_this.fg.setAttribute('class', 'guidat-slider-fg'); _this.fg.setAttribute('class', 'guidat-slider-fg');
numberController.domElement.className = numberController.domElement.className.replace(' active', '');
clicked = false; clicked = false;
if (numberController.finishChangeFunction != null) { if (numberController.finishChangeFunction != null) {
numberController.finishChangeFunction.call(this, numberController.getValue()); numberController.finishChangeFunction.call(this, numberController.getValue());

View File

@ -86,7 +86,8 @@ a.guidat-toggle:hover {
float: right; float: right;
} }
.guidat-controller input:hover { .guidat-controller input:hover.
.guidat-controller.number.active {
background-color: #444; background-color: #444;
} }