uil 4.0.7 → 4.0.8

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
@@ -1,8 +1,8 @@
1
- <p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.0.7</p>
1
+ <p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.0.8</p>
2
2
 
3
3
  uil.js is a lightweight ui for javascript with a complete 3d display support.<br>
4
4
  totally customizable, only 6 events, auto resize<br>
5
- [**Main example**](http://lo-th.github.io/uil/index.html)
5
+ [**MAIN EXAMPLE**](http://lo-th.github.io/uil/index.html)
6
6
 
7
7
  **1 - init engine**
8
8
  ```sh
package/build/uil.js CHANGED
@@ -1502,6 +1502,10 @@
1502
1502
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logoFill_d + "'/>";
1503
1503
  break;
1504
1504
 
1505
+ case 'donate':
1506
+ t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_donate + "'/>";
1507
+ break;
1508
+
1505
1509
  case 'neo':
1506
1510
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_neo + "'/>";
1507
1511
  break;
@@ -1538,6 +1542,22 @@
1538
1542
  186.75 221 202.95 204.85 219 188.8 219 166 L 219 52 M 194 52 L 181 52 181 166 Q 181 173 176.05 178 171.05 183 164 183 157 183 152 178 147 173 147 166 L 147 90 Q 147
1539
1543
  67.2 130.85 51.15 114.8 35 92 35 69.25 35 53.05 51.15 37 67.2 37 90 L 37 204 50 204 50 90 Q 50 72.6 62.25 60.35 74.6 48 92 48 109.4 48 121.65 60.35 134 72.6 134 90 L
1540
1544
  134 166 Q 134 178.4 142.85 187.15 151.6 196 164 196 176.45 196 185.25 187.15 194 178.4 194 166 L 194 52 Z
1545
+ `,
1546
+ logo_donate: `
1547
+ M 171.3 80.3 Q 179.5 62.15 171.3 45.8 164.1 32.5 141.35 30.1 L 94.35 30.1 Q 89.35 30.4 88.3 35.15 L 70.5 148.05 Q 70.2 152.5 73.7 152.6 L 100.95 152.6 107 111.6 Q 108.75
1548
+ 106.55 112.6 106.45 130.45 108.05 145.3 103.9 163.35 98.75 171.3 80.3 M 179.8 71.5 Q 178.6 79.75 174.9 87.85 168.45 102.9 151.9 109.15 140.65 113.95 117.55 113 113.15
1549
+ 112.75 111 117.45 L 102.7 169.95 Q 102.45 173.8 105.5 173.85 L 128.95 173.85 Q 132.2 174.2 133.35 169.65 L 138.3 139.95 Q 139.75 135.6 143.1 135.5 146.6 135.75 150.6 135.65
1550
+ 154.55 135.5 157.35 135.1 160.15 134.7 166.75 132.35 181.35 127.4 187.9 111.2 194.25 95.75 189.5 81.95 186.75 74.85 179.8 71.5 M 103.5 209.9 Q 103.5 202.85 99.7 198.85 95.95
1551
+ 194.75 89.4 194.75 82.8 194.75 79.05 198.85 75.3 202.9 75.3 209.9 75.3 216.85 79.05 220.95 82.8 225.05 89.4 225.05 95.95 225.05 99.7 221 103.5 216.95 103.5 209.9 M 95.45 205.5
1552
+ Q 95.95 207.3 95.95 209.9 95.95 212.65 95.45 214.35 94.95 216 94 217.3 93.1 218.45 91.9 219 90.7 219.55 89.4 219.55 88.15 219.55 86.95 219.05 85.75 218.55 84.8 217.3 83.9 216.15
1553
+ 83.4 214.35 82.85 212.6 82.85 209.9 82.85 207.3 83.4 205.45 83.95 203.55 84.85 202.45 85.9 201.2 86.95 200.75 88.05 200.25 89.4 200.25 90.7 200.25 91.85 200.8 93.05 201.3 94 202.5
1554
+ 94.9 203.65 95.45 205.5 M 153.3 195.35 L 145.3 195.35 135.5 224.45 142.8 224.45 144.6 218.5 153.75 218.5 155.6 224.45 163.1 224.45 153.3 195.35 M 152.15 213.25 L 146.25 213.25
1555
+ 149.2 203.65 152.15 213.25 M 116.75 195.35 L 107.8 195.35 107.8 224.45 114.5 224.45 114.5 204.2 125.7 224.45 132.75 224.45 132.75 195.35 126.05 195.35 126.05 212.05 116.75 195.35 M
1556
+ 66.5 197.65 Q 64.15 196.15 61.45 195.75 58.8 195.35 55.75 195.35 L 46.7 195.35 46.7 224.45 55.8 224.45 Q 58.8 224.45 61.5 224.05 64.15 223.6 66.4 222.15 69.15 220.45 70.9 217.2
1557
+ 72.7 214 72.7 209.95 72.7 205.7 71 202.6 69.35 199.5 66.5 197.65 M 64.2 205 Q 65.2 207 65.2 209.9 65.2 212.75 64.25 214.75 63.3 216.75 61.5 217.85 60 218.85 58.3 218.9 56.6 219
1558
+ 54.15 219 L 54 219 54 200.8 54.15 200.8 Q 56.4 200.8 58.05 200.9 59.7 200.95 61.15 201.75 63.2 202.95 64.2 205 M 210.2 195.35 L 190.5 195.35 190.5 224.45 210.2 224.45 210.2 218.9
1559
+ 197.75 218.9 197.75 211.55 209.2 211.55 209.2 206 197.75 206 197.75 200.9 210.2 200.9 210.2 195.35 M 187.5 195.35 L 163 195.35 163 200.9 171.6 200.9 171.6 224.45 178.9 224.45 178.9
1560
+ 200.9 187.5 200.9 187.5 195.35 Z
1541
1561
  `
1542
1562
  };
1543
1563
  T.setText();
@@ -1844,9 +1864,7 @@
1844
1864
  this.main = o.main || null;
1845
1865
  this.isUI = o.isUI || false;
1846
1866
  this.group = o.group || null;
1847
- this.isListen = false; //this.parentGroup = null;
1848
- //if( o.select !== undefined ) o.selectable = o.select
1849
-
1867
+ this.isListen = false;
1850
1868
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1851
1869
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1852
1870
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
@@ -1872,11 +1890,6 @@
1872
1890
  if (!this.isSpace) this.h = this.h < 11 ? 11 : this.h;else this.lock = true; // decale for canvas only
1873
1891
 
1874
1892
  this.fw = o.fw || 0;
1875
- /*this.dc = 0
1876
- if(this.isUI){
1877
- if( this.main.isCanvasOnly && this.fw) this.dc = (this.main.zone.w - this.w)*0.5
1878
- }*/
1879
-
1880
1893
  this.autoWidth = o.auto || true; // auto width or flex
1881
1894
 
1882
1895
  this.isOpen = false; // open statu
@@ -1923,13 +1936,10 @@
1923
1936
 
1924
1937
  this.c = []; // style
1925
1938
 
1926
- this.s = []; //this.c[0] = Tools.dom( 'div', this.css.basic + this.css.button +'align-self:stretch; position:relative; height:20px; overflow:hidden;'); //float:left;
1927
- //this.c[0] = Tools.dom( 'div', 'order: 1;' ); //
1928
-
1939
+ this.s = [];
1929
1940
  this.useFlex = this.isUI ? this.main.useFlex : false;
1930
- let flexible = this.useFlex ? 'disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1931
- this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;'); //this.c[0] = Tools.dom( 'div', this.css.basic +'position:relative; height:20px; align-self: auto;');
1932
-
1941
+ let flexible = this.useFlex ? 'display:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1942
+ this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;');
1933
1943
  this.s[0] = this.c[0].style; // bottom margin
1934
1944
 
1935
1945
  this.margin = o.margin || 1;
@@ -2264,7 +2274,6 @@
2264
2274
 
2265
2275
 
2266
2276
  handleEvent(e) {
2267
- //if(!this.s) return false
2268
2277
  if (this.lock) return;
2269
2278
  if (this.neverlock) Roots.lock = false;
2270
2279
  if (!this[e.type]) return console.error(e.type, 'this type of event no existe !');
@@ -2293,14 +2302,7 @@
2293
2302
 
2294
2303
  keyup(e) {
2295
2304
  return false;
2296
- }
2297
- /*dragstart ( e ) { return false; }
2298
- dragover ( e ) { return false; }
2299
- dragenter ( e ) { return false; }
2300
- dragleave ( e ) { return false; }
2301
- dragend ( e ) { return false; }
2302
- drop ( e ) { return false; }*/
2303
- // ----------------------
2305
+ } // ----------------------
2304
2306
  // object referency
2305
2307
  // ----------------------
2306
2308
 
@@ -2310,9 +2312,8 @@
2310
2312
  this.val = val;
2311
2313
  }
