From e4d9f5ce501b45ff7e68b10069837a52b31858da Mon Sep 17 00:00:00 2001 From: Whiskers <33127788+Catz1301@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:08:46 -0400 Subject: [PATCH 1/2] Update p5.gui.js --- libraries/p5.gui.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/p5.gui.js b/libraries/p5.gui.js index c758c2c..5caa189 100644 --- a/libraries/p5.gui.js +++ b/libraries/p5.gui.js @@ -19,11 +19,11 @@ // You only need to pass a reference to the sketch in instance mode // Usually you will call createGui(this, 'label'); - p5.prototype.createGui = function(sketch, label, provider) { + p5.prototype.createGui = function(sketch, label, provider, draggable = true) { // createGui(label) signature if ((typeof sketch) === 'string') { - return this.createGui(label, sketch, provider); + return this.createGui(label, sketch, provider, draggable); } // normally the sketch will just be embedded below the body @@ -52,7 +52,7 @@ if(provider === 'QuickSettings') { if(QuickSettings) { console.log('Creating p5.gui powered by QuickSettings.'); - gui = new QSGui(label, parent, sketch); + gui = new QSGui(label, parent, sketch, draggable); } else { console.log('QuickSettings not found. Is the script included in your HTML?'); gui = new DummyGui(label, parent, sketch); @@ -101,7 +101,7 @@ // interface for quicksettings - function QSGui(label, parent, sketch) { + function QSGui(label, parent, sketch, draggable) { // hard code the position, it can be changed later let x = 20; @@ -153,7 +153,7 @@ qs.setPosition(x, y); return this; }; - + qs.setDraggable(draggable); // Extend Quicksettings // so it can magically create a GUI for parameters passed by name qs.bindParams = function(object, params) { From 2a7c3c76bb4466c811f6c5919325176724d7a15a Mon Sep 17 00:00:00 2001 From: Whiskers <33127788+Catz1301@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:31:13 -0400 Subject: [PATCH 2/2] Update p5.gui.js --- libraries/p5.gui.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/p5.gui.js b/libraries/p5.gui.js index 5caa189..c505752 100644 --- a/libraries/p5.gui.js +++ b/libraries/p5.gui.js @@ -19,11 +19,11 @@ // You only need to pass a reference to the sketch in instance mode // Usually you will call createGui(this, 'label'); - p5.prototype.createGui = function(sketch, label, provider, draggable = true) { + p5.prototype.createGui = function(sketch, label, provider) { // createGui(label) signature if ((typeof sketch) === 'string') { - return this.createGui(label, sketch, provider, draggable); + return this.createGui(label, sketch, provider); } // normally the sketch will just be embedded below the body @@ -52,7 +52,7 @@ if(provider === 'QuickSettings') { if(QuickSettings) { console.log('Creating p5.gui powered by QuickSettings.'); - gui = new QSGui(label, parent, sketch, draggable); + gui = new QSGui(label, parent, sketch); } else { console.log('QuickSettings not found. Is the script included in your HTML?'); gui = new DummyGui(label, parent, sketch); @@ -101,7 +101,7 @@ // interface for quicksettings - function QSGui(label, parent, sketch, draggable) { + function QSGui(label, parent, sketch) { // hard code the position, it can be changed later let x = 20; @@ -153,7 +153,13 @@ qs.setPosition(x, y); return this; }; - qs.setDraggable(draggable); + this.setDraggable = function(draggable) { + qs.setDraggable(draggable); + } + this.setCollapsible = function(collapsible) { + qs.setCollapsible(collapsible); + } + // Extend Quicksettings // so it can magically create a GUI for parameters passed by name qs.bindParams = function(object, params) {