uil 4.0.2 → 4.0.7
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 +5 -1
- package/build/uil.js +290 -63
- package/build/uil.min.js +1 -1
- package/build/uil.module.js +376 -75
- package/package.json +5 -6
package/build/uil.module.js
CHANGED
|
@@ -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)
|
|
@@ -1693,6 +1698,238 @@ T.setText();
|
|
|
1693
1698
|
|
|
1694
1699
|
const Tools = T;
|
|
1695
1700
|
|
|
1701
|
+
///https://wicg.github.io/file-system-access/#api-filesystemfilehandle-getfile
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
class Files {
|
|
1705
|
+
|
|
1706
|
+
//-----------------------------
|
|
1707
|
+
// FILE TYPE
|
|
1708
|
+
//-----------------------------
|
|
1709
|
+
|
|
1710
|
+
static autoTypes( type ) {
|
|
1711
|
+
|
|
1712
|
+
let t = [];
|
|
1713
|
+
|
|
1714
|
+
switch( type ){
|
|
1715
|
+
case 'json':
|
|
1716
|
+
t = [ { accept: { 'image/svg+xml': '.svg'} }, ];
|
|
1717
|
+
break;
|
|
1718
|
+
case 'text':
|
|
1719
|
+
t = [ { description: 'Text Files', accept: { 'text/plain': ['.txt', '.text'], 'text/html': ['.html', '.htm'] } }, ];
|
|
1720
|
+
break;
|
|
1721
|
+
case 'json':
|
|
1722
|
+
t = [ { description: 'JSON Files', accept: { 'text/plain': ['.json'] } }, ];
|
|
1723
|
+
break;
|
|
1724
|
+
case 'image':
|
|
1725
|
+
t = [ { description: 'Images', accept: { 'image/*': ['.png', '.gif', '.jpeg', '.jpg'] } }, ];
|
|
1726
|
+
break;
|
|
1727
|
+
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
return t
|
|
1731
|
+
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
//-----------------------------
|
|
1736
|
+
// LOAD
|
|
1737
|
+
//-----------------------------
|
|
1738
|
+
|
|
1739
|
+
static async load( o = {} ) {
|
|
1740
|
+
|
|
1741
|
+
if (typeof window.showOpenFilePicker !== 'function') {
|
|
1742
|
+
window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
try {
|
|
1746
|
+
|
|
1747
|
+
let type = o.type || '';
|
|
1748
|
+
|
|
1749
|
+
const options = {
|
|
1750
|
+
excludeAcceptAllOption: type ? true : false,
|
|
1751
|
+
multiple: false,
|
|
1752
|
+
//startIn:'./assets'
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
options.types = this.autoTypes( type );
|
|
1756
|
+
|
|
1757
|
+
// create a new handle
|
|
1758
|
+
const handle = await window.showOpenFilePicker( options );
|
|
1759
|
+
const file = await handle[0].getFile();
|
|
1760
|
+
//let content = await file.text()
|
|
1761
|
+
|
|
1762
|
+
if( !file ) return null
|
|
1763
|
+
|
|
1764
|
+
let fname = file.name;
|
|
1765
|
+
let ftype = fname.substring( fname.lastIndexOf('.')+1, fname.length );
|
|
1766
|
+
|
|
1767
|
+
const dataUrl = [ 'png', 'jpg', 'jpeg', 'mp4', 'webm', 'ogg', 'mp3' ];
|
|
1768
|
+
const dataBuf = [ 'sea', 'z', 'hex', 'bvh', 'BVH', 'glb', 'gltf' ];
|
|
1769
|
+
const reader = new FileReader();
|
|
1770
|
+
|
|
1771
|
+
if( dataUrl.indexOf( ftype ) !== -1 ) reader.readAsDataURL( file );
|
|
1772
|
+
else if( dataBuf.indexOf( ftype ) !== -1 ) reader.readAsArrayBuffer( file );
|
|
1773
|
+
else reader.readAsText( file );
|
|
1774
|
+
|
|
1775
|
+
reader.onload = function(e) {
|
|
1776
|
+
|
|
1777
|
+
let content = e.target.result;
|
|
1778
|
+
|
|
1779
|
+
if( type === 'image' ){
|
|
1780
|
+
var img = new Image;
|
|
1781
|
+
img.onload = function() {
|
|
1782
|
+
if( o.callback ) o.callback( img, fname );
|
|
1783
|
+
};
|
|
1784
|
+
img.src = content;
|
|
1785
|
+
} else {
|
|
1786
|
+
if( o.callback ) o.callback( content, fname );
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
};
|
|
1790
|
+
|
|
1791
|
+
} catch(e) {
|
|
1792
|
+
|
|
1793
|
+
console.log(e);
|
|
1794
|
+
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
static showOpenFilePickerPolyfill( options ) {
|
|
1800
|
+
return new Promise((resolve) => {
|
|
1801
|
+
const input = document.createElement("input");
|
|
1802
|
+
input.type = "file";
|
|
1803
|
+
input.multiple = options.multiple;
|
|
1804
|
+
input.accept = options.types
|
|
1805
|
+
.map((type) => type.accept)
|
|
1806
|
+
.flatMap((inst) => Object.keys(inst).flatMap((key) => inst[key]))
|
|
1807
|
+
.join(",");
|
|
1808
|
+
|
|
1809
|
+
input.addEventListener("change", () => {
|
|
1810
|
+
resolve(
|
|
1811
|
+
[...input.files].map((file) => {
|
|
1812
|
+
return {
|
|
1813
|
+
getFile: async () =>
|
|
1814
|
+
new Promise((resolve) => {
|
|
1815
|
+
resolve(file);
|
|
1816
|
+
}),
|
|
1817
|
+
};
|
|
1818
|
+
})
|
|
1819
|
+
);
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
input.click();
|
|
1823
|
+
})
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
//-----------------------------
|
|
1828
|
+
// SAVE
|
|
1829
|
+
//-----------------------------
|
|
1830
|
+
|
|
1831
|
+
static async save( o = {} ) {
|
|
1832
|
+
|
|
1833
|
+
this.usePoly = false;
|
|
1834
|
+
|
|
1835
|
+
if (typeof window.showSaveFilePicker !== 'function') {
|
|
1836
|
+
window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
|
|
1837
|
+
this.usePoly = true;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
try {
|
|
1841
|
+
|
|
1842
|
+
let type = o.type || '';
|
|
1843
|
+
|
|
1844
|
+
const options = {
|
|
1845
|
+
suggestedName: o.name || 'hello',
|
|
1846
|
+
data: o.data || ''
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
options.types = this.autoTypes( type );
|
|
1851
|
+
options.finalType = Object.keys(options.types[0].accept )[0];
|
|
1852
|
+
options.suggestedName += options.types[0].accept[options.finalType][0];
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
// create a new handle
|
|
1856
|
+
const handle = await window.showSaveFilePicker( options );
|
|
1857
|
+
|
|
1858
|
+
if( this.usePoly ) return
|
|
1859
|
+
|
|
1860
|
+
// create a FileSystemWritableFileStream to write to
|
|
1861
|
+
const file = await handle.createWritable();
|
|
1862
|
+
|
|
1863
|
+
let blob = new Blob([ options.data ], { type: option.finalType });
|
|
1864
|
+
|
|
1865
|
+
// write our file
|
|
1866
|
+
await file.write(blob);
|
|
1867
|
+
|
|
1868
|
+
// close the file and write the contents to disk.
|
|
1869
|
+
await file.close();
|
|
1870
|
+
|
|
1871
|
+
} catch(e) {
|
|
1872
|
+
|
|
1873
|
+
console.log(e);
|
|
1874
|
+
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
static showSaveFilePickerPolyfill( options ) {
|
|
1880
|
+
return new Promise((resolve) => {
|
|
1881
|
+
const a = document.createElement("a");
|
|
1882
|
+
a.download = options.suggestedName || "my-file.txt";
|
|
1883
|
+
let blob = new Blob([ options.data ], { type:options.finalType });
|
|
1884
|
+
a.href = URL.createObjectURL( blob );
|
|
1885
|
+
|
|
1886
|
+
a.addEventListener("click", () => {
|
|
1887
|
+
resolve(
|
|
1888
|
+
setTimeout( () => URL.revokeObjectURL(a.href), 1000 )
|
|
1889
|
+
);
|
|
1890
|
+
});
|
|
1891
|
+
a.click();
|
|
1892
|
+
})
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
//-----------------------------
|
|
1897
|
+
// FOLDER not possible in poly
|
|
1898
|
+
//-----------------------------
|
|
1899
|
+
|
|
1900
|
+
static async getFolder() {
|
|
1901
|
+
|
|
1902
|
+
try {
|
|
1903
|
+
|
|
1904
|
+
const handle = await window.showDirectoryPicker();
|
|
1905
|
+
const files = [];
|
|
1906
|
+
for await (const entry of handle.values()) {
|
|
1907
|
+
const file = await entry.getFile();
|
|
1908
|
+
files.push(file);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
console.log(files);
|
|
1912
|
+
return files;
|
|
1913
|
+
|
|
1914
|
+
} catch(e) {
|
|
1915
|
+
|
|
1916
|
+
console.log(e);
|
|
1917
|
+
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
|
|
1924
|
+
|
|
1925
|
+
|
|
1926
|
+
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1696
1933
|
class V2 {
|
|
1697
1934
|
|
|
1698
1935
|
constructor( x = 0, y = 0 ) {
|
|
@@ -1851,6 +2088,8 @@ class Proto {
|
|
|
1851
2088
|
|
|
1852
2089
|
this.isListen = false;
|
|
1853
2090
|
|
|
2091
|
+
|
|
2092
|
+
|
|
1854
2093
|
|
|
1855
2094
|
//this.parentGroup = null;
|
|
1856
2095
|
|
|
@@ -1884,6 +2123,14 @@ class Proto {
|
|
|
1884
2123
|
if( !this.isSpace ) this.h = this.h < 11 ? 11 : this.h;
|
|
1885
2124
|
else this.lock = true;
|
|
1886
2125
|
|
|
2126
|
+
|
|
2127
|
+
// decale for canvas only
|
|
2128
|
+
this.fw = o.fw || 0;
|
|
2129
|
+
/*this.dc = 0
|
|
2130
|
+
if(this.isUI){
|
|
2131
|
+
if( this.main.isCanvasOnly && this.fw) this.dc = (this.main.zone.w - this.w)*0.5
|
|
2132
|
+
}*/
|
|
2133
|
+
|
|
1887
2134
|
|
|
1888
2135
|
this.autoWidth = o.auto || true;// auto width or flex
|
|
1889
2136
|
this.isOpen = false;// open statu
|
|
@@ -2265,31 +2512,27 @@ class Proto {
|
|
|
2265
2512
|
// ----------------------
|
|
2266
2513
|
// clear node
|
|
2267
2514
|
// ----------------------
|
|
2268
|
-
|
|
2269
|
-
|
|
2515
|
+
|
|
2516
|
+
dispose(){
|
|
2270
2517
|
|
|
2271
2518
|
if( this.isListen ) Roots.removeListen( this );
|
|
2272
2519
|
|
|
2273
2520
|
Tools.clear( this.c[0] );
|
|
2274
2521
|
|
|
2275
|
-
if(
|
|
2276
|
-
|
|
2277
|
-
if( this.target !== null ){
|
|
2522
|
+
if( this.target !== null ){
|
|
2278
2523
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2524
|
+
if( this.group !== null ) this.group.clearOne( this );
|
|
2525
|
+
else this.target.removeChild( this.c[0] );
|
|
2281
2526
|
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
if( this.isUI ) this.main.clearOne( this );
|
|
2285
|
-
else document.body.removeChild( this.c[0] );
|
|
2286
|
-
|
|
2287
|
-
}
|
|
2527
|
+
} else {
|
|
2288
2528
|
|
|
2289
|
-
if(
|
|
2529
|
+
if( this.isUI ) this.main.clearOne( this );
|
|
2530
|
+
else document.body.removeChild( this.c[0] );
|
|
2290
2531
|
|
|
2291
2532
|
}
|
|
2292
2533
|
|
|
2534
|
+
if( !this.isUI ) Roots.remove( this );
|
|
2535
|
+
|
|
2293
2536
|
this.c = null;
|
|
2294
2537
|
this.s = null;
|
|
2295
2538
|
this.callback = null;
|
|
@@ -2297,6 +2540,10 @@ class Proto {
|
|
|
2297
2540
|
this.isListen = false;
|
|
2298
2541
|
|
|
2299
2542
|
}
|
|
2543
|
+
|
|
2544
|
+
clear() {
|
|
2545
|
+
|
|
2546
|
+
}
|
|
2300
2547
|
|
|
2301
2548
|
// ----------------------
|
|
2302
2549
|
// change size
|
|
@@ -2383,6 +2630,8 @@ class Proto {
|
|
|
2383
2630
|
|
|
2384
2631
|
handleEvent( e ) {
|
|
2385
2632
|
|
|
2633
|
+
//if(!this.s) return false
|
|
2634
|
+
|
|
2386
2635
|
if( this.lock ) return
|
|
2387
2636
|
|
|
2388
2637
|
if( this.neverlock ) Roots.lock = false;
|
|
@@ -2428,7 +2677,8 @@ class Proto {
|
|
|
2428
2677
|
display( v ) {
|
|
2429
2678
|
|
|
2430
2679
|
v = v || false;
|
|
2431
|
-
this.s[0].
|
|
2680
|
+
this.s[0].visibility = v ? 'visible' : 'hidden';
|
|
2681
|
+
//this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
|
|
2432
2682
|
|
|
2433
2683
|
}
|
|
2434
2684
|
|
|
@@ -2659,7 +2909,7 @@ class Button extends Proto {
|
|
|
2659
2909
|
|
|
2660
2910
|
|
|
2661
2911
|
|
|
2662
|
-
this.onName = o.onName ||
|
|
2912
|
+
this.onName = o.onName || null;
|
|
2663
2913
|
|
|
2664
2914
|
this.on = false;
|
|
2665
2915
|
|
|
@@ -2694,12 +2944,13 @@ class Button extends Proto {
|
|
|
2694
2944
|
|
|
2695
2945
|
}
|
|
2696
2946
|
|
|
2697
|
-
if( !o.value
|
|
2698
|
-
if( this.c[1] !== undefined )
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
}
|
|
2947
|
+
if( !o.value && !o.values ){
|
|
2948
|
+
if( this.c[1] !== undefined ) {
|
|
2949
|
+
this.txt = '';
|
|
2950
|
+
this.c[1].textContent = '';
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
if( !this.txt ) this.p = 0;
|
|
2703
2954
|
|
|
2704
2955
|
//
|
|
2705
2956
|
|
|
@@ -2709,16 +2960,16 @@ class Button extends Proto {
|
|
|
2709
2960
|
this.initDrager();
|
|
2710
2961
|
}
|
|
2711
2962
|
|
|
2712
|
-
if( this.onName !== '' ) this.values[0] = this.on;
|
|
2963
|
+
//if( this.onName !== '' ) this.values[0] = this.on;
|
|
2713
2964
|
|
|
2714
2965
|
this.init();
|
|
2715
2966
|
|
|
2716
2967
|
}
|
|
2717
2968
|
|
|
2718
|
-
onOff
|
|
2969
|
+
onOff() {
|
|
2719
2970
|
|
|
2720
2971
|
this.on = !this.on;
|
|
2721
|
-
this.
|
|
2972
|
+
this.label( this.on ? this.onName : this.txt );
|
|
2722
2973
|
|
|
2723
2974
|
}
|
|
2724
2975
|
|
|
@@ -2750,6 +3001,7 @@ class Button extends Proto {
|
|
|
2750
3001
|
if( this.res !== -1 ){
|
|
2751
3002
|
if( this.value === this.values[this.res] && this.unselectable ) this.value = '';
|
|
2752
3003
|
else this.value = this.values[this.res];
|
|
3004
|
+
if( this.onName !== null ) this.onOff();
|
|
2753
3005
|
if( !this.isLoadButton ) this.send();
|
|
2754
3006
|
}
|
|
2755
3007
|
|
|
@@ -2810,6 +3062,8 @@ class Button extends Proto {
|
|
|
2810
3062
|
|
|
2811
3063
|
mode ( n, id ) {
|
|
2812
3064
|
|
|
3065
|
+
//if(!this.s) return false
|
|
3066
|
+
|
|
2813
3067
|
let change = false;
|
|
2814
3068
|
let cc = this.colors, s = this.s;
|
|
2815
3069
|
let i = id+2;
|
|
@@ -2890,6 +3144,21 @@ class Button extends Proto {
|
|
|
2890
3144
|
|
|
2891
3145
|
}
|
|
2892
3146
|
|
|
3147
|
+
addLoader( n, callbackLoad ){
|
|
3148
|
+
|
|
3149
|
+
this.callbackLoad = callbackLoad;
|
|
3150
|
+
|
|
3151
|
+
let l = this.dom( 'input', this.css.basic +'top:0px; opacity:0; height:100%; width:100%; pointer-events:auto; cursor:pointer;' );//
|
|
3152
|
+
l.name = 'loader';
|
|
3153
|
+
l.type = "file";
|
|
3154
|
+
l.addEventListener( 'change', function(e){ this.fileSelect( e.target.files[0] ); }.bind(this), false );
|
|
3155
|
+
|
|
3156
|
+
this.c[n].appendChild( l );
|
|
3157
|
+
|
|
3158
|
+
return this
|
|
3159
|
+
|
|
3160
|
+
}
|
|
3161
|
+
|
|
2893
3162
|
initLoader () {
|
|
2894
3163
|
|
|
2895
3164
|
this.c[3] = this.dom( 'input', this.css.basic +'top:0px; opacity:0; height:'+(this.h)+'px; pointer-events:auto; cursor:pointer;' );//
|
|
@@ -2935,8 +3204,10 @@ class Button extends Proto {
|
|
|
2935
3204
|
//else reader.readAsText( file );
|
|
2936
3205
|
|
|
2937
3206
|
reader.onload = function (e) {
|
|
3207
|
+
|
|
3208
|
+
if( this.callbackLoad ) this.callbackLoad( e.target.result, fname, type );
|
|
2938
3209
|
|
|
2939
|
-
if( this.callback ) this.callback( e.target.result, fname, type );
|
|
3210
|
+
//if( this.callback ) this.callback( e.target.result, fname, type );
|
|
2940
3211
|
//this.c[3].type = "file";
|
|
2941
3212
|
//this.send( e.target.result );
|
|
2942
3213
|
}.bind(this);
|
|
@@ -4490,7 +4761,7 @@ class Group extends Proto {
|
|
|
4490
4761
|
|
|
4491
4762
|
}
|
|
4492
4763
|
|
|
4493
|
-
add
|
|
4764
|
+
add() {
|
|
4494
4765
|
|
|
4495
4766
|
let a = arguments;
|
|
4496
4767
|
|
|
@@ -4528,12 +4799,28 @@ class Group extends Proto {
|
|
|
4528
4799
|
|
|
4529
4800
|
remove ( n ) {
|
|
4530
4801
|
|
|
4531
|
-
if( n.
|
|
4802
|
+
if( n.dispose ) n.dispose();
|
|
4532
4803
|
|
|
4533
4804
|
}
|
|
4534
4805
|
|
|
4535
4806
|
// clear all iner
|
|
4536
4807
|
|
|
4808
|
+
dispose() {
|
|
4809
|
+
|
|
4810
|
+
this.clear();
|
|
4811
|
+
if( this.isUI ) this.main.calc();
|
|
4812
|
+
|
|
4813
|
+
super.dispose();
|
|
4814
|
+
//Proto.prototype.clear.call( this );
|
|
4815
|
+
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
clear() {
|
|
4819
|
+
|
|
4820
|
+
this.empty();
|
|
4821
|
+
|
|
4822
|
+
}
|
|
4823
|
+
|
|
4537
4824
|
empty () {
|
|
4538
4825
|
|
|
4539
4826
|
this.close();
|
|
@@ -4601,29 +4888,6 @@ class Group extends Proto {
|
|
|
4601
4888
|
|
|
4602
4889
|
}
|
|
4603
4890
|
|
|
4604
|
-
clear () {
|
|
4605
|
-
|
|
4606
|
-
this.empty();
|
|
4607
|
-
if( this.isUI ) this.main.calc( -( this.h + 1 ));
|
|
4608
|
-
Proto.prototype.clear.call( this );
|
|
4609
|
-
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4612
|
-
clearGroup () {
|
|
4613
|
-
|
|
4614
|
-
this.empty();
|
|
4615
|
-
|
|
4616
|
-
/*this.close();
|
|
4617
|
-
|
|
4618
|
-
let i = this.uis.length;
|
|
4619
|
-
while(i--){
|
|
4620
|
-
this.uis[i].clear();
|
|
4621
|
-
}
|
|
4622
|
-
this.uis = [];
|
|
4623
|
-
this.h = this.baseH;*/
|
|
4624
|
-
|
|
4625
|
-
}
|
|
4626
|
-
|
|
4627
4891
|
calcUis () {
|
|
4628
4892
|
|
|
4629
4893
|
if( !this.isOpen ) this.h = this.baseH;
|
|
@@ -7541,6 +7805,8 @@ class Pad2D extends Proto {
|
|
|
7541
7805
|
|
|
7542
7806
|
//console.log(this.range)
|
|
7543
7807
|
|
|
7808
|
+
|
|
7809
|
+
|
|
7544
7810
|
|
|
7545
7811
|
|
|
7546
7812
|
this.precision = o.precision === undefined ? 2 : o.precision;
|
|
@@ -7630,6 +7896,7 @@ class Pad2D extends Proto {
|
|
|
7630
7896
|
mousedown ( e ) {
|
|
7631
7897
|
|
|
7632
7898
|
if ( this.testZone(e) === 'pad' ) {
|
|
7899
|
+
|
|
7633
7900
|
this.isDown = true;
|
|
7634
7901
|
this.mousemove( e );
|
|
7635
7902
|
return this.mode(1);
|
|
@@ -7794,8 +8061,8 @@ const add = function () {
|
|
|
7794
8061
|
|
|
7795
8062
|
ref = true;
|
|
7796
8063
|
if( a[2] === undefined ) [].push.call(a, {});
|
|
7797
|
-
|
|
7798
|
-
type = a[2].type ? a[2].type :
|
|
8064
|
+
|
|
8065
|
+
type = a[2].type ? a[2].type : autoType( a[0][a[1]], a[2] );
|
|
7799
8066
|
|
|
7800
8067
|
o = a[2];
|
|
7801
8068
|
o.name = a[1];
|
|
@@ -7804,13 +8071,15 @@ const add = function () {
|
|
|
7804
8071
|
|
|
7805
8072
|
}
|
|
7806
8073
|
|
|
8074
|
+
|
|
8075
|
+
|
|
7807
8076
|
let name = type.toLowerCase();
|
|
7808
8077
|
|
|
7809
8078
|
if( name === 'group' ) o.add = add;
|
|
7810
8079
|
|
|
7811
8080
|
switch( name ){
|
|
7812
8081
|
|
|
7813
|
-
case 'bool': n = new Bool(o); break;
|
|
8082
|
+
case 'bool': case 'boolean': n = new Bool(o); break;
|
|
7814
8083
|
case 'button': n = new Button(o); break;
|
|
7815
8084
|
case 'circular': n = new Circular(o); break;
|
|
7816
8085
|
case 'color': n = new Color(o); break;
|
|
@@ -7840,6 +8109,37 @@ const add = function () {
|
|
|
7840
8109
|
|
|
7841
8110
|
}
|
|
7842
8111
|
|
|
8112
|
+
};
|
|
8113
|
+
|
|
8114
|
+
const autoType = function ( v, o ) {
|
|
8115
|
+
|
|
8116
|
+
let type = 'slide';
|
|
8117
|
+
|
|
8118
|
+
if( typeof v === 'boolean' ) type = 'bool';
|
|
8119
|
+
else if( typeof v === 'string' ){
|
|
8120
|
+
|
|
8121
|
+
if( v.substring(0,1) === '#' ) type = 'color';
|
|
8122
|
+
else type = 'string';
|
|
8123
|
+
|
|
8124
|
+
} else if( typeof v === 'number' ){
|
|
8125
|
+
|
|
8126
|
+
if( o.ctype ) type = 'color';
|
|
8127
|
+
else type = 'slide';
|
|
8128
|
+
|
|
8129
|
+
} else if( typeof v === 'array' && v instanceof Array ){
|
|
8130
|
+
|
|
8131
|
+
if( typeof v[0] === 'number' ) type = 'number';
|
|
8132
|
+
else if( typeof v[0] === 'string' ) type = 'list';
|
|
8133
|
+
|
|
8134
|
+
} else if( typeof v === 'object' && v instanceof Object ){
|
|
8135
|
+
|
|
8136
|
+
if( v.x !== undefined ) type = 'number';
|
|
8137
|
+
else type = 'list';
|
|
8138
|
+
|
|
8139
|
+
}
|
|
8140
|
+
|
|
8141
|
+
return type
|
|
8142
|
+
|
|
7843
8143
|
};
|
|
7844
8144
|
|
|
7845
8145
|
/**
|
|
@@ -7979,6 +8279,8 @@ class Gui {
|
|
|
7979
8279
|
if( !this.isCanvasOnly ){
|
|
7980
8280
|
this.content.style.pointerEvents = 'auto';
|
|
7981
8281
|
} else {
|
|
8282
|
+
this.content.style.left = '0px';
|
|
8283
|
+
this.content.style.right = 'auto';
|
|
7982
8284
|
o.transition = 0;
|
|
7983
8285
|
}
|
|
7984
8286
|
|
|
@@ -8029,6 +8331,8 @@ class Gui {
|
|
|
8029
8331
|
this.canvas.width = this.zone.w;
|
|
8030
8332
|
this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h;
|
|
8031
8333
|
|
|
8334
|
+
//console.log( this.canvas.width, this.canvas.height )
|
|
8335
|
+
|
|
8032
8336
|
}
|
|
8033
8337
|
|
|
8034
8338
|
draw ( force ) {
|
|
@@ -8154,9 +8458,12 @@ class Gui {
|
|
|
8154
8458
|
clearTarget () {
|
|
8155
8459
|
|
|
8156
8460
|
if( this.current === -1 ) return false;
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8461
|
+
if( this.target.s ){
|
|
8462
|
+
// if no s target is delete !!
|
|
8463
|
+
this.target.uiout();
|
|
8464
|
+
this.target.reset();
|
|
8465
|
+
}
|
|
8466
|
+
|
|
8160
8467
|
this.target = null;
|
|
8161
8468
|
this.current = -1;
|
|
8162
8469
|
|
|
@@ -8342,8 +8649,8 @@ class Gui {
|
|
|
8342
8649
|
else {
|
|
8343
8650
|
a[2].isUI = true;
|
|
8344
8651
|
a[2].main = this;
|
|
8345
|
-
|
|
8346
|
-
ontop = a[
|
|
8652
|
+
//ontop = a[1].ontop ? a[1].ontop : false;
|
|
8653
|
+
ontop = a[2].ontop ? a[2].ontop : false;
|
|
8347
8654
|
}
|
|
8348
8655
|
|
|
8349
8656
|
}
|
|
@@ -8390,7 +8697,7 @@ class Gui {
|
|
|
8390
8697
|
|
|
8391
8698
|
remove ( n ) {
|
|
8392
8699
|
|
|
8393
|
-
if( n.
|
|
8700
|
+
if( n.dispose ) n.dispose();
|
|
8394
8701
|
|
|
8395
8702
|
}
|
|
8396
8703
|
|
|
@@ -8419,7 +8726,7 @@ class Gui {
|
|
|
8419
8726
|
while( i-- ){
|
|
8420
8727
|
item = this.uis.pop();
|
|
8421
8728
|
this.inner.removeChild( item.c[0] );
|
|
8422
|
-
item.
|
|
8729
|
+
item.dispose();
|
|
8423
8730
|
|
|
8424
8731
|
//this.uis[i].clear()
|
|
8425
8732
|
}
|
|
@@ -8439,16 +8746,6 @@ class Gui {
|
|
|
8439
8746
|
|
|
8440
8747
|
this.empty();
|
|
8441
8748
|
|
|
8442
|
-
//this.callback = null;
|
|
8443
|
-
|
|
8444
|
-
/*let i = this.uis.length;
|
|
8445
|
-
while( i-- ) this.uis[i].clear();
|
|
8446
|
-
|
|
8447
|
-
this.uis = [];
|
|
8448
|
-
Roots.listens = [];
|
|
8449
|
-
|
|
8450
|
-
this.calc( -this.h );*/
|
|
8451
|
-
|
|
8452
8749
|
}
|
|
8453
8750
|
|
|
8454
8751
|
dispose() {
|
|
@@ -8590,6 +8887,8 @@ class Gui {
|
|
|
8590
8887
|
|
|
8591
8888
|
}
|
|
8592
8889
|
|
|
8890
|
+
//if( this.forceHeight ) this.zone.h = this.forceHeight
|
|
8891
|
+
|
|
8593
8892
|
this.upScroll( this.isScroll );
|
|
8594
8893
|
|
|
8595
8894
|
this.innerContent.style.height = this.zone.h - this.bh + 'px';
|
|
@@ -8599,6 +8898,8 @@ class Gui {
|
|
|
8599
8898
|
|
|
8600
8899
|
if( this.forceHeight && this.lockHeight ) this.content.style.height = this.forceHeight + 'px';
|
|
8601
8900
|
|
|
8901
|
+
//console.log( this.zone, this.bh )
|
|
8902
|
+
|
|
8602
8903
|
//if( this.isOpen ) this.calcUis()
|
|
8603
8904
|
if( this.isCanvas ) this.draw( true );
|
|
8604
8905
|
//else if( !this.transition ) this.rezone()
|
|
@@ -8643,6 +8944,6 @@ class Gui {
|
|
|
8643
8944
|
|
|
8644
8945
|
}
|
|
8645
8946
|
|
|
8646
|
-
const REVISION = '4.0.
|
|
8947
|
+
const REVISION = '4.0.7';
|
|
8647
8948
|
|
|
8648
|
-
export { Gui, Proto, REVISION, Tools, add };
|
|
8949
|
+
export { Files, Gui, Proto, REVISION, Tools, add };
|