2312
2314
 
2313
- display(v) {
2314
- v = v || false;
2315
- this.s[0].visibility = v ? 'visible' : 'hidden'; //this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
2315
+ display(v = false) {
2316
+ this.s[0].visibility = v ? 'visible' : 'hidden';
2316
2317
  } // ----------------------
2317
2318
  // resize height
2318
2319
  // ----------------------
@@ -2514,15 +2515,15 @@
2514
2515
  this.values = o.value || this.txt;
2515
2516
  if (o.values) this.values = o.values;
2516
2517
  this.onName = o.onName || null;
2517
- this.on = false;
2518
- this.customSize = o.forceWidth || -1;
2518
+ this.on = false; // force button width
2519
+
2520
+ this.bw = o.forceWidth || 0;
2521
+ if (o.bw) this.bw = o.bw;
2522
+ this.space = o.space || 3;
2519
2523
  if (typeof this.values === 'string') this.values = [this.values];
2520
2524
  this.isDown = false;
2521
2525
  this.neverlock = true;
2522
- this.isLoadButton = o.loader || false;
2523
- this.isDragButton = o.drag || false;
2524
2526
  this.res = 0;
2525
- if (this.isDragButton) this.isLoadButton = true;
2526
2527
  this.lng = this.values.length;
2527
2528
  this.tmp = [];
2528
2529
  this.stat = [];
@@ -2541,21 +2542,12 @@
2541
2542
 
2542
2543
  if (!o.value && !o.values) {
2543
2544
  if (this.c[1] !== undefined) {
2544
- this.txt = '';
2545
2545
  this.c[1].textContent = '';
2546
+ this.txt = '';
2546
2547
  }
2547
2548
  }
2548
2549
 
2549
- if (!this.txt) this.p = 0; //
2550
-
2551
- if (this.isLoadButton) this.initLoader();
2552
-
2553
- if (this.isDragButton) {
2554
- this.lng++;
2555
- this.initDrager();
2556
- } //if( this.onName !== '' ) this.values[0] = this.on;
2557
-
2558
-
2550
+ if (!this.txt) this.p = 0;
2559
2551
  this.init();
2560
2552
  }
