mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
set get controller
This commit is contained in:
parent
cbcd3d5e3c
commit
cfa3631b0d
@ -20,12 +20,15 @@ import ControllerFactory from './ControllerFactory';
|
|||||||
*
|
*
|
||||||
* @extends dat.controllers.Controller
|
* @extends dat.controllers.Controller
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
class CustomController extends Controller{
|
||||||
|
/**
|
||||||
|
* Represents a custom controller.
|
||||||
* @param {Object} object The object to be manipulated
|
* @param {Object} object The object to be manipulated
|
||||||
* @param {Function} [object.property] Returns an object with elements for adding into "property-name" class element.
|
* @param {Function} [object.property] Returns an object with elements for adding into "property-name" class element.
|
||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
* @param {Object} [params] Optional parameters
|
* @param {Object} [params] Optional parameters
|
||||||
*/
|
*/
|
||||||
class CustomController extends Controller{
|
|
||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
super(object, property);
|
super(object, property);
|
||||||
|
|
||||||
@ -33,7 +36,13 @@ class CustomController extends Controller{
|
|||||||
object: object, property: property, opts: Array.prototype.slice.call(arguments, 2)
|
object: object, property: property, opts: Array.prototype.slice.call(arguments, 2)
|
||||||
}
|
}
|
||||||
if(object.property)
|
if(object.property)
|
||||||
this.property = object.property();
|
this.property = object.property( this );
|
||||||
|
}
|
||||||
|
set controller( newController ){
|
||||||
|
this._controller = newController;
|
||||||
|
}
|
||||||
|
get controller(){
|
||||||
|
return this._controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,6 +1158,8 @@ function add(gui, object, property, params) {
|
|||||||
}
|
}
|
||||||
if ( controller === null )
|
if ( controller === null )
|
||||||
controller = customObject;
|
controller = customObject;
|
||||||
|
else if( customObject !== undefined )
|
||||||
|
customObject.controller = controller;
|
||||||
|
|
||||||
if (params.before instanceof Controller) {
|
if (params.before instanceof Controller) {
|
||||||
params.before = params.before.__li;
|
params.before = params.before.__li;
|
||||||
|
Loading…
Reference in New Issue
Block a user