uil 4.0.4 → 4.0.9

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.
@@ -394,8 +394,12 @@ const R = {
394
394
 
395
395
  tw = R.getWidth(u);
396
396
  if( tw ) u.zone.w = u.w = tw;
397
+ // focrce width if content is canvas
398
+ else if( u.fw ) u.zone.w = u.w = u.fw;
399
+
397
400
 
398
- //console.log( u.name, u.zone.w, u.w, zone )
401
+ //console.log( u.name, u.zone.w, u.w, zone, tw )
402
+ //console.log( tw )
399
403
  px += u.zone.w;
400
404
 
401
405
  if( px >= zone.w ) {
@@ -477,7 +481,8 @@ const R = {
477
481
 
478
482
 
479
483
 
480
- return o.getDom().offsetWidth
484
+ //return o.getDom().offsetWidth
485
+ return o.getDom().clientWidth
481
486
 
482
487
  //let r = o.getDom().getBoundingClientRect();
483
488
  //return (r.width)
@@ -1648,6 +1653,9 @@ const T = {
1648
1653
  case 'logo':
1649
1654
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logoFill_d+"'/>";
1650
1655
  break;
1656
+ case 'donate':
1657
+ t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_donate+"'/>";
1658
+ break;
1651
1659
  case 'neo':
1652
1660
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_neo+"'/>";
1653
1661
  break;
@@ -1687,12 +1695,261 @@ const T = {
1687
1695
  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
1688
1696
  `,
1689
1697
 
1698
+ logo_donate:`
1699
+ 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
1700
+ 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
1701
+ 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
1702
+ 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
1703
+ 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
1704
+ 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
1705
+ 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
1706
+ 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
1707
+ 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
1708
+ 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
1709
+ 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
1710
+ 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
1711
+ 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
1712
+ 200.9 187.5 200.9 187.5 195.35 Z
1713
+ `,
1714
+
1690
1715
  };
1691
1716
 
1692
1717
  T.setText();
1693
1718
 
1694
1719
  const Tools = T;
1695
1720
 
1721
+ ///https://wicg.github.io/file-system-access/#api-filesystemfilehandle-getfile
1722
+
1723
+
1724
+ class Files {
1725
+
1726
+ //-----------------------------
1727
+ // FILE TYPE
1728
+ //-----------------------------
1729
+
1730
+ static autoTypes( type ) {
1731
+
1732
+ let t = [];
1733
+
1734
+ switch( type ){
1735
+ case 'json':
1736
+ t = [ { accept: { 'image/svg+xml': '.svg'} }, ];
1737
+ break;
1738
+ case 'text':
1739
+ t = [ { description: 'Text Files', accept: { 'text/plain': ['.txt', '.text'], 'text/html': ['.html', '.htm'] } }, ];
1740
+ break;
1741
+ case 'json':
1742
+ t = [ { description: 'JSON Files', accept: { 'text/plain': ['.json'] } }, ];
1743
+ break;
1744
+ case 'image':
1745
+ t = [ { description: 'Images', accept: { 'image/*': ['.png', '.gif', '.jpeg', '.jpg'] } }, ];
1746
+ break;
1747
+
1748
+ }
1749
+
1750
+ return t
1751
+
1752
+ }
1753
+
1754
+
1755
+ //-----------------------------
1756
+ // LOAD
1757
+ //-----------------------------
1758
+
1759
+ static async load( o = {} ) {
1760
+
1761
+ if (typeof window.showOpenFilePicker !== 'function') {
1762
+ window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
1763
+ }
1764
+
1765
+ try {
1766
+
1767
+ let type = o.type || '';
1768
+
1769
+ const options = {
1770
+ excludeAcceptAllOption: type ? true : false,
1771
+ multiple: false,
1772
+ //startIn:'./assets'
1773
+ };
1774
+
1775
+ options.types = this.autoTypes( type );
1776
+
1777
+ // create a new handle
1778
+ const handle = await window.showOpenFilePicker( options );
1779
+ const file = await handle[0].getFile();
1780
+ //let content = await file.text()
1781
+
1782
+ if( !file ) return null
1783
+
1784
+ let fname = file.name;
1785
+ let ftype = fname.substring( fname.lastIndexOf('.')+1, fname.length );
1786
+
1787
+ const dataUrl = [ 'png', 'jpg', 'jpeg', 'mp4', 'webm', 'ogg', 'mp3' ];
1788
+ const dataBuf = [ 'sea', 'z', 'hex', 'bvh', 'BVH', 'glb', 'gltf' ];
1789
+ const reader = new FileReader();
1790
+
1791
+ if( dataUrl.indexOf( ftype ) !== -1 ) reader.readAsDataURL( file );
1792
+ else if( dataBuf.indexOf( ftype ) !== -1 ) reader.readAsArrayBuffer( file );
1793
+ else reader.readAsText( file );
1794
+
1795
+ reader.onload = function(e) {
1796
+
1797
+ let content = e.target.result;
1798
+
1799
+ if( type === 'image' ){
1800
+ var img = new Image;
1801
+ img.onload = function() {
1802
+ if( o.callback ) o.callback( img, fname );
1803
+ };
1804
+ img.src = content;
1805
+ } else {
1806
+ if( o.callback ) o.callback( content, fname );
1807
+ }
1808
+
1809
+ };
1810
+
1811
+ } catch(e) {
1812
+
1813
+ console.log(e);
1814
+
1815
+ }
1816
+
1817
+ }
1818
+
1819
+ static showOpenFilePickerPolyfill( options ) {
1820
+ return new Promise((resolve) => {
1821
+ const input = document.createElement("input");
1822
+ input.type = "file";
1823
+ input.multiple = options.multiple;
1824
+ input.accept = options.types
1825
+ .map((type) => type.accept)
1826
+ .flatMap((inst) => Object.keys(inst).flatMap((key) => inst[key]))
1827
+ .join(",");
1828
+
1829
+ input.addEventListener("change", () => {
1830
+ resolve(
1831
+ [...input.files].map((file) => {
1832
+ return {
1833
+ getFile: async () =>
1834
+ new Promise((resolve) => {
1835
+ resolve(file);
1836
+ }),
1837
+ };
1838
+ })
1839
+ );
1840
+ });
1841
+
1842
+ input.click();
1843
+ })
1844
+ }
1845
+
1846
+
1847
+ //-----------------------------
1848
+ // SAVE
1849
+ //-----------------------------
1850
+
1851
+ static async save( o = {} ) {
1852
+
1853
+ this.usePoly = false;
1854
+
1855
+ if (typeof window.showSaveFilePicker !== 'function') {
1856
+ window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1857
+ this.usePoly = true;
1858
+ }
1859
+
1860
+ try {
1861
+
1862
+ let type = o.type || '';
1863
+
1864
+ const options = {
1865
+ suggestedName: o.name || 'hello',
1866
+ data: o.data || ''
1867
+ };
1868
+
1869
+
1870
+ options.types = this.autoTypes( type );
1871
+ options.finalType = Object.keys(options.types[0].accept )[0];
1872
+ options.suggestedName += options.types[0].accept[options.finalType][0];
1873
+
1874
+
1875
+ // create a new handle
1876
+ const handle = await window.showSaveFilePicker( options );
1877
+
1878
+ if( this.usePoly ) return
1879
+
1880
+ // create a FileSystemWritableFileStream to write to
1881
+ const file = await handle.createWritable();
1882
+
1883
+ let blob = new Blob([ options.data ], { type: option.finalType });
1884
+
1885
+ // write our file
1886
+ await file.write(blob);
1887
+
1888
+ // close the file and write the contents to disk.
1889
+ await file.close();
1890
+
1891
+ } catch(e) {
1892
+
1893
+ console.log(e);
1894
+
1895
+ }
1896
+
1897
+ }
1898
+
1899
+ static showSaveFilePickerPolyfill( options ) {
1900
+ return new Promise((resolve) => {
1901
+ const a = document.createElement("a");
1902
+ a.download = options.suggestedName || "my-file.txt";
1903
+ let blob = new Blob([ options.data ], { type:options.finalType });
1904
+ a.href = URL.createObjectURL( blob );
1905
+
1906
+ a.addEventListener("click", () => {
1907
+ resolve(
1908
+ setTimeout( () => URL.revokeObjectURL(a.href), 1000 )
1909
+ );
1910
+ });
1911
+ a.click();
1912
+ })
1913
+ }
1914
+
1915
+
1916
+ //-----------------------------
1917
+ // FOLDER not possible in poly
1918
+ //-----------------------------
1919
+
1920
+ static async getFolder() {
1921
+
1922
+ try {
1923
+
1924
+ const handle = await window.showDirectoryPicker();
1925
+ const files = [];
1926
+ for await (const entry of handle.values()) {
1927
+ const file = await entry.getFile();
1928
+ files.push(file);
1929
+ }
1930
+
1931
+ console.log(files);
1932
+ return files;
1933
+
1934
+ } catch(e) {
1935
+
1936
+ console.log(e);
1937
+
1938
+ }
1939
+
1940
+ }
1941
+
1942
+
1943
+
1944
+
1945
+
1946
+
1947
+
1948
+
1949
+
1950
+
1951
+ }
1952
+
1696
1953
  class V2 {
1697
1954
 
1698
1955
  constructor( x = 0, y = 0 ) {
@@ -1851,14 +2108,9 @@ class Proto {
1851
2108
 
1852
2109
  this.isListen = false;
1853
2110
 
1854
-
1855
- //this.parentGroup = null;
1856
-
1857
- //if( o.select !== undefined ) o.selectable = o.select
1858
2111
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1859
2112
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1860
2113
 
1861
-
1862
2114
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
1863
2115
 
1864
2116
  this.css = this.main ? this.main.css : Tools.css;
@@ -1884,7 +2136,10 @@ class Proto {
1884
2136
  if( !this.isSpace ) this.h = this.h < 11 ? 11 : this.h;
1885
2137
  else this.lock = true;
1886
2138
 
1887
-
2139
+
2140
+ // decale for canvas only
2141
+ this.fw = o.fw || 0;
2142
+
1888
2143
  this.autoWidth = o.auto || true;// auto width or flex
1889
2144
  this.isOpen = false;// open statu
1890
2145
 
@@ -1947,13 +2202,10 @@ class Proto {
1947
2202
  this.s = [];
1948
2203
 
1949
2204
 
1950
- //this.c[0] = Tools.dom( 'div', this.css.basic + this.css.button +'align-self:stretch; position:relative; height:20px; overflow:hidden;'); //float:left;
1951
- //this.c[0] = Tools.dom( 'div', 'order: 1;' ); //
1952
2205
  this.useFlex = this.isUI ? this.main.useFlex : false;
1953
- let flexible = this.useFlex ? 'disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
2206
+ let flexible = this.useFlex ? 'display:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1954
2207
 
1955
2208
  this.c[0] = Tools.dom( 'div', this.css.basic + flexible + 'position:relative; height:20px;');
1956
- //this.c[0] = Tools.dom( 'div', this.css.basic +'position:relative; height:20px; align-self: auto;');
1957
2209
 
1958
2210
 
1959
2211
  this.s[0] = this.c[0].style;
@@ -2394,26 +2646,13 @@ class Proto {
2394
2646
  }
2395
2647
 
2396
2648
  wheel( e ) { return false; }
2397
-
2398
2649
  mousedown( e ) { return false; }
2399
-
2400
2650
  mousemove( e ) { return false; }
2401
-
2402
2651
  mouseup( e ) { return false; }
2403
-
2404
2652
  keydown( e ) { return false; }
2405
-
2406
2653
  keyup( e ) { return false; }
2407
2654
 
2408
2655
 
2409
- /*dragstart ( e ) { return false; }
2410
- dragover ( e ) { return false; }
2411
- dragenter ( e ) { return false; }
2412
- dragleave ( e ) { return false; }
2413
- dragend ( e ) { return false; }
2414
- drop ( e ) { return false; }*/
2415
-
2416
-
2417
2656
  // ----------------------
2418
2657
  // object referency
2419
2658
  // ----------------------
@@ -2425,12 +2664,8 @@ class Proto {
2425
2664
 
2426
2665
  }
2427
2666
 
2428
- display( v ) {
2429
-
2430
- v = v || false;
2667
+ display( v = false ) {
2431
2668
  this.s[0].visibility = v ? 'visible' : 'hidden';
2432
- //this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
2433
-
2434
2669
  }
2435
2670
 
2436
2671
  // ----------------------
@@ -2664,17 +2899,16 @@ class Button extends Proto {
2664
2899
 
2665
2900
  this.on = false;
2666
2901
 
2667
- this.customSize = o.forceWidth || -1;
2902
+ // force button width
2903
+ this.bw = o.forceWidth || 0;
2904
+ if(o.bw) this.bw = o.bw;
2905
+ this.space = o.space || 3;
2668
2906
 
2669
2907
  if( typeof this.values === 'string' ) this.values = [ this.values ];
2670
2908
 
2671
2909
  this.isDown = false;
2672
2910
  this.neverlock = true;
2673
- this.isLoadButton = o.loader || false;
2674
- this.isDragButton = o.drag || false;
2675
2911
  this.res = 0;
2676
-
2677
- if( this.isDragButton ) this.isLoadButton = true;
2678
2912
 
2679
2913
  this.lng = this.values.length;
2680
2914
  this.tmp = [];
@@ -2695,22 +2929,13 @@ class Button extends Proto {
2695
2929
 
2696
2930
  }
2697
2931
 
2698
- if( !o.value || !o.values ){
2699
- if( this.c[1] !== undefined ) this.c[1].textContent = '';
2700
- this.p = o.p !== undefined ? o.p : 0;
2701
- } else {
2702
- if( !this.txt ) this.p = 0;
2703
- }
2704
-
2705
- //
2706
-
2707
- if( this.isLoadButton ) this.initLoader();
2708
- if( this.isDragButton ){
2709
- this.lng ++;
2710
- this.initDrager();
2711
- }
2712
-
2713
- //if( this.onName !== '' ) this.values[0] = this.on;
2932
+ if( !o.value && !o.values ){
2933
+ if( this.c[1] !== undefined ) {
2934
+ this.c[1].textContent = '';
2935
+ this.txt = '';
2936
+ }
2937
+ }
2938
+ if( !this.txt ) this.p = 0;
2714
2939
 
2715
2940
  this.init();
2716
2941
 
@@ -2752,7 +2977,7 @@ class Button extends Proto {
2752
2977
  if( this.value === this.values[this.res] && this.unselectable ) this.value = '';
2753
2978
  else this.value = this.values[this.res];
2754
2979
  if( this.onName !== null ) this.onOff();
2755
- if( !this.isLoadButton ) this.send();
2980
+ this.send();
2756
2981
  }
2757
2982
 
2758
2983
  return this.mousemove( e )
@@ -2812,6 +3037,8 @@ class Button extends Proto {
2812
3037
 
2813
3038
  mode ( n, id ) {
2814
3039
 
3040
+ //if(!this.s) return false
3041
+
2815
3042
  let change = false;
2816
3043
  let cc = this.colors, s = this.s;
2817
3044
  let i = id+2;
@@ -2847,104 +3074,6 @@ class Button extends Proto {
2847
3074
 
2848
3075
  }
2849
3076
 
2850
- // ----------------------
2851
-
2852
- dragover ( e ) {
2853
-
2854
- e.preventDefault();
2855
-
2856
- this.s[4].borderColor = this.colors.select;
2857
- this.s[4].color = this.colors.select;
2858
-
2859
- }
2860
-
2861
- dragend ( e ) {
2862
-
2863
- e.preventDefault();
2864
-
2865
- this.s[4].borderColor = this.color.text;
2866
- this.s[4].color = this.color.text;
2867
-
2868
- }
2869
-
2870
- drop ( e ) {
2871
-
2872
- e.preventDefault();
2873
-
2874
- this.dragend(e);
2875
- this.fileSelect( e.dataTransfer.files[0] );
2876
-
2877
- }
2878
-
2879
- initDrager () {
2880
-
2881
- 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;
2882
- this.c[4].textContent = 'DRAG';
2883
-
2884
- this.c[4].addEventListener( 'dragover', function(e){ this.dragover(e); }.bind(this), false );
2885
- this.c[4].addEventListener( 'dragend', function(e){ this.dragend(e); }.bind(this), false );
2886
- this.c[4].addEventListener( 'dragleave', function(e){ this.dragend(e); }.bind(this), false );
2887
- this.c[4].addEventListener( 'drop', function(e){ this.drop(e); }.bind(this), false );
2888
-
2889
- //this.c[2].events = [ ];
2890
- //this.c[4].events = [ 'dragover', 'dragend', 'dragleave', 'drop' ];
2891
-
2892
-
2893
- }
2894
-
2895
- initLoader () {
2896
-
2897
- this.c[3] = this.dom( 'input', this.css.basic +'top:0px; opacity:0; height:'+(this.h)+'px; pointer-events:auto; cursor:pointer;' );//
2898
- this.c[3].name = 'loader';
2899
- this.c[3].type = "file";
2900
-
2901
- this.c[3].addEventListener( 'change', function(e){ this.fileSelect( e.target.files[0] ); }.bind(this), false );
2902
- //this.c[3].addEventListener( 'mousedown', function(e){ }.bind(this), false );
2903
-
2904
- //this.c[2].events = [ ];
2905
- //this.c[3].events = [ 'change', 'mouseover', 'mousedown', 'mouseup', 'mouseout' ];
2906
-
2907
- //this.hide = document.createElement('input');
2908
-
2909
- }
2910
-
2911
- fileSelect ( file ) {
2912
-
2913
- let dataUrl = [ 'png', 'jpg', 'mp4', 'webm', 'ogg' ];
2914
- let dataBuf = [ 'sea', 'z', 'hex', 'bvh', 'BVH', 'glb' ];
2915
-
2916
- //if( ! e.target.files ) return;
2917
-
2918
- //let file = e.target.files[0];
2919
-
2920
- //this.c[3].type = "null";
2921
- // console.log( this.c[4] )
2922
-
2923
- if( file === undefined ) return;
2924
-
2925
- let reader = new FileReader();
2926
- let fname = file.name;
2927
- let type = fname.substring(fname.lastIndexOf('.')+1, fname.length );
2928
-
2929
- if( dataUrl.indexOf( type ) !== -1 ) reader.readAsDataURL( file );
2930
- else if( dataBuf.indexOf( type ) !== -1 ) reader.readAsArrayBuffer( file );//reader.readAsArrayBuffer( file );
2931
- else reader.readAsText( file );
2932
-
2933
- // if( type === 'png' || type === 'jpg' || type === 'mp4' || type === 'webm' || type === 'ogg' ) reader.readAsDataURL( file );
2934
- //else if( type === 'z' ) reader.readAsBinaryString( file );
2935
- //else if( type === 'sea' || type === 'bvh' || type === 'BVH' || type === 'z') reader.readAsArrayBuffer( file );
2936
- //else if( ) reader.readAsArrayBuffer( file );
2937
- //else reader.readAsText( file );
2938
-
2939
- reader.onload = function (e) {
2940
-
2941
- if( this.callback ) this.callback( e.target.result, fname, type );
2942
- //this.c[3].type = "file";
2943
- //this.send( e.target.result );
2944
- }.bind(this);
2945
-
2946
- }
2947
-
2948
3077
  label ( string, n ) {
2949
3078
 
2950
3079
  n = n || 2;
@@ -2971,13 +3100,12 @@ class Button extends Proto {
2971
3100
  let d = this.sa;
2972
3101
 
2973
3102
  let i = this.lng;
2974
- let dc = 3;
3103
+ let dc = this.space;
2975
3104
  let size = Math.floor( ( w-(dc*(i-1)) ) / i );
2976
3105
 
2977
- if( this.customSize !== -1 ){
2978
- size = this.customSize;
2979
- // d = (this.s-size)*0.5
2980
-
3106
+ if( this.bw ){
3107
+ size = this.bw < size ? this.bw : size;
3108
+ d = Math.floor((this.w-( (size * i) + (dc * (i-1)) ))*0.5);
2981
3109
  }
2982
3110
 
2983
3111
  while( i-- ){
@@ -2990,16 +3118,6 @@ class Button extends Proto {
2990
3118
 
2991
3119
  }
2992
3120
 
2993
- if( this.isDragButton ){
2994
- s[4].left = (d+size+dc) + 'px';
2995
- s[4].width = size + 'px';
2996
- }
2997
-
2998
- if( this.isLoadButton ){
2999
- s[3].left = d + 'px';
3000
- s[3].width = size + 'px';
3001
- }
3002
-
3003
3121
  }
3004
3122
 
3005
3123
  }
@@ -3029,6 +3147,7 @@ class Circular extends Proto {
3029
3147
  this.top = 0;
3030
3148
 
3031
3149
  this.c[0].style.width = this.w +'px';
3150
+ this.c[0].style.display = 'block';
3032
3151
 
3033
3152
  if(this.c[1] !== undefined) {
3034
3153
 
@@ -3267,7 +3386,7 @@ class Color extends Proto {
3267
3386
  }
3268
3387
 
3269
3388
  //this.c[0].style.textAlign = 'center';
3270
- //this.c[0].style.flex = '1 0 auto'
3389
+ this.c[0].style.display = 'block';
3271
3390
 
3272
3391
  this.c[3] = this.getColorRing();
3273
3392
  this.c[3].style.visibility = 'hidden';
@@ -4282,14 +4401,12 @@ class Group extends Proto {
4282
4401
 
4283
4402
  this.ADD = o.add;
4284
4403
 
4285
- this.uis = [];
4286
-
4287
- this.isEmpty = true;
4288
-
4289
4404
  this.autoHeight = true;
4290
- this.current = -1;
4291
- this.targetIn = null;
4292
4405
 
4406
+ this.uis = [];
4407
+ this.current = -1;
4408
+ this.proto = null;
4409
+ this.isEmpty = true;
4293
4410
  this.decal = 0;
4294
4411
 
4295
4412
  this.baseH = this.h;
@@ -4315,9 +4432,6 @@ class Group extends Proto {
4315
4432
  if( this.isLine ) this.c[5] = this.dom( 'div', this.css.basic + 'background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px');
4316
4433
 
4317
4434
  let s = this.s;
4318
-
4319
-
4320
-
4321
4435
  s[0].height = this.h + 'px';
4322
4436
  s[1].height = this.h + 'px';
4323
4437
  this.c[1].name = 'group';
@@ -4327,28 +4441,13 @@ class Group extends Proto {
4327
4441
  s[1].color = this.colors.text;
4328
4442
  s[1].fontWeight = 'bold';
4329
4443
 
4330
- if( this.radius !== 0 ) s[0].borderRadius = this.radius+'px';
4331
- //if( o.border ) s[0].border = '1px solid ' + o.border;
4332
-
4333
-
4334
- /*if(this.decal){
4335
- s[0].boxSizing = 'border-box';
4336
- s[0].backgroundClip = 'border-box';
4337
- s[0].border = (this.decal/3)+'px solid ' + o.group.colors.background;
4338
- }*/
4339
-
4340
-
4341
-
4342
-
4444
+ if( this.radius !== 0 ) s[0].borderRadius = this.radius+'px';
4343
4445
  this.init();
4344
4446
 
4345
4447
  this.setBG( o.bg );
4346
4448
 
4347
4449
  if( o.open !== undefined ) this.open();
4348
4450
 
4349
-
4350
- //s[0].background = this.bg;
4351
-
4352
4451
  }
4353
4452
 
4354
4453
  testZone ( e ) {
@@ -4370,12 +4469,13 @@ class Group extends Proto {
4370
4469
  clearTarget () {
4371
4470
 
4372
4471
  if( this.current === -1 ) return false;
4373
-
4374
- // if(!this.targetIn ) return;
4375
- this.targetIn .uiout();
4376
- this.targetIn .reset();
4472
+ if( this.proto.s ){
4473
+ // if no s target is delete !!
4474
+ this.proto.uiout();
4475
+ this.proto.reset();
4476
+ }
4477
+ this.proto = null;
4377
4478
  this.current = -1;
4378
- this.targetIn = null;
4379
4479
  this.cursor();
4380
4480
  return true;
4381
4481
 
@@ -4396,7 +4496,7 @@ class Group extends Proto {
4396
4496
  let type = e.type;
4397
4497
 
4398
4498
  let change = false;
4399
- let targetChange = false;
4499
+ let protoChange = false;
4400
4500
 
4401
4501
  let name = this.testZone( e );
4402
4502
 
@@ -4409,9 +4509,7 @@ class Group extends Proto {
4409
4509
 
4410
4510
  if( Roots.isMobile && type === 'mousedown' ) this.getNext( e, change );
4411
4511
 
4412
- if( this.targetIn ) targetChange = this.targetIn .handleEvent( e );
4413
-
4414
- //if( type === 'mousemove' ) change = this.styles('def');
4512
+ if( this.proto ) protoChange = this.proto.handleEvent( e );
4415
4513
 
4416
4514
  if( !Roots.lock ) this.getNext( e, change );
4417
4515
 
@@ -4428,7 +4526,7 @@ class Group extends Proto {
4428
4526
  }
4429
4527
 
4430
4528
  if( this.isDown ) change = true;
4431
- if( targetChange ) change = true;
4529
+ if( protoChange ) change = true;
4432
4530
 
4433
4531
  return change;
4434
4532
 
@@ -4444,41 +4542,14 @@ class Group extends Proto {
4444
4542
  }
4445
4543
 
4446
4544
  if( next !== -1 ){
4447
- this.targetIn = this.uis[ this.current ];
4448
- this.targetIn .uiover();
4545
+ this.proto = this.uis[ this.current ];
4546
+ this.proto.uiover();
4449
4547
  }
4450
4548
 
4451
4549
  }
4452
4550
 
4453
4551
  // ----------------------
4454
4552
 
4455
- /*calcH () {
4456
-
4457
- let lng = this.uis.length, i, u, h=0, px=0, tmph=0;
4458
- for( i = 0; i < lng; i++){
4459
- u = this.uis[i];
4460
- if( !u.autoWidth ){
4461
-
4462
- if(px===0) h += u.h+1;
4463
- else {
4464
- if(tmph<u.h) h += u.h-tmph;
4465
- }
4466
- tmph = u.h;
4467
-
4468
- //tmph = tmph < u.h ? u.h : tmph;
4469
- px += u.w;
4470
- if( px+u.w > this.w ) px = 0;
4471
-
4472
- }
4473
- else h += u.h+1;
4474
- }
4475
-
4476
- return h;
4477
- }*/
4478
-
4479
-
4480
-
4481
-
4482
4553
  setBG ( bg ) {
4483
4554
 
4484
4555
  if( bg !== undefined ) this.colors.background = bg;
@@ -4511,15 +4582,10 @@ class Group extends Proto {
4511
4582
  }
4512
4583
  }
4513
4584
 
4514
- //let n = add.apply( this, a );
4515
4585
  let u = this.ADD.apply( this, a );
4516
4586
 
4517
4587
  this.uis.push( u );
4518
4588
 
4519
- //this.calc()
4520
-
4521
-
4522
-
4523
4589
  this.isEmpty = false;
4524
4590
 
4525
4591
  return u;
@@ -4540,9 +4606,7 @@ class Group extends Proto {
4540
4606
 
4541
4607
  this.clear();
4542
4608
  if( this.isUI ) this.main.calc();
4543
-
4544
4609
  super.dispose();
4545
- //Proto.prototype.clear.call( this );
4546
4610
 
4547
4611
  }
4548
4612
 
@@ -4626,12 +4690,6 @@ class Group extends Proto {
4626
4690
 
4627
4691
  this.s[0].height = this.h + 'px';
4628
4692
 
4629
- //console.log('G', this.h)
4630
-
4631
- //if( !this.isOpen ) return;
4632
-
4633
- //this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH )+this.baseH;
4634
-
4635
4693
  }
4636
4694
 
4637
4695
  parentHeight ( t ) {
@@ -4643,22 +4701,9 @@ class Group extends Proto {
4643
4701
 
4644
4702
  calc ( y ) {
4645
4703
 
4646
- if( !this.isOpen ) return;
4647
-
4648
- /*
4649
-
4650
- if( y !== undefined ){
4651
- this.h += y;
4652
- if( this.isUI ) this.main.calc( y );
4653
- } else {
4654
- this.h = this.calcH() + this.baseH;
4655
- }
4656
- this.s[0].height = this.h + 'px';*/
4657
-
4658
- // if(this.isOpen)
4704
+ if( !this.isOpen ) return
4659
4705
  if( this.isUI ) this.main.calc();
4660
4706
  else this.calcUis();
4661
-
4662
4707
  this.s[0].height = this.h + 'px';
4663
4708
 
4664
4709
  }
@@ -4671,8 +4716,6 @@ class Group extends Proto {
4671
4716
  this.uis[i].rSize();
4672
4717
  }
4673
4718
 
4674
- //this.calc()
4675
-
4676
4719
  }
4677
4720
 
4678
4721
  rSize () {
@@ -4714,6 +4757,7 @@ class Joystick extends Proto {
4714
4757
  this.tmp = new V2();
4715
4758
 
4716
4759
  this.interval = null;
4760
+ this.c[0].style.display = 'block';
4717
4761
 
4718
4762
  //this.radius = this.w * 0.5;
4719
4763
  //this.distance = this.radius*0.25;
@@ -4955,6 +4999,7 @@ class Knob extends Proto {
4955
4999
  this.top = 0;
4956
5000
 
4957
5001
  this.c[0].style.width = this.w +'px';
5002
+ this.c[0].style.display = 'block';
4958
5003
 
4959
5004
  if(this.c[1] !== undefined) {
4960
5005
 
@@ -7536,6 +7581,10 @@ class Pad2D extends Proto {
7536
7581
 
7537
7582
  //console.log(this.range)
7538
7583
 
7584
+ this.c[0].style.display = 'block';
7585
+
7586
+
7587
+
7539
7588
 
7540
7589
 
7541
7590
  this.precision = o.precision === undefined ? 2 : o.precision;
@@ -7625,6 +7674,7 @@ class Pad2D extends Proto {
7625
7674
  mousedown ( e ) {
7626
7675
 
7627
7676
  if ( this.testZone(e) === 'pad' ) {
7677
+
7628
7678
  this.isDown = true;
7629
7679
  this.mousemove( e );
7630
7680
  return this.mode(1);
@@ -7789,8 +7839,8 @@ const add = function () {
7789
7839
 
7790
7840
  ref = true;
7791
7841
  if( a[2] === undefined ) [].push.call(a, {});
7792
-
7793
- type = a[2].type ? a[2].type : 'slide';//autoType.apply( this, a );
7842
+
7843
+ type = a[2].type ? a[2].type : autoType( a[0][a[1]], a[2] );
7794
7844
 
7795
7845
  o = a[2];
7796
7846
  o.name = a[1];
@@ -7799,13 +7849,15 @@ const add = function () {
7799
7849
 
7800
7850
  }
7801
7851
 
7852
+
7853
+
7802
7854
  let name = type.toLowerCase();
7803
7855
 
7804
7856
  if( name === 'group' ) o.add = add;
7805
7857
 
7806
7858
  switch( name ){
7807
7859
 
7808
- case 'bool': n = new Bool(o); break;
7860
+ case 'bool': case 'boolean': n = new Bool(o); break;
7809
7861
  case 'button': n = new Button(o); break;
7810
7862
  case 'circular': n = new Circular(o); break;
7811
7863
  case 'color': n = new Color(o); break;
@@ -7835,6 +7887,37 @@ const add = function () {
7835
7887
 
7836
7888
  }
7837
7889
 
7890
+ };
7891
+
7892
+ const autoType = function ( v, o ) {
7893
+
7894
+ let type = 'slide';
7895
+
7896
+ if( typeof v === 'boolean' ) type = 'bool';
7897
+ else if( typeof v === 'string' ){
7898
+
7899
+ if( v.substring(0,1) === '#' ) type = 'color';
7900
+ else type = 'string';
7901
+
7902
+ } else if( typeof v === 'number' ){
7903
+
7904
+ if( o.ctype ) type = 'color';
7905
+ else type = 'slide';
7906
+
7907
+ } else if( typeof v === 'array' && v instanceof Array ){
7908
+
7909
+ if( typeof v[0] === 'number' ) type = 'number';
7910
+ else if( typeof v[0] === 'string' ) type = 'list';
7911
+
7912
+ } else if( typeof v === 'object' && v instanceof Object ){
7913
+
7914
+ if( v.x !== undefined ) type = 'number';
7915
+ else type = 'list';
7916
+
7917
+ }
7918
+
7919
+ return type
7920
+
7838
7921
  };
7839
7922
 
7840
7923
  /**
@@ -7854,7 +7937,7 @@ class Gui {
7854
7937
  this.screen = null;
7855
7938
  this.plane = o.plane || null;
7856
7939
 
7857
- this.isEmpty = true;
7940
+
7858
7941
 
7859
7942
  // color
7860
7943
  if( o.config ) o.colors = o.config;
@@ -7918,9 +8001,9 @@ class Gui {
7918
8001
  this.isScroll = false;
7919
8002
 
7920
8003
  this.uis = [];
7921
-
7922
8004
  this.current = -1;
7923
- this.target = null;
8005
+ this.proto = null;
8006
+ this.isEmpty = true;
7924
8007
  this.decal = 0;
7925
8008
  this.ratio = 1;
7926
8009
  this.oy = 0;
@@ -7974,6 +8057,8 @@ class Gui {
7974
8057
  if( !this.isCanvasOnly ){
7975
8058
  this.content.style.pointerEvents = 'auto';
7976
8059
  } else {
8060
+ this.content.style.left = '0px';
8061
+ this.content.style.right = 'auto';
7977
8062
  o.transition = 0;
7978
8063
  }
7979
8064
 
@@ -8024,6 +8109,8 @@ class Gui {
8024
8109
  this.canvas.width = this.zone.w;
8025
8110
  this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h;
8026
8111
 
8112
+ //console.log( this.canvas.width, this.canvas.height )
8113
+
8027
8114
  }
8028
8115
 
8029
8116
  draw ( force ) {
@@ -8081,9 +8168,11 @@ class Gui {
8081
8168
  }
8082
8169
 
8083
8170
  hide ( b ) {
8171
+ this.content.style.visibility = b ? 'hidden' : 'visible';
8172
+ }
8084
8173
 
8085
- this.content.style.display = b ? 'none' : 'block';
8086
-
8174
+ display( v = false ) {
8175
+ this.content.style.visibility = v ? 'visible' : 'hidden';
8087
8176
  }
8088
8177
 
8089
8178
  onChange ( f ) {
@@ -8149,10 +8238,13 @@ class Gui {
8149
8238
  clearTarget () {
8150
8239
 
8151
8240
  if( this.current === -1 ) return false;
8152
- //if(!this.target) return;
8153
- this.target.uiout();
8154
- this.target.reset();
8155
- this.target = null;
8241
+ if( this.proto.s ){
8242
+ // if no s target is delete !!
8243
+ this.proto.uiout();
8244
+ this.proto.reset();
8245
+ }
8246
+
8247
+ this.proto = null;
8156
8248
  this.current = -1;
8157
8249
 
8158
8250
  ///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
@@ -8195,7 +8287,7 @@ class Gui {
8195
8287
  let type = e.type;
8196
8288
 
8197
8289
  let change = false;
8198
- let targetChange = false;
8290
+ let protoChange = false;
8199
8291
 
8200
8292
  let name = this.testZone( e );
8201
8293
 
@@ -8214,10 +8306,10 @@ class Gui {
8214
8306
 
8215
8307
  if( Roots.isMobile && type === 'mousedown' ) this.getNext( e, change );
8216
8308
 
8217
- if( this.target ) targetChange = this.target.handleEvent( e );
8309
+ if( this.proto ) protoChange = this.proto.handleEvent( e );
8218
8310
 
8219
8311
  if( type === 'mousemove' ) change = this.mode('def');
8220
- if( type === 'wheel' && !targetChange && this.isScroll ) change = this.onWheel( e );
8312
+ if( type === 'wheel' && !protoChange && this.isScroll ) change = this.onWheel( e );
8221
8313
 
8222
8314
  if( !Roots.lock ) {
8223
8315
  this.getNext( e, change );
@@ -8252,7 +8344,7 @@ class Gui {
8252
8344
  }
8253
8345
 
8254
8346
  if( this.isDown ) change = true;
8255
- if( targetChange ) change = true;
8347
+ if( protoChange ) change = true;
8256
8348
 
8257
8349
  if( type === 'keyup' ) change = true;
8258
8350
  if( type === 'keydown' ) change = true;
@@ -8276,8 +8368,8 @@ class Gui {
8276
8368
  }
8277
8369
 
8278
8370
  if( next !== -1 ){
8279
- this.target = this.uis[ this.current ];
8280
- this.target.uiover();
8371
+ this.proto = this.uis[ this.current ];
8372
+ this.proto.uiover();
8281
8373
  }
8282
8374
 
8283
8375
  }
@@ -8337,8 +8429,8 @@ class Gui {
8337
8429
  else {
8338
8430
  a[2].isUI = true;
8339
8431
  a[2].main = this;
8340
-
8341
- ontop = a[1].ontop ? a[1].ontop : false;
8432
+ //ontop = a[1].ontop ? a[1].ontop : false;
8433
+ ontop = a[2].ontop ? a[2].ontop : false;
8342
8434
  }
8343
8435
 
8344
8436
  }
@@ -8350,17 +8442,6 @@ class Gui {
8350
8442
  if( ontop ) this.uis.unshift( u );
8351
8443
  else this.uis.push( u );
8352
8444
 
8353
- /*if( !u.autoWidth ){
8354
- let y = u.c[0].getBoundingClientRect().top;
8355
- if( this.prevY !== y ){
8356
- this.calc( u.h + 1 );
8357
- this.prevY = y;
8358
- }
8359
- }else{
8360
- this.prevY = 0;//-1;
8361
- this.calc( u.h + 1 );
8362
- }*/
8363
-
8364
8445
  this.calc();
8365
8446
 
8366
8447
  this.isEmpty = false;
@@ -8369,18 +8450,6 @@ class Gui {
8369
8450
 
8370
8451
  }
8371
8452
 
8372
- /*applyCalc () {
8373
-
8374
- //console.log(this.uis.length, this.tmpH )
8375
-
8376
- this.calc( this.tmpH );
8377
- //this.tmpH = 0;
8378
- this.tmpAdd = null;
8379
-
8380
- }*/
8381
-
8382
-
8383
-
8384
8453
  // remove one node
8385
8454
 
8386
8455
  remove ( n ) {
@@ -8415,19 +8484,12 @@ class Gui {
8415
8484
  item = this.uis.pop();
8416
8485
  this.inner.removeChild( item.c[0] );
8417
8486
  item.dispose();
8418
-
8419
- //this.uis[i].clear()
8420
8487
  }
8421
8488
 
8422
8489
  this.uis = [];
8423
8490
  this.isEmpty = true;
8424
- //this.zone = { x:0, y:0, w:this.size.w, h:0 };
8425
- //this.setWidth()
8426
- //Roots.listens = [];
8427
8491
  this.calc();
8428
8492
 
8429
-
8430
-
8431
8493
  }
8432
8494
 
8433
8495
  clear() {
@@ -8444,11 +8506,11 @@ class Gui {
8444
8506
 
8445
8507
  }
8446
8508
 
8509
+
8447
8510
  // ----------------------
8448
8511
  // ITEMS SPECIAL
8449
8512
  // ----------------------
8450
8513
 
8451
-
8452
8514
  resetItem () {
8453
8515
 
8454
8516
  if( !this.isItemMode ) return;
@@ -8463,12 +8525,11 @@ class Gui {
8463
8525
  if( !this.isItemMode ) return;
8464
8526
 
8465
8527
  name = name || '';
8466
-
8467
8528
  this.resetItem();
8468
8529
 
8469
8530
  if( !name ){
8470
8531
  this.update(0);
8471
- return;
8532
+ return
8472
8533
  }
8473
8534
 
8474
8535
  let i = this.uis.length;
@@ -8502,8 +8563,6 @@ class Gui {
8502
8563
  this.ratio = this.maxView / this.total;
8503
8564
  this.sh = this.maxView * this.ratio;
8504
8565
 
8505
- //if( this.sh < 20 ) this.sh = 20;
8506
-
8507
8566
  this.range = this.maxView - this.sh;
8508
8567
 
8509
8568
  this.oy = Tools.clamp( this.oy, 0, this.range );
@@ -8562,7 +8621,7 @@ class Gui {
8562
8621
 
8563
8622
  let diff = this.h - this.maxHeight;
8564
8623
 
8565
- if( diff > 1 ){ //this.h > this.maxHeight ){
8624
+ if( diff > 1 ){
8566
8625
 
8567
8626
  this.isScroll = true;
8568
8627
  this.zone.h = this.maxHeight + this.bh;
@@ -8584,9 +8643,7 @@ class Gui {
8584
8643
 
8585
8644
  if( this.forceHeight && this.lockHeight ) this.content.style.height = this.forceHeight + 'px';
8586
8645
 
8587
- //if( this.isOpen ) this.calcUis()
8588
8646
  if( this.isCanvas ) this.draw( true );
8589
- //else if( !this.transition ) this.rezone()
8590
8647
 
8591
8648
  }
8592
8649
 
@@ -8600,20 +8657,12 @@ class Gui {
8600
8657
 
8601
8658
  this.zone.w = Math.floor( this.zone.w );
8602
8659
 
8603
- //console.log( this.zone.w )
8604
-
8605
8660
  this.content.style.width = this.zone.w + 'px';
8606
8661
 
8607
8662
  if( this.isCenter ) this.content.style.marginLeft = -(Math.floor(this.zone.w*0.5)) + 'px';
8608
8663
 
8609
8664
  this.setItemWidth( this.zone.w - this.sw );
8610
8665
 
8611
- //this.setHeight();
8612
- //this.calc()
8613
-
8614
- //if( this.isCanvasOnly ) Roots.needReZone = true;
8615
- //Roots.resize();
8616
-
8617
8666
  }
8618
8667
 
8619
8668
  setItemWidth ( w ) {
@@ -8628,6 +8677,6 @@ class Gui {
8628
8677
 
8629
8678
  }
8630
8679
 
8631
- const REVISION = '4.0.4';
8680
+ const REVISION = '4.0.9';
8632
8681
 
8633
- export { Gui, Proto, REVISION, Tools, add };
8682
+ export { Files, Gui, Proto, REVISION, Tools, add };