2561
2553
 
@@ -2587,7 +2579,7 @@
2587
2579
  if (this.res !== -1) {
2588
2580
  if (this.value === this.values[this.res] && this.unselectable) this.value = '';else this.value = this.values[this.res];
2589
2581
  if (this.onName !== null) this.onOff();
2590
- if (!this.isLoadButton) this.send();
2582
+ this.send();
2591
2583
  }
2592
2584
 
2593
2585
  return this.mousemove(e);
@@ -2681,95 +2673,6 @@
2681
2673
  this.res = -1;
2682
2674
  this.cursor();
2683
2675
  return this.modes();
2684
- } // ----------------------
2685
-
2686
-
2687
- dragover(e) {
2688
- e.preventDefault();
2689
- this.s[4].borderColor = this.colors.select;
2690
- this.s[4].color = this.colors.select;
2691
- }
2692
-
2693
- dragend(e) {
2694
- e.preventDefault();
2695
- this.s[4].borderColor = this.color.text;
2696
- this.s[4].color = this.color.text;
2697
- }
2698
-
2699
- drop(e) {
2700
- e.preventDefault();
2701
- this.dragend(e);
2702
- this.fileSelect(e.dataTransfer.files[0]);
2703
- }
2704
-
2705
- initDrager() {
2706
- this.c[4] = this.dom('div', this.css.txt + ' text-align:center; line-height:' + (this.h - 8) + 'px; border:1px dashed ' + this.color.text + '; top:2px; height:' + (this.h - 4) + 'px; border-radius:' + this.radius + 'px; pointer-events:auto;'); // cursor:default;
2707
-
2708
- this.c[4].textContent = 'DRAG';
2709
- this.c[4].addEventListener('dragover', function (e) {
2710
- this.dragover(e);
2711
- }.bind(this), false);
2712
- this.c[4].addEventListener('dragend', function (e) {
2713
- this.dragend(e);
2714
- }.bind(this), false);
2715
- this.c[4].addEventListener('dragleave', function (e) {
2716
- this.dragend(e);
2717
- }.bind(this), false);
2718
- this.c[4].addEventListener('drop', function (e) {
2719
- this.drop(e);
2720
- }.bind(this), false); //this.c[2].events = [ ];
2721
- //this.c[4].events = [ 'dragover', 'dragend', 'dragleave', 'drop' ];
2722
- }
2723
-
2724
- addLoader(n, callbackLoad) {
2725
- this.callbackLoad = callbackLoad;
2726
- let l = this.dom('input', this.css.basic + 'top:0px; opacity:0; height:100%; width:100%; pointer-events:auto; cursor:pointer;'); //
2727
-
2728
- l.name = 'loader';
2729
- l.type = "file";
2730
- l.addEventListener('change', function (e) {
2731
- this.fileSelect(e.target.files[0]);
2732
- }.bind(this), false);
2733
- this.c[n].appendChild(l);
2734
- return this;
2735
- }
2736
-
2737
- initLoader() {
2738
- this.c[3] = this.dom('input', this.css.basic + 'top:0px; opacity:0; height:' + this.h + 'px; pointer-events:auto; cursor:pointer;'); //
2739
-
2740
- this.c[3].name = 'loader';
2741
- this.c[3].type = "file";
2742
- this.c[3].addEventListener('change', function (e) {
2743
- this.fileSelect(e.target.files[0]);
2744
- }.bind(this), false); //this.c[3].addEventListener( 'mousedown', function(e){ }.bind(this), false );
2745
- //this.c[2].events = [ ];
2746
- //this.c[3].events = [ 'change', 'mouseover', 'mousedown', 'mouseup', 'mouseout' ];
2747
- //this.hide = document.createElement('input');
2748
- }
2749
-
2750
- fileSelect(file) {
2751
- let dataUrl = ['png', 'jpg', 'mp4', 'webm', 'ogg'];
2752
- let dataBuf = ['sea', 'z', 'hex', 'bvh', 'BVH', 'glb']; //if( ! e.target.files ) return;
2753
- //let file = e.target.files[0];
2754
- //this.c[3].type = "null";
2755
- // console.log( this.c[4] )
2756
-
2757
- if (file === undefined) return;
2758
- let reader = new FileReader();
2759
- let fname = file.name;
2760
- let type = fname.substring(fname.lastIndexOf('.') + 1, fname.length);
2761
- if (dataUrl.indexOf(type) !== -1) reader.readAsDataURL(file);else if (dataBuf.indexOf(type) !== -1) reader.readAsArrayBuffer(file); //reader.readAsArrayBuffer( file );
2762
- else reader.readAsText(file); // if( type === 'png' || type === 'jpg' || type === 'mp4' || type === 'webm' || type === 'ogg' ) reader.readAsDataURL( file );
2763
- //else if( type === 'z' ) reader.readAsBinaryString( file );
2764
- //else if( type === 'sea' || type === 'bvh' || type === 'BVH' || type === 'z') reader.readAsArrayBuffer( file );
2765
- //else if( ) reader.readAsArrayBuffer( file );
2766
- //else reader.readAsText( file );
2767
-
2768
- reader.onload = function (e) {
2769
- if (this.callbackLoad) this.callbackLoad(e.target.result, fname, type); //if( this.callback ) this.callback( e.target.result, fname, type );
2770
- //this.c[3].type = "file";
2771
- //this.send( e.target.result );
2772
- }.bind(this);
2773
2676
  }
