mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
31 lines
684 B
JavaScript
31 lines
684 B
JavaScript
GUI.FunctionController = function() {
|
|
|
|
this.type = "function";
|
|
|
|
var _this = this;
|
|
|
|
GUI.Controller.apply(this, arguments);
|
|
|
|
this.domElement.addEventListener('click', function() {
|
|
_this.fire();
|
|
}, false);
|
|
|
|
this.domElement.style.cursor = "pointer";
|
|
this.propertyNameElement.style.cursor = "pointer";
|
|
|
|
var fireFunction = null;
|
|
this.onFire = function(fnc) {
|
|
fireFunction = fnc;
|
|
return this;
|
|
};
|
|
|
|
this.fire = function() {
|
|
if (fireFunction != null) {
|
|
fireFunction.call(this);
|
|
}
|
|
_this.object[_this.propertyName].call(_this.object);
|
|
};
|
|
|
|
};
|
|
GUI.extendController(GUI.FunctionController);
|