perfect-gui 3.4.4 → 3.4.5

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 CHANGED
@@ -7,7 +7,7 @@ Features:
7
7
  - easy positioning
8
8
  - draggable panels
9
9
 
10
- <img src="https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/capture.png" width="464"/>
10
+ <img src="https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/capture.png" width="580"/>
11
11
 
12
12
  ## Demo
13
13
  https://thibka.github.io/perfect-gui/public/
@@ -166,4 +166,6 @@ gui.toggleClose();
166
166
 
167
167
 
168
168
  ## To do
169
- - Adding color palette component
169
+ - Color palette component
170
+ - Vector2 drag & drop
171
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perfect-gui",
3
- "version": "3.4.4",
3
+ "version": "3.4.5",
4
4
  "description": "Nice and simple GUI for JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "directories": {
package/src/styles.js CHANGED
@@ -18,7 +18,7 @@ return /* css */`
18
18
  font-family: Verdana, Arial, sans-serif;
19
19
  width: 290px;
20
20
  overflow: auto;
21
- box-shadow: 0 0 10px black;
21
+ box-shadow: 0 0 5px black;
22
22
  box-sizing: border-box;
23
23
  z-index: 99999;
24
24
  user-select: none;
@@ -75,7 +75,7 @@ return /* css */`
75
75
  width: calc(33.33% - 10px);
76
76
  aspect-ratio: 1 / 1;
77
77
  background-size: cover;
78
- margin: 5px 5px 19px 5px;
78
+ margin: 1px 5px 19px 5px;
79
79
  cursor: pointer;
80
80
  position: relative;
81
81
  }
@@ -184,7 +184,7 @@ return /* css */`
184
184
  .p-gui__switch-checkbox {
185
185
  width: 5px;
186
186
  height: 5px;
187
- background-color: #343434;
187
+ background-color: rgba(0, 0, 0, .5);
188
188
  position: absolute;
189
189
  top: 0;
190
190
  right: 8px;
package/test/src/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import './styles/main.scss';
2
- import perfectGUI from '../../src/index';
3
- //import full_featured_gui from './js/full_featured';
2
+ import full_featured from './js/full_featured';
4
3
  import basics from './js/basics';
5
4
  import vectors from './js/vectors';
6
5
  import multiple from './js/multiple';
@@ -8,6 +7,8 @@ import folders from './js/folders';
8
7
  import other from './js/other';
9
8
  import kill_create from './js/kill_create';
10
9
 
10
+ //full_featured();
11
+
11
12
  basics();
12
13
 
13
14
  vectors();
@@ -11,6 +11,7 @@ export default function basics() {
11
11
  const gui = new GUI({
12
12
  name: 'Basics',
13
13
  container: '#container-1',
14
+ draggable: true
14
15
  });
15
16
 
16
17
  gui.button('Button', () => {
@@ -1,84 +1,66 @@
1
+ // <div id="container-0" class="container" style="height: 800px; border-radius: 0;"></div>
1
2
 
3
+ import GUI from '../../../src/index';
2
4
 
3
- const full_featured_gui = new perfectGUI({
4
- name: "This is a basic panel",
5
- draggable: true,
6
- container: '#container-1'
7
- });
5
+ export default function()
6
+ {
7
+ const element = document.querySelector('#container-0 .element');
8
+ const note = document.querySelector('#container-0 .note');
8
9
 
9
- full_featured_gui.image(
10
- 'Background 1',
11
- 'https://images.unsplash.com/photo-1485254767195-60704c46702e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=768&q=80',
12
- () => {
13
- full_featured_gui.container.style.backgroundImage = `url(https://images.unsplash.com/photo-1485254767195-60704c46702e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80)`;
14
- full_featured_gui.container.style.backgroundColor = `none`;
15
- document.getElementById('note').textContent = "Photo by Joel Filipe on Unsplash";
16
- }
17
- );
18
- full_featured_gui.image(
19
- 'Background 2',
20
- 'https://images.unsplash.com/photo-1535370976884-f4376736ab06?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=768&q=80',
21
- () => {
22
- full_featured_gui.container.style.backgroundImage = `url(https://images.unsplash.com/photo-1535370976884-f4376736ab06?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=564&q=80)`;
23
- full_featured_gui.container.style.backgroundColor = `none`;
24
- document.getElementById('note').textContent = "Photo by Richard M. on Unsplash";
25
- }
26
- );
27
- full_featured_gui.image(
28
- 'Background 3',
29
- 'https://images.unsplash.com/photo-1524721696987-b9527df9e512?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=768&q=80',
30
- () => {
31
- full_featured_gui.container.style.backgroundImage = `url(https://images.unsplash.com/photo-1524721696987-b9527df9e512?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1490&q=80)`;
32
- full_featured_gui.container.style.backgroundColor = `none`;
33
- document.getElementById('note').textContent = "Photo by Cassi Josh on Unsplash";
34
- }
35
- );
36
- full_featured_gui.image(
37
- 'Background 4',
38
- 'https://images.unsplash.com/photo-1574169208507-84376144848b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=768&q=80',
39
- () => {
40
- full_featured_gui.container.style.backgroundImage = `url(https://images.unsplash.com/photo-1574169208507-84376144848b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=768&q=80)`;
41
- full_featured_gui.container.style.backgroundColor = `none`;
42
- document.getElementById('note').textContent = "Photo by United States Geological Survey on Unsplash";
43
- }
44
- );
10
+ const gui = new GUI({
11
+ draggable: true,
12
+ container: '#container-0',
13
+ name: 'Control panel'
14
+ });
45
15
 
