2011-04-18 19:01:45 +00:00
|
|
|
DAT.GUI.FunctionController = function() {
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.type = "function";
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
var _this = this;
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-04-18 19:01:45 +00:00
|
|
|
DAT.GUI.Controller.apply(this, arguments);
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.domElement.addEventListener('click', function() {
|
|
|
|
_this.fire();
|
|
|
|
}, false);
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.domElement.style.cursor = "pointer";
|
|
|
|
this.propertyNameElement.style.cursor = "pointer";
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
var fireFunction = null;
|
|
|
|
this.onFire = function(fnc) {
|
|
|
|
fireFunction = fnc;
|
|
|
|
return this;
|
2011-02-11 19:12:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.fire = function() {
|
|
|
|
if (fireFunction != null) {
|
|
|
|
fireFunction.call(this);
|
|
|
|
}
|
|
|
|
_this.object[_this.propertyName].call(_this.object);
|
|
|
|
};
|
2011-01-25 08:22:04 +00:00
|
|
|
};
|
2011-04-18 19:01:45 +00:00
|
|
|
DAT.GUI.extendController(DAT.GUI.FunctionController);
|