2011-01-24 19:38:52 +00:00
|
|
|
var BooleanController = function() {
|
|
|
|
this.type = "boolean";
|
|
|
|
Controller.apply(this, arguments);
|
2011-01-24 20:11:19 +00:00
|
|
|
|
|
|
|
var _this = this;
|
2011-01-24 19:38:52 +00:00
|
|
|
var input = document.createElement('input');
|
|
|
|
input.setAttribute('type', 'checkbox');
|
2011-01-24 20:11:19 +00:00
|
|
|
|
|
|
|
this.domElement.addEventListener('click', function(e) {
|
|
|
|
input.checked = !input.checked;
|
|
|
|
e.preventDefault();
|
|
|
|
_this.setValue(input.checked);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
input.addEventListener('mouseup', function(e) {
|
2011-01-24 20:28:13 +00:00
|
|
|
input.checked = !input.checked; // counteracts default.
|
2011-01-24 20:11:19 +00:00
|
|
|
}, false);
|
|
|
|
|
2011-01-24 21:21:21 +00:00
|
|
|
this.domElement.style.cursor = "pointer";
|
|
|
|
this.propertyNameElement.style.cursor = "pointer";
|
2011-01-24 19:38:52 +00:00
|
|
|
this.domElement.appendChild(input);
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
};
|
|
|
|
BooleanController.prototype = new Controller();
|
|
|
|
BooleanController.prototype.constructor = BooleanController;
|