mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
24 lines
727 B
JavaScript
24 lines
727 B
JavaScript
var BooleanController = function() {
|
|
this.type = "boolean";
|
|
Controller.apply(this, arguments);
|
|
|
|
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.domElement.appendChild(input);
|
|
|
|
};
|
|
BooleanController.prototype = new Controller();
|
|
BooleanController.prototype.constructor = BooleanController; |