perfect-gui 4.0.7 → 4.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perfect-gui",
3
- "version": "4.0.7",
3
+ "version": "4.1.1",
4
4
  "description": "Nice and simple GUI for JavaScript",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -12,6 +12,7 @@ export default class GUI {
12
12
  }
13
13
 
14
14
  this.propReferences = [];
15
+ this.folders = [];
15
16
 
16
17
  if ( options.isFolder ) {
17
18
  this._folderConstructor(options.folderOptions);
@@ -72,8 +73,6 @@ export default class GUI {
72
73
 
73
74
  this.closed = false;
74
75
  if (options.closed) this.toggleClose();
75
-
76
- this.folders = [];
77
76
  }
78
77
 
79
78
  _styleInstance() {
@@ -512,8 +511,8 @@ export default class GUI {
512
511
  el: 'div',
513
512
  class: 'p-gui__vector2-area',
514
513
  onclick: (evt) => {
515
- objectX[propX] = parseFloat(this._mapLinear(evt.offsetX, 0, area.clientWidth, minX, maxX).toFixed(1));
516
- objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(1));
514
+ objectX[propX] = parseFloat(this._mapLinear(evt.offsetX, 0, area.clientWidth, minX, maxX).toFixed(2));
515
+ objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(2));
517
516
 
518
517
  if (callback) {
519
518
  callback(objectX[propX], objectX[propY]);
@@ -529,8 +528,8 @@ export default class GUI {
529
528
  });
530
529
  area.addEventListener('pointermove', (evt) => {
531
530
  if (pointer_is_down) {
532
- objectX[propX] = parseFloat(this._mapLinear(evt.offsetX, 0, area.clientWidth, minX, maxX).toFixed(1));
533
- objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(1));
531
+ objectX[propX] = parseFloat(this._mapLinear(evt.offsetX, 0, area.clientWidth, minX, maxX).toFixed(2));
532
+ objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(2));
534
533
 
535
534
  if (callback) {
536
535
  callback(objectX[propX], objectX[propY]);
@@ -621,6 +620,7 @@ export default class GUI {
621
620
  let closed = typeof options.closed == 'boolean' ? options.closed : false;
622
621
  let name = options.name || '';
623
622
  let color = options.color || null;
623
+ let maxHeight = options.maxHeight || null;
624
624
 
625
625
  this.imageContainer = null;
626
626
 
@@ -629,14 +629,17 @@ export default class GUI {
629
629
  if (this.folders.length == 0) {
630
630
  className += ' p-gui__folder--first';
631
631
  }
632
-
632
+
633
633
  if (closed) {
634
634
  className += ' p-gui__folder--closed';
635
635
  }
636
+
637
+ let container_style = color ? `background-color: ${color};` : '';
638
+ container_style += maxHeight ? `max-height: ${maxHeight}px;` : '';
636
639
 
637
640
  let container = this._createElement({
638
641
  class: className,
639
- inline: color ? `background-color: ${color};`: null,
642
+ inline: container_style,
640
643
  });
641
644
 
642
645
  let folderHeader = this._createElement({
package/src/styles.js CHANGED
@@ -301,7 +301,7 @@ return /* css */`
301
301
  width: 100%;
302
302
  position: relative;
303
303
  background: #434343;
304
- overflow: hidden;
304
+ overflow: auto;
305
305
  margin-bottom: 3px;
306
306
  display: flex;
307
307
  flex-wrap: wrap;