2774
2677
 
2775
2678
  label(string, n) {
@@ -2790,11 +2693,12 @@
2790
2693
  let w = this.sb;
2791
2694
  let d = this.sa;
2792
2695
  let i = this.lng;
2793
- let dc = 3;
2696
+ let dc = this.space;
2794
2697
  let size = Math.floor((w - dc * (i - 1)) / i);
2795
2698
 
2796
- if (this.customSize !== -1) {
2797
- size = this.customSize; // d = (this.s-size)*0.5
2699
+ if (this.bw) {
2700
+ size = this.bw < size ? this.bw : size;
2701
+ d = Math.floor((this.w - (size * i + dc * (i - 1))) * 0.5);
2798
2702
  }
2799
2703
 
2800
2704
  while (i--) {
@@ -2803,16 +2707,6 @@
2803
2707
  s[i + 2].left = this.tmp[i][0] + 'px';
2804
2708
  s[i + 2].width = this.tmp[i][1] + 'px';
2805
2709
  }
2806
-
2807
- if (this.isDragButton) {
2808
- s[4].left = d + size + dc + 'px';
2809
- s[4].width = size + 'px';
2810
- }
2811
-
2812
- if (this.isLoadButton) {
2813
- s[3].left = d + 'px';
2814
- s[3].width = size + 'px';
2815
- }
2816
2710
  }
2817
2711
 
2818
2712
  }
