Comparing version
50
index.js
@@ -19,3 +19,3 @@ function P5GUIElements() { | ||
this.mouseIsOver = false; | ||
this.z = z || 1; | ||
this.z = z || 0; | ||
} | ||
@@ -151,4 +151,4 @@ | ||
////////////////////////////////////////////////////////////////////////////SLIDER | ||
function Slider(v, xPos, yPos, w, h, cl, cb, mi, ma) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb); | ||
function Slider(v, xPos, yPos, w, h, cl, cb, mi, ma, z) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb, z); | ||
this.min = mi; | ||
@@ -254,4 +254,4 @@ this.max = ma; | ||
////////////////////////////////////////////////////////////////TOGGLE | ||
function Toggle(v, t, xPos, yPos, w, h, cl, cb, tc) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb); | ||
function Toggle(v, t, xPos, yPos, w, h, cl, cb, tc, z) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb, z); | ||
this.text = t || ''; | ||
@@ -296,4 +296,4 @@ this.textCol = tc || p.color(100); | ||
///////////////////////////////////////////////////////////////////////////////////RADIO | ||
function Radio(v, vs, ts, xPos, yPos, w, h, cl, cb, tc) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb); | ||
function Radio(v, vs, ts, xPos, yPos, w, h, cl, cb, tc, z) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb, z); | ||
this.values = vs; | ||
@@ -373,4 +373,4 @@ this.texts = ts; | ||
///////////////////////////////////////////////////////////////BUTTON | ||
function Button(v, xPos, yPos, w, h, cl, cb, tc) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb); | ||
function Button(v, xPos, yPos, w, h, cl, cb, tc, z) { | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb, z); | ||
this.textCol = tc || p.color(100); | ||
@@ -414,4 +414,4 @@ } | ||
////////////////////////////////////////////////////////////////////AREA | ||
function Area(xPos, yPos, w, h, cl, cb) { | ||
GUIElement.call(this, null, xPos, yPos, w, h, cl, cb); | ||
function Area(xPos, yPos, w, h, cl, cb, z) { | ||
GUIElement.call(this, null, xPos, yPos, w, h, cl, cb, z); | ||
} | ||
@@ -476,3 +476,3 @@ | ||
//////////////////////////////////////////////////TEXT | ||
function Text(v, xPos, yPos, h, cl, cb, ta, ts) { | ||
function Text(v, xPos, yPos, h, cl, cb, ta, ts, z) { | ||
p.textSize(h); | ||
@@ -482,3 +482,3 @@ this.textStyle = ts || p.NORMAL; | ||
let w = p.textWidth(v); | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb); | ||
GUIElement.call(this, v, xPos, yPos, w, h, cl, cb, z); | ||
this.textAlign = ta || [p.CENTER, p.CENTER]; | ||
@@ -501,26 +501,26 @@ } | ||
return { | ||
createSlider: function(n, v, xPos, yPos, w, h, cl, cb, mi, ma) { | ||
elts[n] = new Slider(v, xPos, yPos, w, h, cl, cb, mi, ma); | ||
createSlider: function(n, v, xPos, yPos, w, h, cl, cb, mi, ma, z) { | ||
elts[n] = new Slider(v, xPos, yPos, w, h, cl, cb, mi, ma, z); | ||
return elts[n]; | ||
}, | ||
createToggle: function(n, v, t, xPos, yPos, w, h, cl, cb, tc) { | ||
elts[n] = new Toggle(v, t, xPos, yPos, w, h, cl, cb, tc); | ||
createToggle: function(n, v, t, xPos, yPos, w, h, cl, cb, tc, z) { | ||
elts[n] = new Toggle(v, t, xPos, yPos, w, h, cl, cb, tc, z); | ||
return elts[n]; | ||
}, | ||
createRadio: function(n, v, vs, ts, xPos, yPos, w, h, cl, cb, tc) { | ||
createRadio: function(n, v, vs, ts, xPos, yPos, w, h, cl, cb, tc, z) { | ||
//horizontal radio buttons (interdependent toggles, also) | ||
elts[n] = new Radio(v, vs, ts, xPos, yPos, w, h, cl, cb, tc); | ||
elts[n] = new Radio(v, vs, ts, xPos, yPos, w, h, cl, cb, tc, z); | ||
return elts[n]; | ||
}, | ||
createButton: function(n, v, xPos, yPos, w, h, cl, cb, tc) { | ||
elts[n] = new Button(v, xPos, yPos, w, h, cl, cb, tc); | ||
createButton: function(n, v, xPos, yPos, w, h, cl, cb, tc, z) { | ||
elts[n] = new Button(v, xPos, yPos, w, h, cl, cb, tc, z); | ||
return elts[n]; | ||
}, | ||
createArea: function(n, xPos, yPos, w, h, cl, cb) { | ||
elts[n] = new Area(xPos, yPos, w, h, cl, cb); | ||
createArea: function(n, xPos, yPos, w, h, cl, cb, z) { | ||
elts[n] = new Area(xPos, yPos, w, h, cl, cb, z); | ||
return elts[n]; | ||
}, | ||
createText: function(n, v, xPos, yPos, h, cl, cb, ta, ts) { | ||
createText: function(n, v, xPos, yPos, h, cl, cb, ta, ts, z) { | ||
//pass textAlign function | ||
elts[n] = new Text(v, xPos, yPos, h, cl, cb, ta, ts); | ||
elts[n] = new Text(v, xPos, yPos, h, cl, cb, ta, ts, z); | ||
return elts[n]; | ||
@@ -527,0 +527,0 @@ }, |
{ | ||
"name": "p5_gui", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Experimental Graphical User Interface for P5js sketches", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20924
0.35%