MCPcopy
hub / github.com/dataarts/dat.gui / augmentController

Function augmentController

src/dat/gui/GUI.js:922–1078  ·  view source on GitHub ↗
(gui, li, controller)

Source from the content-addressed store, hash-verified

920}
921
922function augmentController(gui, li, controller) {
923 controller.__li = li;
924 controller.__gui = gui;
925
926 common.extend(controller, /** @lends Controller.prototype */ {
927 /**
928 * @param {Array|Object} options
929 * @return {Controller}
930 */
931 options: function(options) {
932 if (arguments.length > 1) {
933 const nextSibling = controller.__li.nextElementSibling;
934 controller.remove();
935
936 return add(
937 gui,
938 controller.object,
939 controller.property,
940 {
941 before: nextSibling,
942 factoryArgs: [common.toArray(arguments)]
943 }
944 );
945 }
946
947 if (common.isArray(options) || common.isObject(options)) {
948 const nextSibling = controller.__li.nextElementSibling;
949 controller.remove();
950
951 return add(
952 gui,
953 controller.object,
954 controller.property,
955 {
956 before: nextSibling,
957 factoryArgs: [options]
958 }
959 );
960 }
961 },
962
963 /**
964 * Sets the name of the controller.
965 * @param {string} name
966 * @return {Controller}
967 */
968 name: function(name) {
969 controller.__li.firstElementChild.firstElementChild.innerHTML = name;
970 return controller;
971 },
972
973 /**
974 * Sets controller to listen for changes on its underlying object.
975 * @return {Controller}
976 */
977 listen: function() {
978 controller.__gui.listen(controller);
979 return controller;

Callers 1

addFunction · 0.85

Calls 5

markPresetModifiedFunction · 0.85
toStringMethod · 0.80
isModifiedMethod · 0.80
addFunction · 0.70
updateDisplayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…