perfect-gui 3.3.3 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +1 -1
- package/src/index.js +10 -6
- package/src/styles.js +33 -25
- package/test/src/index.html +26 -6
- package/test/src/js/basics.js +1 -1
- package/test/src/js/folders.js +2 -2
- package/test/src/js/other.js +19 -20
- package/test/src/js/vectors.js +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,9 @@ const gui = new GUI({
|
|
|
65
65
|
// If set to true, the panel position will be reset when the screen is resized.
|
|
66
66
|
// If a panel has been dragged, it won't be be affected.
|
|
67
67
|
// Default is true.
|
|
68
|
+
|
|
69
|
+
color: '#bada55',
|
|
70
|
+
// Default is #2e2e2e
|
|
68
71
|
});
|
|
69
72
|
```
|
|
70
73
|
|
|
@@ -147,7 +150,8 @@ gui.vector2('Position', {
|
|
|
147
150
|
```javascript
|
|
148
151
|
let folder = gui.folder({
|
|
149
152
|
name: 'folder name',
|
|
150
|
-
closed: false // default is false
|
|
153
|
+
closed: false, // default is false,
|
|
154
|
+
color: '#226666' // default is #434343
|
|
151
155
|
});
|
|
152
156
|
folder.button('click me!', callback);
|
|
153
157
|
```
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export default class GUI {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
this.name = (options != undefined && typeof options.name == "string") ? options.name : '';
|
|
21
|
+
this.color = options.color || null;
|
|
21
22
|
|
|
22
23
|
if ( this instanceof GUI ) {
|
|
23
24
|
if ( typeof GUI[GUI.instanceCounter] != 'number' ) {
|
|
@@ -59,7 +60,6 @@ export default class GUI {
|
|
|
59
60
|
this.yOffset = 0;
|
|
60
61
|
this.position = {prevX:this.xOffset, prevY:this.yOffset, x:this.xOffset, y:this.yOffset};
|
|
61
62
|
|
|
62
|
-
let verticalCSSPositioning = this.screenCorner.y == 'top' ? '' : 'top: auto; bottom: 0;';
|
|
63
63
|
if ( options.maxHeight ) {
|
|
64
64
|
this.maxHeight = options.maxHeight;
|
|
65
65
|
} else {
|
|
@@ -72,7 +72,8 @@ export default class GUI {
|
|
|
72
72
|
width: ${this.wrapperWidth}px;
|
|
73
73
|
max-height: ${this.maxHeight}px;
|
|
74
74
|
transform: translate3d(${this.xOffset}px,${this.yOffset}px,0);
|
|
75
|
-
${
|
|
75
|
+
${ this.screenCorner.y == 'top' ? '' : 'top: auto; bottom: 0;' }
|
|
76
|
+
${ this.color ? 'background: ' + this.color + ';' : '' }
|
|
76
77
|
}`);
|
|
77
78
|
|
|
78
79
|
if (options.autoRepositioning != false) window.addEventListener('resize', this._handleResize.bind(this));
|
|
@@ -165,7 +166,8 @@ export default class GUI {
|
|
|
165
166
|
this.header = this._createElement({
|
|
166
167
|
parent: this.wrapper,
|
|
167
168
|
class: 'p-gui__header',
|
|
168
|
-
textContent: this.name
|
|
169
|
+
textContent: this.name,
|
|
170
|
+
inline: `${ this.color ? 'border-color: ' + this.color + ';' : ''}`
|
|
169
171
|
});
|
|
170
172
|
|
|
171
173
|
this._createElement({
|
|
@@ -472,6 +474,7 @@ export default class GUI {
|
|
|
472
474
|
folder(options = {}) {
|
|
473
475
|
let closed = typeof options.closed == 'boolean' ? options.closed : false;
|
|
474
476
|
let name = options.name || '';
|
|
477
|
+
let color = options.color || null;
|
|
475
478
|
|
|
476
479
|
this.imageContainer = null;
|
|
477
480
|
|
|
@@ -486,7 +489,8 @@ export default class GUI {
|
|
|
486
489
|
}
|
|
487
490
|
|
|
488
491
|
let container = this._createElement({
|
|
489
|
-
class: className
|
|
492
|
+
class: className,
|
|
493
|
+
inline: color ? `background-color: ${color};`: null,
|
|
490
494
|
});
|
|
491
495
|
|
|
492
496
|
let folderHeader = this._createElement({
|
|
@@ -496,10 +500,10 @@ export default class GUI {
|
|
|
496
500
|
this.parentNode.classList.toggle('p-gui__folder--closed');
|
|
497
501
|
},
|
|
498
502
|
parent: container
|
|
499
|
-
})
|
|
503
|
+
});
|
|
500
504
|
|
|
501
505
|
let folder = new GUI({isFolder: true, folderOptions: {
|
|
502
|
-
wrapper: container
|
|
506
|
+
wrapper: container,
|
|
503
507
|
}});
|
|
504
508
|
this.folders.push(folder);
|
|
505
509
|
return folder;
|
package/src/styles.js
CHANGED
|
@@ -10,7 +10,7 @@ return /* css */`
|
|
|
10
10
|
top: 0;
|
|
11
11
|
left: 0;
|
|
12
12
|
transform: translate3d(0,0,0);
|
|
13
|
-
padding:
|
|
13
|
+
padding-top: 21px;
|
|
14
14
|
background: #2e2e2e;
|
|
15
15
|
display: flex;
|
|
16
16
|
justify-content: center;
|
|
@@ -22,6 +22,8 @@ return /* css */`
|
|
|
22
22
|
box-sizing: border-box;
|
|
23
23
|
z-index: 99999;
|
|
24
24
|
user-select: none;
|
|
25
|
+
border-bottom-right-radius: 3px;
|
|
26
|
+
border-bottom-left-radius: 3px;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
.p-gui--collapsed {
|
|
@@ -36,7 +38,7 @@ return /* css */`
|
|
|
36
38
|
left: 0;
|
|
37
39
|
width: 100%;
|
|
38
40
|
height: 20px;
|
|
39
|
-
background-color:
|
|
41
|
+
background-color: rgba(0, 0, 0, .8);
|
|
40
42
|
border-bottom: 1px solid #484848;
|
|
41
43
|
cursor: grab;
|
|
42
44
|
color: grey;
|
|
@@ -65,17 +67,15 @@ return /* css */`
|
|
|
65
67
|
|
|
66
68
|
.p-gui__image-container {
|
|
67
69
|
width: 100%;
|
|
68
|
-
padding: 0 10px;
|
|
69
70
|
display: flex;
|
|
70
71
|
flex-wrap: wrap;
|
|
71
|
-
margin-bottom: 5px;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.p-gui__image {
|
|
75
|
-
width:
|
|
76
|
-
|
|
75
|
+
width: calc(33.33% - 10px);
|
|
76
|
+
aspect-ratio: 1 / 1;
|
|
77
77
|
background-size: cover;
|
|
78
|
-
margin: 5px
|
|
78
|
+
margin: 5px 5px 19px 5px;
|
|
79
79
|
cursor: pointer;
|
|
80
80
|
position: relative;
|
|
81
81
|
}
|
|
@@ -86,6 +86,7 @@ return /* css */`
|
|
|
86
86
|
color: #eee;
|
|
87
87
|
font-size: 11px;
|
|
88
88
|
text-shadow: 0 -1px 0 #111;
|
|
89
|
+
white-space: nowrap;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
.p-gui__button,
|
|
@@ -93,28 +94,42 @@ return /* css */`
|
|
|
93
94
|
.p-gui__list,
|
|
94
95
|
.p-gui__vector2 {
|
|
95
96
|
width: 100%;
|
|
96
|
-
margin: 3px;
|
|
97
97
|
padding: 7px;
|
|
98
|
-
background: #1b1b1b;
|
|
99
98
|
font-size: 11px;
|
|
100
99
|
color: white;
|
|
101
100
|
border-bottom: 1px solid #00ff89;
|
|
102
101
|
cursor: pointer;
|
|
103
102
|
position: relative;
|
|
104
103
|
box-sizing: border-box;
|
|
104
|
+
margin-bottom: 3px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.p-gui__button,
|
|
108
|
+
.p-gui__switch {
|
|
109
|
+
margin-right: 2px;
|
|
110
|
+
margin-left: 2px;
|
|
111
|
+
background: rgba(0, 0, 0, .3);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.p-gui__folder .p-gui__button,
|
|
115
|
+
.p-gui__folder .p-gui__switch {
|
|
116
|
+
margin-right: 0;
|
|
117
|
+
margin-left: 0;
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
.p-gui__vector2 {
|
|
121
|
+
background: transparent;
|
|
108
122
|
border-bottom: 1px solid #ff9999;
|
|
109
123
|
aspect-ratio: 1;
|
|
124
|
+
padding-bottom: 0;
|
|
110
125
|
}
|
|
111
126
|
|
|
112
127
|
.p-gui__vector2-area {
|
|
113
128
|
position: relative;
|
|
114
|
-
background:
|
|
115
|
-
margin-top:
|
|
129
|
+
background: rgba(0, 0, 0, .3);
|
|
130
|
+
margin-top: 8px;
|
|
116
131
|
width: 100%;
|
|
117
|
-
height: calc(100% -
|
|
132
|
+
height: calc(100% - 28px);
|
|
118
133
|
}
|
|
119
134
|
|
|
120
135
|
.p-gui__vector2-line {
|
|
@@ -159,7 +174,7 @@ return /* css */`
|
|
|
159
174
|
|
|
160
175
|
.p-gui__button:hover,
|
|
161
176
|
.p-gui__switch:hover {
|
|
162
|
-
background:
|
|
177
|
+
background: rgba(0, 0, 0, .75);
|
|
163
178
|
}
|
|
164
179
|
|
|
165
180
|
.p-gui__switch-checkbox {
|
|
@@ -192,9 +207,8 @@ return /* css */`
|
|
|
192
207
|
|
|
193
208
|
.p-gui__slider {
|
|
194
209
|
width: 100%;
|
|
195
|
-
margin:
|
|
210
|
+
margin-bottom: 8px;
|
|
196
211
|
padding: 7px;
|
|
197
|
-
background: #1b1b1b;
|
|
198
212
|
font-size: 11px;
|
|
199
213
|
color: white;
|
|
200
214
|
position: relative;
|
|
@@ -254,7 +268,7 @@ return /* css */`
|
|
|
254
268
|
display: flex;
|
|
255
269
|
flex-wrap: wrap;
|
|
256
270
|
border-left: 2px solid grey;
|
|
257
|
-
|
|
271
|
+
padding: 0 3px;
|
|
258
272
|
}
|
|
259
273
|
|
|
260
274
|
.p-gui__folder--first {
|
|
@@ -268,14 +282,15 @@ return /* css */`
|
|
|
268
282
|
.p-gui__folder-header {
|
|
269
283
|
padding: 5px;
|
|
270
284
|
font-size: 11px;
|
|
271
|
-
background-color:
|
|
285
|
+
background-color: rgba(0, 0, 0, .5);
|
|
272
286
|
color: white;
|
|
273
287
|
cursor: pointer;
|
|
274
288
|
width: 100%;
|
|
289
|
+
margin: 0 -2px 2px -3px;
|
|
275
290
|
}
|
|
276
291
|
|
|
277
292
|
.p-gui__folder-header:hover {
|
|
278
|
-
background-color:
|
|
293
|
+
background-color: rgba(0, 0, 0, .75);
|
|
279
294
|
}
|
|
280
295
|
|
|
281
296
|
.p-gui__folder-arrow {
|
|
@@ -291,12 +306,5 @@ return /* css */`
|
|
|
291
306
|
.p-gui__folder--closed .p-gui__folder-arrow {
|
|
292
307
|
transform: rotate(0deg);
|
|
293
308
|
}
|
|
294
|
-
|
|
295
|
-
.p-gui__folder .p-gui__button,
|
|
296
|
-
.p-gui__folder .p-gui__switch,
|
|
297
|
-
.p-gui__folder .p-gui__slider,
|
|
298
|
-
.p-gui__folder .p-gui__list {
|
|
299
|
-
margin-left: 6px;
|
|
300
|
-
}
|
|
301
309
|
`
|
|
302
310
|
};
|
package/test/src/index.html
CHANGED
|
@@ -158,7 +158,8 @@
|
|
|
158
158
|
|
|
159
159
|
<h2>Folders</h2>
|
|
160
160
|
|
|
161
|
-
<p>Folders can be closed by default by setting the <i>closed</i>
|
|
161
|
+
<p>Folders can be closed by default by setting the <i>closed</i> option to <span class="code-inline">true</span>.</p>
|
|
162
|
+
<p>Each folder can have a different color with the <span class="code-inline">color</span> option.</p>
|
|
162
163
|
|
|
163
164
|
<div id="container-3" class="container">
|
|
164
165
|
<div class="element"></div>
|
|
@@ -170,7 +171,7 @@
|
|
|
170
171
|
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Folders'</span>
|
|
171
172
|
<span style="color: #f8f8f2">});</span>
|
|
172
173
|
|
|
173
|
-
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_1</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Folder 1
|
|
174
|
+
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_1</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Folder 1'</span> <span style="color: #f8f8f2">});</span>
|
|
174
175
|
|
|
175
176
|
<span style="color: #a6e22e">folder_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Random color'</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
176
177
|
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
|
|
@@ -180,13 +181,14 @@
|
|
|
180
181
|
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">transform</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">scale</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">value</span><span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
|
|
181
182
|
<span style="color: #f8f8f2">});</span>
|
|
182
183
|
|
|
183
|
-
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_2</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Folder 2
|
|
184
|
+
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_2</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Folder 2'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">closed</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span> <span style="color: #f8f8f2">});</span>
|
|
184
185
|
|
|
185
186
|
<span style="color: #a6e22e">folder_2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Random color'</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
186
187
|
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
|
|
187
188
|
<span style="color: #f8f8f2">});</span>
|
|
188
189
|
</pre></div>
|
|
189
190
|
|
|
191
|
+
|
|
190
192
|
</div>
|
|
191
193
|
|
|
192
194
|
<h2>Other options</h2>
|
|
@@ -196,6 +198,7 @@
|
|
|
196
198
|
<p>The <span class="code-inline">toggleClose()</span> method can be used to open / close a GUI panel.</p>
|
|
197
199
|
<p>Just like folders, GUI panels can be closed by default by setting the <span class="code-inline">close</span> option to <span class="code-inline">true</span>.</p>
|
|
198
200
|
<p>The <span class="code-inline">maxHeight</span> option can be used to define the maximum height of a panel beyond which scrolling is necessary. Default is the smallest value between the height of the window and the height of the container.</p>
|
|
201
|
+
<p>The <span class="code-inline">color</span> option can be used for both GUI panels and folders to customize their background color.</p>
|
|
199
202
|
|
|
200
203
|
<div id="container-4" class="container"></div>
|
|
201
204
|
|
|
@@ -220,14 +223,31 @@
|
|
|
220
223
|
<span style="color: #f8f8f2">});</span>
|
|
221
224
|
|
|
222
225
|
<span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_3</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">GUI</span><span style="color: #f8f8f2">({</span>
|
|
223
|
-
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'GUI 3 (closed)'</span><span style="color: #f8f8f2">,</span>
|
|
226
|
+
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'GUI 3 (closed, scrollable)'</span><span style="color: #f8f8f2">,</span>
|
|
224
227
|
<span style="color: #a6e22e">closed</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span><span style="color: #f8f8f2">,</span>
|
|
225
228
|
<span style="color: #f8f8f2">});</span>
|
|
226
229
|
|
|
227
|
-
<span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">
|
|
228
|
-
|
|
230
|
+
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">f1</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'folder'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">color</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'#33329f'</span> <span style="color: #f8f8f2">});</span>
|
|
231
|
+
<span style="color: #66d9ef">for</span> <span style="color: #f8f8f2">(</span><span style="color: #66d9ef">let</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">=</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672"><</span> <span style="color: #ae81ff">3</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">++</span><span style="color: #f8f8f2">)</span> <span style="color: #f8f8f2">{</span>
|
|
232
|
+
<span style="color: #a6e22e">f1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'btn '</span><span style="color: #f92672">+</span> <span style="color: #a6e22e">i</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{});</span>
|
|
233
|
+
<span style="color: #f8f8f2">}</span>
|
|
234
|
+
<span style="color: #66d9ef">let</span> <span style="color: #a6e22e">f2</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">folder</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'folder'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">color</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'#9f3293'</span> <span style="color: #f8f8f2">});</span>
|
|
235
|
+
<span style="color: #66d9ef">for</span> <span style="color: #f8f8f2">(</span><span style="color: #66d9ef">let</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">=</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672"><</span> <span style="color: #ae81ff">3</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">++</span><span style="color: #f8f8f2">)</span> <span style="color: #f8f8f2">{</span>
|
|
236
|
+
<span style="color: #a6e22e">f2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'btn '</span><span style="color: #f92672">+</span> <span style="color: #a6e22e">i</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{});</span>
|
|
237
|
+
<span style="color: #f8f8f2">}</span>
|
|
238
|
+
<span style="color: #66d9ef">for</span> <span style="color: #f8f8f2">(</span><span style="color: #66d9ef">let</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">=</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672"><</span> <span style="color: #ae81ff">10</span><span style="color: #f8f8f2">;</span> <span style="color: #a6e22e">i</span> <span style="color: #f92672">++</span><span style="color: #f8f8f2">)</span> <span style="color: #f8f8f2">{</span>
|
|
239
|
+
<span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'btn '</span><span style="color: #f92672">+</span> <span style="color: #a6e22e">i</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{});</span>
|
|
240
|
+
<span style="color: #f8f8f2">}</span>
|
|
241
|
+
|
|
242
|
+
<span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_4</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">GUI</span><span style="color: #f8f8f2">({</span>
|
|
243
|
+
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'GUI 4 (custom color)'</span><span style="color: #f8f8f2">,</span>
|
|
244
|
+
<span style="color: #a6e22e">position</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'bottom right'</span><span style="color: #f8f8f2">,</span>
|
|
245
|
+
<span style="color: #a6e22e">color</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'#226666'</span>
|
|
229
246
|
<span style="color: #f8f8f2">});</span>
|
|
247
|
+
|
|
248
|
+
<span style="color: #a6e22e">gui_4</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'lorem'</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{});</span>
|
|
230
249
|
</pre></div>
|
|
250
|
+
|
|
231
251
|
</div>
|
|
232
252
|
|
|
233
253
|
<h2>Killing and creating dynamically</h2>
|
package/test/src/js/basics.js
CHANGED
package/test/src/js/folders.js
CHANGED
|
@@ -9,7 +9,7 @@ export default function folders() {
|
|
|
9
9
|
container: '#container-3'
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
let folder_1 = gui.folder({ name: 'Folder 1
|
|
12
|
+
let folder_1 = gui.folder({ name: 'Folder 1' });
|
|
13
13
|
|
|
14
14
|
folder_1.button('Random color', () => {
|
|
15
15
|
element.style.backgroundColor = getRandomColor();
|
|
@@ -19,7 +19,7 @@ export default function folders() {
|
|
|
19
19
|
element.style.transform = `scale(${value})`;
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
let folder_2 = gui.folder({ name: 'Folder 2
|
|
22
|
+
let folder_2 = gui.folder({ name: 'Folder 2', closed: true });
|
|
23
23
|
|
|
24
24
|
folder_2.button('Random color', () => {
|
|
25
25
|
element.style.backgroundColor = getRandomColor();
|
package/test/src/js/other.js
CHANGED
|
@@ -8,7 +8,7 @@ export default function other() {
|
|
|
8
8
|
container,
|
|
9
9
|
name: 'GUI 1 (drag me!)',
|
|
10
10
|
width: 500,
|
|
11
|
-
draggable: true
|
|
11
|
+
draggable: true,
|
|
12
12
|
});
|
|
13
13
|
gui_1.button('Custom width using the `width` option', () => {});
|
|
14
14
|
|
|
@@ -30,24 +30,23 @@ export default function other() {
|
|
|
30
30
|
closed: true,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
gui_3.
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
let f1 = gui_3.folder({ name: 'folder', color: '#33329f' });
|
|
34
|
+
for (let i = 0; i < 3; i ++) {
|
|
35
|
+
f1.button('btn '+ i, () => {});
|
|
36
|
+
}
|
|
37
|
+
let f2 = gui_3.folder({ name: 'folder', color: '#9f3293' });
|
|
38
|
+
for (let i = 0; i < 3; i ++) {
|
|
39
|
+
f2.button('btn '+ i, () => {});
|
|
40
|
+
}
|
|
41
|
+
for (let i = 0; i < 10; i ++) {
|
|
42
|
+
gui_3.button('btn '+ i, () => {});
|
|
43
|
+
}
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
let f = gui_3.folder('dolor');
|
|
45
|
-
f.button('dolor', () => {});
|
|
46
|
-
f.button('dolor', () => {});
|
|
47
|
-
f.button('dolor', () => {});
|
|
48
|
-
gui_3.button('sit', () => {});
|
|
49
|
-
gui_3.button('amet', () => {});
|
|
50
|
-
gui_3.button('lorem', () => {});
|
|
51
|
-
gui_3.button('ipsum', () => {});
|
|
52
|
-
gui_3.button('ipsum', () => {});
|
|
45
|
+
const gui_4 = new GUI({
|
|
46
|
+
container,
|
|
47
|
+
position: 'bottom right',
|
|
48
|
+
name: 'GUI 4 (custom color)',
|
|
49
|
+
color: '#226666'
|
|
50
|
+
});
|
|
51
|
+
gui_4.button('lorem', () => {});
|
|
53
52
|
}
|