46
- let folder = full_featured_gui.folder('Some folder');
47
16
 
48
- folder.button("Random element color", () => {
49
- element.style.backgroundColor = get_random_color();
50
- });
17
+ gui.button("Randomize color", () => {
18
+ element.style.backgroundColor = get_random_color();
19
+ });
20
+ gui.slider({name: 'Intensity', min: .1, max: 2, value: .75, step: .01 }, (value) => {
21
+ element.style.transform = `scale(${value})`;
22
+ });
23
+ gui.slider({name: 'Scale', min: 0, max: 50, value: 25, step: 25 }, (value) => {
24
+ element.style.borderRadius = `${value}%`;
25
+ });
51
26
 
52
- folder.image(
53
- 'Background 5',
54
- 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1024&q=80',
55
- () => {
56
- full_featured_gui.container.style.backgroundImage = `url(https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1024&q=80)`;
57
- full_featured_gui.container.style.backgroundColor = `none`;
58
- document.getElementById('note').textContent = "Photo by Milad Fakurian on Unsplash";
59
- }
60
- );
27
+ let folder1 = gui.folder({name: 'Texture'});
61
28
 
62
- full_featured_gui.button("Random element color", () => {
63
- element.style.backgroundColor = get_random_color();
64
- });
65
- full_featured_gui.slider("Scale", {min: .1, max: 2, value: 1, step: .01 }, (value) => {
66
- element.style.transform = `scale(${value})`;
67
- });
68
- full_featured_gui.slider("3-step border-radius", {min: 0, max: 50, value: 0, step: 25 }, (value) => {
69
- element.style.borderRadius = `${value}%`;
70
- });
29
+ folder1.image(
30
+ 'The officer',
31
+ require('../img/DALL·E 2022-11-13 20.11.16 - portrait of a squirrel in an officier suit, style of a Rembrandt painting.png'),
32
+ () => {}
33
+ );
34
+ folder1.image(
35
+ 'Weird dream',
36
+ require('../img/DALL·E 2022-11-13 20.11.52 - a blonde girl riding a whale in the style of hopper.png'),
37
+ () => {}
38
+ );
39
+ folder1.image(
40
+ 'Friends',
41
+ require('../img/DALL·E 2022-11-13 20.13.55 - 1 blonde haired girl with her orange cat, watching the whales in Tadoussac, Canada. In the style of an oil painting..png'),
42
+ () => {}
43
+ );
71
44
 
72
- let folder2 = full_featured_gui.folder('ok', false);
73
- folder2.button("Random element color", () => {
74
- element.style.backgroundColor = get_random_color();
75
- });
45
+ let folder2 = gui.folder({name: 'Normals', closed: true});
46
+ folder2.button("Random element color", () => {});
76
47
 
77
- full_featured_gui.toggle("Opacity switch", true, (state) => {
78
- if (!state) element.style.opacity = .5;
79
- else element.style.opacity = 1;
80
- });
48
+ gui.toggle("Rim light", true, (state) => {});
81
49
 
82
- full_featured_gui.list('Select a color', ['red', 'pink', 'yellow', 'blue'], function(item) {
83
- element.style.backgroundColor = item;
84
- });
50
+ gui.toggle("Direct light", false, (state) => {});
51
+
52
+ gui.list('Preset', ['Atomic', 'pink', 'yellow', 'blue'], function(item) {});
53
+
54
+
55
+ let position = { x: 2, y: 1};
56
+ const gui2 = new GUI({
57
+ draggable: true,
58
+ container: '#container-0',
59
+ name: 'Position panel'
60
+ });
61
+ gui2.vector2('Position', {
62
+ x: {min: -10, max: 10, object: position, prop: 'x'},
63
+ y: {min: -10, max: 10, object: position, prop: 'y'},
64
+ }, () => {});
65
+ gui2.button('Randomize', () => {});
66
+ }
Binary file