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 +1 -1
- package/src/index.js +11 -8
- package/src/styles.js +1 -1
package/package.json
CHANGED
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(
|
|
516
|
-
objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(
|
|
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(
|
|
533
|
-
objectY[propY] = parseFloat(this._mapLinear(evt.offsetY, 0, area.clientHeight, maxY, minY).toFixed(
|
|
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:
|
|
642
|
+
inline: container_style,
|
|
640
643
|
});
|
|
641
644
|
|
|
642
645
|
let folderHeader = this._createElement({
|