From 7c93e77c24b0fd1ca05067be513544ae01ecda5d Mon Sep 17 00:00:00 2001 From: a Date: Sun, 29 Nov 2020 13:18:17 +0100 Subject: [PATCH] Now functions can be added as buttons into the menu. --- libraries/p5.gui.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/p5.gui.js b/libraries/p5.gui.js index c758c2c..1a2efaf 100644 --- a/libraries/p5.gui.js +++ b/libraries/p5.gui.js @@ -165,6 +165,10 @@ var val = object[arg]; var typ = typeof val; + if(typeof arg === 'function') { + typ = typeof arg + } + //console.log(typ, arg, val); // don't need to show the sliders for range min, max and step of a property @@ -227,6 +231,10 @@ this.bindBoolean(arg, object[arg], object); break; + case 'function': + this.addButton(arg.name, arg); + break; + } } };