2011-01-25 08:22:04 +00:00
|
|
|
var BooleanController = function() {
|
|
|
|
this.type = "boolean";
|
2011-01-29 03:56:32 +00:00
|
|
|
Controller.apply(this, arguments);
|
2011-01-25 08:22:04 +00:00
|
|
|
|
2011-01-29 03:56:32 +00:00
|
|
|
var that = this;
|
|
|
|
var input = document.createElement('input');
|
|
|
|
input.setAttribute('type', 'checkbox');
|
|
|
|
|
|
|
|
this.domElement.addEventListener('click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
input.checked = !input.checked;
|
|
|
|
that.value = input.checked;
|
|
|
|
that.setTargetValue(that.value);
|
|
|
|
}, 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-25 08:22:04 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
BooleanController.prototype = new Controller();
|
2011-01-29 03:56:32 +00:00
|
|
|
BooleanController.prototype.constructor = BooleanController;
|