@@ -3015,9 +2909,9 @@
3015
2909
  this.s[2].top = 'auto';
3016
2910
  this.s[2].bottom = '2px';
3017
2911
  } //this.c[0].style.textAlign = 'center';
3018
- //this.c[0].style.flex = '1 0 auto'
3019
2912
 
3020
2913
 
2914
+ this.c[0].style.display = 'block';
3021
2915
  this.c[3] = this.getColorRing();
3022
2916
  this.c[3].style.visibility = 'hidden';
3023
2917
  this.hsl = null;
@@ -3817,11 +3711,11 @@
3817
3711
  super(o);
3818
3712
  this.isGroup = true;
3819
3713
  this.ADD = o.add;
3820
- this.uis = [];
3821
- this.isEmpty = true;
3822
3714
  this.autoHeight = true;
3715
+ this.uis = [];
3823
3716
  this.current = -1;
3824
- this.targetIn = null;
3717
+ this.proto = null;
3718
+ this.isEmpty = true;
3825
3719
  this.decal = 0;
3826
3720
  this.baseH = this.h;
3827
3721
  let fltop = Math.floor(this.h * 0.5) - 6;
@@ -3857,17 +3751,10 @@
3857
3751
  s[1].lineHeight = this.h - 4;
3858
3752
  s[1].color = this.colors.text;
3859
3753
  s[1].fontWeight = 'bold';
3860
- if (this.radius !== 0) s[0].borderRadius = this.radius + 'px'; //if( o.border ) s[0].border = '1px solid ' + o.border;
3861
-
3862
- /*if(this.decal){
3863
- s[0].boxSizing = 'border-box';
3864
- s[0].backgroundClip = 'border-box';
3865
- s[0].border = (this.decal/3)+'px solid ' + o.group.colors.background;
3866
- }*/
3867
-
3754
+ if (this.radius !== 0) s[0].borderRadius = this.radius + 'px';
3868
3755
  this.init();
3869
3756
  this.setBG(o.bg);
3870
- if (o.open !== undefined) this.open(); //s[0].background = this.bg;
3757
+ if (o.open !== undefined) this.open();
3871
3758
  }
3872
3759
 
3873
3760
  testZone(e) {
@@ -3881,12 +3768,16 @@
3881
3768
  }
3882
3769
 
3883
3770
  clearTarget() {
3884
- if (this.current === -1) return false; // if(!this.targetIn ) return;
3771
+ if (this.current === -1) return false;
3772
+
3773
+ if (this.proto.s) {
3774
+ // if no s target is delete !!
3775
+ this.proto.uiout();
3776
+ this.proto.reset();
3777
+ }
3885
3778
 
3886
- this.targetIn.uiout();
3887
- this.targetIn.reset();
3779
+ this.proto = null;
3888
3780
  this.current = -1;
3889
- this.targetIn = null;
3890
3781
  this.cursor();
3891
3782
  return true;
3892
3783
  }
@@ -3901,7 +3792,7 @@
3901
3792
  handleEvent(e) {
3902
3793
  let type = e.type;
3903
3794
  let change = false;
3904
- let targetChange = false;
3795
+ let protoChange = false;
3905
3796
  let name = this.testZone(e);
3906
3797
  if (!name) return;
3907
3798
 
@@ -3909,8 +3800,7 @@
3909
3800
  case 'content':
3910
3801
  this.cursor();
3911
3802
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
3912
- if (this.targetIn) targetChange = this.targetIn.handleEvent(e); //if( type === 'mousemove' ) change = this.styles('def');
3913
-
3803
+ if (this.proto) protoChange = this.proto.handleEvent(e);
3914
3804
  if (!Roots.lock) this.getNext(e, change);
3915
3805
  break;
3916
3806
 
@@ -3925,7 +3815,7 @@
3925
3815
  }
