2011-01-25 08:22:04 +00:00
|
|
|
var BooleanController = function() {
|
2011-01-29 04:28:12 +00:00
|
|
|
|
2011-01-25 08:22:04 +00:00
|
|
|
this.type = "boolean";
|
2011-01-29 03:56:32 +00:00
|
|
|
Controller.apply(this, arguments);
|
2011-01-25 08:22:04 +00:00
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
var input = document.createElement('input');
|
|
|
|
input.setAttribute('type', 'checkbox');
|
|
|
|
|
|
|
|
this.domElement.addEventListener('click', function(e) {
|
|
|
|
input.checked = !input.checked;
|
|
|
|
e.preventDefault();
|
|
|
|
_this.setValue(input.checked);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
input.addEventListener('mouseup', function(e) {
|
|
|
|
input.checked = !input.checked; // counteracts default.
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
this.domElement.style.cursor = "pointer";
|
|
|
|
this.propertyNameElement.style.cursor = "pointer";
|
|
|
|
this.domElement.appendChild(input);
|
2011-01-29 04:04:33 +00:00
|
|
|
|
|
|
|
this.updateDisplay = function() {
|
|
|
|
input.checked = _this.getValue();
|
|
|
|
};
|
2011-01-25 08:22:04 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
BooleanController.prototype = new Controller();
|
2011-01-29 03:56:32 +00:00
|
|
|
BooleanController.prototype.constructor = BooleanController;
|