uil 4.0.3 → 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 +2 -2
- package/build/uil.js +321 -251
- package/build/uil.min.js +1 -1
- package/build/uil.module.js +372 -328
- package/package.json +1 -1
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)
|
|
@@ -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 ? '
|
|
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
|
-
|
|
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
|
|
2699
|
-
if( this.c[1] !== undefined )
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
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
|
-
|
|
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 =
|
|
3103
|
+
let dc = this.space;
|
|
2975
3104
|
let size = Math.floor( ( w-(dc*(i-1)) ) / i );
|
|
2976
3105
|
|
|
2977
|
-
if( this.
|
|
2978
|
-
size = this.
|
|
2979
|
-
|
|
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
|
}
|
|
@@ -3267,7 +3385,7 @@ class Color extends Proto {
|
|
|
3267
3385
|
}
|
|
3268
3386
|
|
|
3269
3387
|
//this.c[0].style.textAlign = 'center';
|
|
3270
|
-
|
|
3388
|
+
this.c[0].style.display = 'block';
|
|
3271
3389
|
|
|
3272
3390
|
this.c[3] = this.getColorRing();
|
|
3273
3391
|
this.c[3].style.visibility = 'hidden';
|
|
@@ -4282,14 +4400,12 @@ class Group extends Proto {
|
|
|
4282
4400
|
|
|
4283
4401
|
this.ADD = o.add;
|
|
4284
4402
|
|
|
4285
|
-
this.uis = [];
|
|
4286
|
-
|
|
4287
|
-
this.isEmpty = true;
|
|
4288
|
-
|
|
4289
4403
|
this.autoHeight = true;
|
|
4290
|
-
this.current = -1;
|
|
4291
|
-
this.targetIn = null;
|
|
4292
4404
|
|
|
4405
|
+
this.uis = [];
|
|
4406
|
+
this.current = -1;
|
|
4407
|
+
this.proto = null;
|
|
4408
|
+
this.isEmpty = true;
|
|
4293
4409
|
this.decal = 0;
|
|
4294
4410
|
|
|
4295
4411
|
this.baseH = this.h;
|
|
@@ -4315,9 +4431,6 @@ class Group extends Proto {
|
|
|
4315
4431
|
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
4432
|
|
|
4317
4433
|
let s = this.s;
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
4434
|
s[0].height = this.h + 'px';
|
|
4322
4435
|
s[1].height = this.h + 'px';
|
|
4323
4436
|
this.c[1].name = 'group';
|
|
@@ -4327,28 +4440,13 @@ class Group extends Proto {
|
|
|
4327
4440
|
s[1].color = this.colors.text;
|
|
4328
4441
|
s[1].fontWeight = 'bold';
|
|
4329
4442
|
|
|
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
|
-
|
|
4443
|
+
if( this.radius !== 0 ) s[0].borderRadius = this.radius+'px';
|
|
4343
4444
|
this.init();
|
|
4344
4445
|
|
|
4345
4446
|
this.setBG( o.bg );
|
|
4346
4447
|
|
|
4347
4448
|
if( o.open !== undefined ) this.open();
|
|
4348
4449
|
|
|
4349
|
-
|
|
4350
|
-
//s[0].background = this.bg;
|
|
4351
|
-
|
|
4352
4450
|
}
|
|
4353
4451
|
|
|
4354
4452
|
testZone ( e ) {
|
|
@@ -4370,12 +4468,13 @@ class Group extends Proto {
|
|
|
4370
4468
|
clearTarget () {
|
|
4371
4469
|
|
|
4372
4470
|
if( this.current === -1 ) return false;
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4471
|
+
if( this.proto.s ){
|
|
4472
|
+
// if no s target is delete !!
|
|
4473
|
+
this.proto.uiout();
|
|
4474
|
+
this.proto.reset();
|
|
4475
|
+
}
|
|
4476
|
+
this.proto = null;
|
|
4377
4477
|
this.current = -1;
|
|
4378
|
-
this.targetIn = null;
|
|
4379
4478
|
this.cursor();
|
|
4380
4479
|
return true;
|
|
4381
4480
|
|
|
@@ -4396,7 +4495,7 @@ class Group extends Proto {
|
|
|
4396
4495
|
let type = e.type;
|
|
4397
4496
|
|
|
4398
4497
|
let change = false;
|
|
4399
|
-
let
|
|
4498
|
+
let protoChange = false;
|
|
4400
4499
|
|
|
4401
4500
|
let name = this.testZone( e );
|
|
4402
4501
|
|
|
@@ -4409,9 +4508,7 @@ class Group extends Proto {
|
|
|
4409
4508
|
|
|
4410
4509
|
if( Roots.isMobile && type === 'mousedown' ) this.getNext( e, change );
|
|
4411
4510
|
|
|
4412
|
-
if( this.
|
|
4413
|
-
|
|
4414
|
-
//if( type === 'mousemove' ) change = this.styles('def');
|
|
4511
|
+
if( this.proto ) protoChange = this.proto.handleEvent( e );
|
|
4415
4512
|
|
|
4416
4513
|
if( !Roots.lock ) this.getNext( e, change );
|
|
4417
4514
|
|
|
@@ -4428,7 +4525,7 @@ class Group extends Proto {
|
|
|
4428
4525
|
}
|
|
4429
4526
|
|
|
4430
4527
|
if( this.isDown ) change = true;
|
|
4431
|
-
if(
|
|
4528
|
+
if( protoChange ) change = true;
|
|
4432
4529
|
|
|
4433
4530
|
return change;
|
|
4434
4531
|
|
|
@@ -4444,41 +4541,14 @@ class Group extends Proto {
|
|
|
4444
4541
|
}
|
|
4445
4542
|
|
|
4446
4543
|
if( next !== -1 ){
|
|
4447
|
-
this.
|
|
4448
|
-
this.
|
|
4544
|
+
this.proto = this.uis[ this.current ];
|
|
4545
|
+
this.proto.uiover();
|
|
4449
4546
|
}
|
|
4450
4547
|
|
|
4451
4548
|
}
|
|
4452
4549
|
|
|
4453
4550
|
// ----------------------
|
|
4454
4551
|
|
|
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
4552
|
setBG ( bg ) {
|
|
4483
4553
|
|
|
4484
4554
|
if( bg !== undefined ) this.colors.background = bg;
|
|
@@ -4511,15 +4581,10 @@ class Group extends Proto {
|
|
|
4511
4581
|
}
|
|
4512
4582
|
}
|
|
4513
4583
|
|
|
4514
|
-
//let n = add.apply( this, a );
|
|
4515
4584
|
let u = this.ADD.apply( this, a );
|
|
4516
4585
|
|
|
4517
4586
|
this.uis.push( u );
|
|
4518
4587
|
|
|
4519
|
-
//this.calc()
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
4588
|
this.isEmpty = false;
|
|
4524
4589
|
|
|
4525
4590
|
return u;
|
|
@@ -4540,9 +4605,7 @@ class Group extends Proto {
|
|
|
4540
4605
|
|
|
4541
4606
|
this.clear();
|
|
4542
4607
|
if( this.isUI ) this.main.calc();
|
|
4543
|
-
|
|
4544
4608
|
super.dispose();
|
|
4545
|
-
//Proto.prototype.clear.call( this );
|
|
4546
4609
|
|
|
4547
4610
|
}
|
|
4548
4611
|
|
|
@@ -4626,12 +4689,6 @@ class Group extends Proto {
|
|
|
4626
4689
|
|
|
4627
4690
|
this.s[0].height = this.h + 'px';
|
|
4628
4691
|
|
|
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
4692
|
}
|
|
4636
4693
|
|
|
4637
4694
|
parentHeight ( t ) {
|
|
@@ -4643,22 +4700,9 @@ class Group extends Proto {
|
|
|
4643
4700
|
|
|
4644
4701
|
calc ( y ) {
|
|
4645
4702
|
|
|
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)
|
|
4703
|
+
if( !this.isOpen ) return
|
|
4659
4704
|
if( this.isUI ) this.main.calc();
|
|
4660
4705
|
else this.calcUis();
|
|
4661
|
-
|
|
4662
4706
|
this.s[0].height = this.h + 'px';
|
|
4663
4707
|
|
|
4664
4708
|
}
|
|
@@ -4671,8 +4715,6 @@ class Group extends Proto {
|
|
|
4671
4715
|
this.uis[i].rSize();
|
|
4672
4716
|
}
|
|
4673
4717
|
|
|
4674
|
-
//this.calc()
|
|
4675
|
-
|
|
4676
4718
|
}
|
|
4677
4719
|
|
|
4678
4720
|
rSize () {
|
|
@@ -7536,6 +7578,8 @@ class Pad2D extends Proto {
|
|
|
7536
7578
|
|
|
7537
7579
|
//console.log(this.range)
|
|
7538
7580
|
|
|
7581
|
+
|
|
7582
|
+
|
|
7539
7583
|
|
|
7540
7584
|
|
|
7541
7585
|
this.precision = o.precision === undefined ? 2 : o.precision;
|
|
@@ -7625,6 +7669,7 @@ class Pad2D extends Proto {
|
|
|
7625
7669
|
mousedown ( e ) {
|
|
7626
7670
|
|
|
7627
7671
|
if ( this.testZone(e) === 'pad' ) {
|
|
7672
|
+
|
|
7628
7673
|
this.isDown = true;
|
|
7629
7674
|
this.mousemove( e );
|
|
7630
7675
|
return this.mode(1);
|
|
@@ -7789,8 +7834,8 @@ const add = function () {
|
|
|
7789
7834
|
|
|
7790
7835
|
ref = true;
|
|
7791
7836
|
if( a[2] === undefined ) [].push.call(a, {});
|
|
7792
|
-
|
|
7793
|
-
type = a[2].type ? a[2].type :
|
|
7837
|
+
|
|
7838
|
+
type = a[2].type ? a[2].type : autoType( a[0][a[1]], a[2] );
|
|
7794
7839
|
|
|
7795
7840
|
o = a[2];
|
|
7796
7841
|
o.name = a[1];
|
|
@@ -7799,13 +7844,15 @@ const add = function () {
|
|
|
7799
7844
|
|
|
7800
7845
|
}
|
|
7801
7846
|
|
|
7847
|
+
|
|
7848
|
+
|
|
7802
7849
|
let name = type.toLowerCase();
|
|
7803
7850
|
|
|
7804
7851
|
if( name === 'group' ) o.add = add;
|
|
7805
7852
|
|
|
7806
7853
|
switch( name ){
|
|
7807
7854
|
|
|
7808
|
-
case 'bool': n = new Bool(o); break;
|
|
7855
|
+
case 'bool': case 'boolean': n = new Bool(o); break;
|
|
7809
7856
|
case 'button': n = new Button(o); break;
|
|
7810
7857
|
case 'circular': n = new Circular(o); break;
|
|
7811
7858
|
case 'color': n = new Color(o); break;
|
|
@@ -7835,6 +7882,37 @@ const add = function () {
|
|
|
7835
7882
|
|
|
7836
7883
|
}
|
|
7837
7884
|
|
|
7885
|
+
};
|
|
7886
|
+
|
|
7887
|
+
const autoType = function ( v, o ) {
|
|
7888
|
+
|
|
7889
|
+
let type = 'slide';
|
|
7890
|
+
|
|
7891
|
+
if( typeof v === 'boolean' ) type = 'bool';
|
|
7892
|
+
else if( typeof v === 'string' ){
|
|
7893
|
+
|
|
7894
|
+
if( v.substring(0,1) === '#' ) type = 'color';
|
|
7895
|
+
else type = 'string';
|
|
7896
|
+
|
|
7897
|
+
} else if( typeof v === 'number' ){
|
|
7898
|
+
|
|
7899
|
+
if( o.ctype ) type = 'color';
|
|
7900
|
+
else type = 'slide';
|
|
7901
|
+
|
|
7902
|
+
} else if( typeof v === 'array' && v instanceof Array ){
|
|
7903
|
+
|
|
7904
|
+
if( typeof v[0] === 'number' ) type = 'number';
|
|
7905
|
+
else if( typeof v[0] === 'string' ) type = 'list';
|
|
7906
|
+
|
|
7907
|
+
} else if( typeof v === 'object' && v instanceof Object ){
|
|
7908
|
+
|
|
7909
|
+
if( v.x !== undefined ) type = 'number';
|
|
7910
|
+
else type = 'list';
|
|
7911
|
+
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7914
|
+
return type
|
|
7915
|
+
|
|
7838
7916
|
};
|
|
7839
7917
|
|
|
7840
7918
|
/**
|
|
@@ -7854,7 +7932,7 @@ class Gui {
|
|
|
7854
7932
|
this.screen = null;
|
|
7855
7933
|
this.plane = o.plane || null;
|
|
7856
7934
|
|
|
7857
|
-
|
|
7935
|
+
|
|
7858
7936
|
|
|
7859
7937
|
// color
|
|
7860
7938
|
if( o.config ) o.colors = o.config;
|
|
@@ -7918,9 +7996,9 @@ class Gui {
|
|
|
7918
7996
|
this.isScroll = false;
|
|
7919
7997
|
|
|
7920
7998
|
this.uis = [];
|
|
7921
|
-
|
|
7922
7999
|
this.current = -1;
|
|
7923
|
-
this.
|
|
8000
|
+
this.proto = null;
|
|
8001
|
+
this.isEmpty = true;
|
|
7924
8002
|
this.decal = 0;
|
|
7925
8003
|
this.ratio = 1;
|
|
7926
8004
|
this.oy = 0;
|
|
@@ -7974,6 +8052,8 @@ class Gui {
|
|
|
7974
8052
|
if( !this.isCanvasOnly ){
|
|
7975
8053
|
this.content.style.pointerEvents = 'auto';
|
|
7976
8054
|
} else {
|
|
8055
|
+
this.content.style.left = '0px';
|
|
8056
|
+
this.content.style.right = 'auto';
|
|
7977
8057
|
o.transition = 0;
|
|
7978
8058
|
}
|
|
7979
8059
|
|
|
@@ -8024,6 +8104,8 @@ class Gui {
|
|
|
8024
8104
|
this.canvas.width = this.zone.w;
|
|
8025
8105
|
this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h;
|
|
8026
8106
|
|
|
8107
|
+
//console.log( this.canvas.width, this.canvas.height )
|
|
8108
|
+
|
|
8027
8109
|
}
|
|
8028
8110
|
|
|
8029
8111
|
draw ( force ) {
|
|
@@ -8081,9 +8163,11 @@ class Gui {
|
|
|
8081
8163
|
}
|
|
8082
8164
|
|
|
8083
8165
|
hide ( b ) {
|
|
8166
|
+
this.content.style.visibility = b ? 'hidden' : 'visible';
|
|
8167
|
+
}
|
|
8084
8168
|
|
|
8085
|
-
|
|
8086
|
-
|
|
8169
|
+
display( v = false ) {
|
|
8170
|
+
this.content.style.visibility = v ? 'visible' : 'hidden';
|
|
8087
8171
|
}
|
|
8088
8172
|
|
|
8089
8173
|
onChange ( f ) {
|
|
@@ -8149,10 +8233,13 @@ class Gui {
|
|
|
8149
8233
|
clearTarget () {
|
|
8150
8234
|
|
|
8151
8235
|
if( this.current === -1 ) return false;
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8236
|
+
if( this.proto.s ){
|
|
8237
|
+
// if no s target is delete !!
|
|
8238
|
+
this.proto.uiout();
|
|
8239
|
+
this.proto.reset();
|
|
8240
|
+
}
|
|
8241
|
+
|
|
8242
|
+
this.proto = null;
|
|
8156
8243
|
this.current = -1;
|
|
8157
8244
|
|
|
8158
8245
|
///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
|
|
@@ -8195,7 +8282,7 @@ class Gui {
|
|
|
8195
8282
|
let type = e.type;
|
|
8196
8283
|
|
|
8197
8284
|
let change = false;
|
|
8198
|
-
let
|
|
8285
|
+
let protoChange = false;
|
|
8199
8286
|
|
|
8200
8287
|
let name = this.testZone( e );
|
|
8201
8288
|
|
|
@@ -8214,10 +8301,10 @@ class Gui {
|
|
|
8214
8301
|
|
|
8215
8302
|
if( Roots.isMobile && type === 'mousedown' ) this.getNext( e, change );
|
|
8216
8303
|
|
|
8217
|
-
if( this.
|
|
8304
|
+
if( this.proto ) protoChange = this.proto.handleEvent( e );
|
|
8218
8305
|
|
|
8219
8306
|
if( type === 'mousemove' ) change = this.mode('def');
|
|
8220
|
-
if( type === 'wheel' && !
|
|
8307
|
+
if( type === 'wheel' && !protoChange && this.isScroll ) change = this.onWheel( e );
|
|
8221
8308
|
|
|
8222
8309
|
if( !Roots.lock ) {
|
|
8223
8310
|
this.getNext( e, change );
|
|
@@ -8252,7 +8339,7 @@ class Gui {
|
|
|
8252
8339
|
}
|
|
8253
8340
|
|
|
8254
8341
|
if( this.isDown ) change = true;
|
|
8255
|
-
if(
|
|
8342
|
+
if( protoChange ) change = true;
|
|
8256
8343
|
|
|
8257
8344
|
if( type === 'keyup' ) change = true;
|
|
8258
8345
|
if( type === 'keydown' ) change = true;
|
|
@@ -8276,8 +8363,8 @@ class Gui {
|
|
|
8276
8363
|
}
|
|
8277
8364
|
|
|
8278
8365
|
if( next !== -1 ){
|
|
8279
|
-
this.
|
|
8280
|
-
this.
|
|
8366
|
+
this.proto = this.uis[ this.current ];
|
|
8367
|
+
this.proto.uiover();
|
|
8281
8368
|
}
|
|
8282
8369
|
|
|
8283
8370
|
}
|
|
@@ -8337,8 +8424,8 @@ class Gui {
|
|
|
8337
8424
|
else {
|
|
8338
8425
|
a[2].isUI = true;
|
|
8339
8426
|
a[2].main = this;
|
|
8340
|
-
|
|
8341
|
-
ontop = a[
|
|
8427
|
+
//ontop = a[1].ontop ? a[1].ontop : false;
|
|
8428
|
+
ontop = a[2].ontop ? a[2].ontop : false;
|
|
8342
8429
|
}
|
|
8343
8430
|
|
|
8344
8431
|
}
|
|
@@ -8350,17 +8437,6 @@ class Gui {
|
|
|
8350
8437
|
if( ontop ) this.uis.unshift( u );
|
|
8351
8438
|
else this.uis.push( u );
|
|
8352
8439
|
|
|
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
8440
|
this.calc();
|
|
8365
8441
|
|
|
8366
8442
|
this.isEmpty = false;
|
|
@@ -8369,23 +8445,11 @@ class Gui {
|
|
|
8369
8445
|
|
|
8370
8446
|
}
|
|
8371
8447
|
|
|
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
8448
|
// remove one node
|
|
8385
8449
|
|
|
8386
8450
|
remove ( n ) {
|
|
8387
8451
|
|
|
8388
|
-
if( n.
|
|
8452
|
+
if( n.dispose ) n.dispose();
|
|
8389
8453
|
|
|
8390
8454
|
}
|
|
8391
8455
|
|
|
@@ -8415,19 +8479,12 @@ class Gui {
|
|
|
8415
8479
|
item = this.uis.pop();
|
|
8416
8480
|
this.inner.removeChild( item.c[0] );
|
|
8417
8481
|
item.dispose();
|
|
8418
|
-
|
|
8419
|
-
//this.uis[i].clear()
|
|
8420
8482
|
}
|
|
8421
8483
|
|
|
8422
8484
|
this.uis = [];
|
|
8423
8485
|
this.isEmpty = true;
|
|
8424
|
-
//this.zone = { x:0, y:0, w:this.size.w, h:0 };
|
|
8425
|
-
//this.setWidth()
|
|
8426
|
-
//Roots.listens = [];
|
|
8427
8486
|
this.calc();
|
|
8428
8487
|
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
8488
|
}
|
|
8432
8489
|
|
|
8433
8490
|
clear() {
|
|
@@ -8444,11 +8501,11 @@ class Gui {
|
|
|
8444
8501
|
|
|
8445
8502
|
}
|
|
8446
8503
|
|
|
8504
|
+
|
|
8447
8505
|
// ----------------------
|
|
8448
8506
|
// ITEMS SPECIAL
|
|
8449
8507
|
// ----------------------
|
|
8450
8508
|
|
|
8451
|
-
|
|
8452
8509
|
resetItem () {
|
|
8453
8510
|
|
|
8454
8511
|
if( !this.isItemMode ) return;
|
|
@@ -8463,12 +8520,11 @@ class Gui {
|
|
|
8463
8520
|
if( !this.isItemMode ) return;
|
|
8464
8521
|
|
|
8465
8522
|
name = name || '';
|
|
8466
|
-
|
|
8467
8523
|
this.resetItem();
|
|
8468
8524
|
|
|
8469
8525
|
if( !name ){
|
|
8470
8526
|
this.update(0);
|
|
8471
|
-
return
|
|
8527
|
+
return
|
|
8472
8528
|
}
|
|
8473
8529
|
|
|
8474
8530
|
let i = this.uis.length;
|
|
@@ -8502,8 +8558,6 @@ class Gui {
|
|
|
8502
8558
|
this.ratio = this.maxView / this.total;
|
|
8503
8559
|
this.sh = this.maxView * this.ratio;
|
|
8504
8560
|
|
|
8505
|
-
//if( this.sh < 20 ) this.sh = 20;
|
|
8506
|
-
|
|
8507
8561
|
this.range = this.maxView - this.sh;
|
|
8508
8562
|
|
|
8509
8563
|
this.oy = Tools.clamp( this.oy, 0, this.range );
|
|
@@ -8562,7 +8616,7 @@ class Gui {
|
|
|
8562
8616
|
|
|
8563
8617
|
let diff = this.h - this.maxHeight;
|
|
8564
8618
|
|
|
8565
|
-
if( diff > 1 ){
|
|
8619
|
+
if( diff > 1 ){
|
|
8566
8620
|
|
|
8567
8621
|
this.isScroll = true;
|
|
8568
8622
|
this.zone.h = this.maxHeight + this.bh;
|
|
@@ -8584,9 +8638,7 @@ class Gui {
|
|
|
8584
8638
|
|
|
8585
8639
|
if( this.forceHeight && this.lockHeight ) this.content.style.height = this.forceHeight + 'px';
|
|
8586
8640
|
|
|
8587
|
-
//if( this.isOpen ) this.calcUis()
|
|
8588
8641
|
if( this.isCanvas ) this.draw( true );
|
|
8589
|
-
//else if( !this.transition ) this.rezone()
|
|
8590
8642
|
|
|
8591
8643
|
}
|
|
8592
8644
|
|
|
@@ -8600,20 +8652,12 @@ class Gui {
|
|
|
8600
8652
|
|
|
8601
8653
|
this.zone.w = Math.floor( this.zone.w );
|
|
8602
8654
|
|
|
8603
|
-
//console.log( this.zone.w )
|
|
8604
|
-
|
|
8605
8655
|
this.content.style.width = this.zone.w + 'px';
|
|
8606
8656
|
|
|
8607
8657
|
if( this.isCenter ) this.content.style.marginLeft = -(Math.floor(this.zone.w*0.5)) + 'px';
|
|
8608
8658
|
|
|
8609
8659
|
this.setItemWidth( this.zone.w - this.sw );
|
|
8610
8660
|
|
|
8611
|
-
//this.setHeight();
|
|
8612
|
-
//this.calc()
|
|
8613
|
-
|
|
8614
|
-
//if( this.isCanvasOnly ) Roots.needReZone = true;
|
|
8615
|
-
//Roots.resize();
|
|
8616
|
-
|
|
8617
8661
|
}
|
|
8618
8662
|
|
|
8619
8663
|
setItemWidth ( w ) {
|
|
@@ -8628,6 +8672,6 @@ class Gui {
|
|
|
8628
8672
|
|
|
8629
8673
|
}
|
|
8630
8674
|
|
|
8631
|
-
const REVISION = '4.0.
|
|
8675
|
+
const REVISION = '4.0.8';
|
|
8632
8676
|
|
|
8633
|
-
export { Gui, Proto, REVISION, Tools, add };
|
|
8677
|
+
export { Files, Gui, Proto, REVISION, Tools, add };
|