3926
3816
 
3927
3817
  if (this.isDown) change = true;
3928
- if (targetChange) change = true;
3818
+ if (protoChange) change = true;
3929
3819
  return change;
3930
3820
  }
3931
3821
 
@@ -3938,30 +3828,11 @@
3938
3828
  }
3939
3829
 
3940
3830
  if (next !== -1) {
3941
- this.targetIn = this.uis[this.current];
3942
- this.targetIn.uiover();
3831
+ this.proto = this.uis[this.current];
3832
+ this.proto.uiover();
3943
3833
  }
3944
3834
  } // ----------------------
3945
3835
 
3946
- /*calcH () {
3947
- let lng = this.uis.length, i, u, h=0, px=0, tmph=0;
3948
- for( i = 0; i < lng; i++){
3949
- u = this.uis[i];
3950
- if( !u.autoWidth ){
3951
- if(px===0) h += u.h+1;
3952
- else {
3953
- if(tmph<u.h) h += u.h-tmph;
3954
- }
3955
- tmph = u.h;
3956
- //tmph = tmph < u.h ? u.h : tmph;
3957
- px += u.w;
3958
- if( px+u.w > this.w ) px = 0;
3959
- }
3960
- else h += u.h+1;
3961
- }
3962
- return h;
3963
- }*/
3964
-
3965
3836
 
3966
3837
  setBG(bg) {
3967
3838
  if (bg !== undefined) this.colors.background = bg;
@@ -3992,12 +3863,10 @@
3992
3863
  a[2].main = this.main;
3993
3864
  a[2].group = this;
3994
3865
  }
3995
- } //let n = add.apply( this, a );
3996
-
3866
+ }
3997
3867
 
3998
3868
  let u = this.ADD.apply(this, a);
3999
- this.uis.push(u); //this.calc()
4000
-
3869
+ this.uis.push(u);
4001
3870
  this.isEmpty = false;
4002
3871
  return u;
4003
3872
  } // remove one node
@@ -4011,7 +3880,7 @@
4011
3880
  dispose() {
4012
3881
  this.clear();
4013
3882
  if (this.isUI) this.main.calc();
4014
- super.dispose(); //Proto.prototype.clear.call( this );
3883
+ super.dispose();
4015
3884
  }
4016
3885
 
4017
3886
  clear() {
@@ -4068,9 +3937,7 @@
4068
3937
 
4069
3938
  calcUis() {
4070
3939
  if (!this.isOpen) this.h = this.baseH;else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH) + this.baseH;
4071
- this.s[0].height = this.h + 'px'; //console.log('G', this.h)
4072
- //if( !this.isOpen ) return;
4073
- //this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH )+this.baseH;
3940
+ this.s[0].height = this.h + 'px';
4074
3941
  }
4075
3942
 
4076
3943
  parentHeight(t) {
@@ -4079,16 +3946,6 @@
4079
3946
 
4080
3947
  calc(y) {
4081
3948
  if (!this.isOpen) return;
4082
- /*
4083
- if( y !== undefined ){
4084
- this.h += y;
4085
- if( this.isUI ) this.main.calc( y );
4086
- } else {
4087
- this.h = this.calcH() + this.baseH;
4088
- }
4089
- this.s[0].height = this.h + 'px';*/
4090
- // if(this.isOpen)
4091
-
4092
3949
  if (this.isUI) this.main.calc();else this.calcUis();
4093
3950
  this.s[0].height = this.h + 'px';
4094
3951
  }
@@ -4099,8 +3956,7 @@
4099
3956
  while (i--) {
4100
3957
  this.uis[i].setSize(this.w);
4101
3958
  this.uis[i].rSize();
4102
- } //this.calc()
4103
-
3959
+ }
4104
3960
  }
4105
3961
 
4106
3962
  rSize() {
@@ -6711,8 +6567,7 @@
6711
6567
 
6712
6568
  this.canvas = null;
6713
6569
  this.screen = null;
6714
- this.plane = o.plane || null;
6715
- this.isEmpty = true; // color
6570
+ this.plane = o.plane || null; // color
6716
6571
 
6717
6572
  if (o.config) o.colors = o.config;
6718
6573
  if (o.colors) this.setConfig(o.colors);else this.colors = Tools.defineColor(o); // style
@@ -6760,7 +6615,8 @@
6760
6615
  this.isScroll = false;
6761
6616
  this.uis = [];
6762
6617
  this.current = -1;
6763
- this.target = null;
6618
+ this.proto = null;
6619
+ this.isEmpty = true;
6764
6620
  this.decal = 0;
6765
6621
  this.ratio = 1;
6766
6622
  this.oy = 0;
@@ -6879,7 +6735,11 @@
6879
6735
  }
6880
6736
 
6881
6737
  hide(b) {
6882
- this.content.style.display = b ? 'none' : 'block';
6738
+ this.content.style.visibility = b ? 'hidden' : 'visible';
6739
+ }
6740
+
6741
+ display(v = false) {
6742
+ this.content.style.visibility = v ? 'visible' : 'hidden';
6883
6743
  }
6884
6744
 
6885
6745
  onChange(f) {
@@ -6936,13 +6796,13 @@
6936
6796
  clearTarget() {
6937
6797
  if (this.current === -1) return false;
6938
6798
 
6939
- if (this.target.s) {
6799
+ if (this.proto.s) {
6940
6800
  // if no s target is delete !!
6941
- this.target.uiout();
6942
- this.target.reset();
6801
+ this.proto.uiout();
6802
+ this.proto.reset();
6943
6803
  }
6944
6804
 
6945
- this.target = null;
6805
+ this.proto = null;
6946
6806
  this.current = -1; ///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
6947
6807
 
6948
6808
  Roots.cursor();
@@ -6968,7 +6828,7 @@
6968
6828
  handleEvent(e) {
6969
6829
  let type = e.type;
6970
6830
  let change = false;
6971
- let targetChange = false;
6831
+ let protoChange = false;
6972
6832
  let name = this.testZone(e);
6973
6833
  if (type === 'mouseup' && this.isDown) this.isDown = false;
6974
6834
  if (type === 'mousedown' && !this.isDown) this.isDown = true;
@@ -6984,9 +6844,9 @@
6984
6844
  case 'content':
6985
6845
  e.clientY = this.isScroll ? e.clientY + this.decal : e.clientY;
6986
6846
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
6987
- if (this.target) targetChange = this.target.handleEvent(e);
6847
+ if (this.proto) protoChange = this.proto.handleEvent(e);
6988
6848
  if (type === 'mousemove') change = this.mode('def');
6989
- if (type === 'wheel' && !targetChange && this.isScroll) change = this.onWheel(e);
6849
+ if (type === 'wheel' && !protoChange && this.isScroll) change = this.onWheel(e);
6990
6850
 
6991
6851
  if (!Roots.lock) {
6992
6852
  this.getNext(e, change);
@@ -7019,7 +6879,7 @@
7019
6879
  }
7020
6880
 
7021
6881
  if (this.isDown) change = true;
7022
- if (targetChange) change = true;
6882
+ if (protoChange) change = true;
7023
6883
  if (type === 'keyup') change = true;
7024
6884
  if (type === 'keydown') change = true;
7025
6885
  if (change) this.draw();
@@ -7035,8 +6895,8 @@
7035
6895
  }
7036
6896
 
7037
6897
  if (next !== -1) {
7038
- this.target = this.uis[this.current];
7039
- this.target.uiover();
6898
+ this.proto = this.uis[this.current];
6899
+ this.proto.uiover();
7040
6900
  }
7041
6901
  }
7042
6902
 
@@ -7087,28 +6947,10 @@
7087
6947
  let u = add.apply(this, a);
7088
6948
  if (u === null) return;
7089
6949
  if (ontop) this.uis.unshift(u);else this.uis.push(u);
7090
- /*if( !u.autoWidth ){
7091
- let y = u.c[0].getBoundingClientRect().top;
7092
- if( this.prevY !== y ){
7093
- this.calc( u.h + 1 );
7094
- this.prevY = y;
7095
- }
7096
- }else{
7097
- this.prevY = 0;//-1;
7098
- this.calc( u.h + 1 );
7099
- }*/
7100
-
7101
6950
  this.calc();
7102
6951
  this.isEmpty = false;
7103
6952
  return u;
7104
- }
7105
- /*applyCalc () {
7106
- //console.log(this.uis.length, this.tmpH )
7107
- this.calc( this.tmpH );
7108
- //this.tmpH = 0;
7109
- this.tmpAdd = null;
7110
- }*/
7111
- // remove one node
6953
+ } // remove one node
7112
6954
 
7113
6955
 
7114
6956
  remove(n) {
@@ -7136,14 +6978,11 @@
7136
6978
  while (i--) {
7137
6979
  item = this.uis.pop();
7138
6980
  this.inner.removeChild(item.c[0]);
7139
- item.dispose(); //this.uis[i].clear()
6981
+ item.dispose();
7140
6982
  }
7141
6983
 
7142
6984
  this.uis = [];
7143
- this.isEmpty = true; //this.zone = { x:0, y:0, w:this.size.w, h:0 };
7144
- //this.setWidth()
7145
- //Roots.listens = [];
7146
-
6985
+ this.isEmpty = true;
7147
6986
  this.calc();
7148
6987
  }
7149
6988
 
@@ -7199,8 +7038,7 @@
7199
7038
  this.total = this.h;
7200
7039
  this.maxView = this.maxHeight;
7201
7040
  this.ratio = this.maxView / this.total;
7202
- this.sh = this.maxView * this.ratio; //if( this.sh < 20 ) this.sh = 20;
7203
-
7041
+ this.sh = this.maxView * this.ratio;
7204
7042
  this.range = this.maxView - this.sh;
7205
7043
  this.oy = Tools.clamp(this.oy, 0, this.range);
7206
7044
  this.scrollBG.style.height = this.maxView + 'px';
@@ -7243,23 +7081,19 @@
7243
7081
  let diff = this.h - this.maxHeight;
7244
7082
 
7245
7083
  if (diff > 1) {
7246
- //this.h > this.maxHeight ){
7247
7084
  this.isScroll = true;
7248
7085
  this.zone.h = this.maxHeight + this.bh;
7249
7086
  } else {
7250
7087
  this.zone.h = this.h + this.bh;
7251
7088
  }
7252
- } //if( this.forceHeight ) this.zone.h = this.forceHeight
7253
-
7089
+ }
7254
7090
 
7255
7091
  this.upScroll(this.isScroll);
7256
7092
  this.innerContent.style.height = this.zone.h - this.bh + 'px';
7257
7093
  this.content.style.height = this.zone.h + 'px';
7258
7094
  this.bottom.style.top = this.zone.h - this.bh + 'px';
7259
- if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px'; //console.log( this.zone, this.bh )
7260
- //if( this.isOpen ) this.calcUis()
7261
-
7262
- if (this.isCanvas) this.draw(true); //else if( !this.transition ) this.rezone()
7095
+ if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px';
7096
+ if (this.isCanvas) this.draw(true);
7263
7097
  }
7264
7098
 
7265
7099
  rezone() {
@@ -7268,14 +7102,10 @@
7268
7102
 
7269
7103
  setWidth(w) {
7270
7104
  if (w) this.zone.w = w;
7271
- this.zone.w = Math.floor(this.zone.w); //console.log( this.zone.w )
7272
-
7105
+ this.zone.w = Math.floor(this.zone.w);
7273
7106
  this.content.style.width = this.zone.w + 'px';
7274
7107
  if (this.isCenter) this.content.style.marginLeft = -Math.floor(this.zone.w * 0.5) + 'px';
7275
- this.setItemWidth(this.zone.w - this.sw); //this.setHeight();
7276
- //this.calc()
7277
- //if( this.isCanvasOnly ) Roots.needReZone = true;
7278
- //Roots.resize();
7108
+ this.setItemWidth(this.zone.w - this.sw);
7279
7109
  }
7280
7110
 
7281
7111
  setItemWidth(w) {
@@ -7289,7 +7119,7 @@
7289
7119
 
7290
7120
  }
7291
7121
 
7292
- const REVISION = '4.0.7';
7122
+ const REVISION = '4.0.8';
7293
7123
 
7294
7124
  exports.Files = Files;
7295
7125
  exports.Gui = Gui;