uil 4.2.7 → 4.2.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.
- package/build/uil.js +85 -27
- package/build/uil.min.js +1 -1
- package/build/uil.module.js +84 -33
- package/package.json +1 -1
package/build/uil.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* @author lth / https://github.com/lo-th
|
|
14
14
|
*/
|
|
15
|
-
const REVISION = '4.2.
|
|
15
|
+
const REVISION = '4.2.8'; // INTENAL FUNCTION
|
|
16
16
|
|
|
17
17
|
const R = {
|
|
18
18
|
ui: [],
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
current: -1,
|
|
24
24
|
needReZone: true,
|
|
25
25
|
needResize: false,
|
|
26
|
+
forceZone: false,
|
|
26
27
|
isEventsInit: false,
|
|
27
28
|
isLeave: false,
|
|
28
29
|
downTime: 0,
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
//if(!event.type) return;
|
|
167
168
|
if (R.prevDefault.indexOf(event.type) !== -1) event.preventDefault();
|
|
168
169
|
if (R.needResize) R.resize();
|
|
169
|
-
R.findZone();
|
|
170
|
+
R.findZone(R.forceZone);
|
|
170
171
|
let e = R.e;
|
|
171
172
|
let leave = false;
|
|
172
173
|
if (event.type === 'keydown') R.keydown(event);
|
|
@@ -208,6 +209,7 @@
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
R.prevTime = R.downTime;
|
|
212
|
+
R.forceZone = false;
|
|
211
213
|
} // for imput
|
|
212
214
|
|
|
213
215
|
|
|
@@ -320,7 +322,7 @@
|
|
|
320
322
|
}
|
|
321
323
|
} else {
|
|
322
324
|
px = 0;
|
|
323
|
-
u.zone.x = zone.x;
|
|
325
|
+
u.zone.x = zone.x + u.dx;
|
|
324
326
|
u.zone.y = py;
|
|
325
327
|
py += u.h + m;
|
|
326
328
|
height += u.h + m;
|
|
@@ -357,9 +359,11 @@
|
|
|
357
359
|
onZone: function (o, x, y) {
|
|
358
360
|
if (x === undefined || y === undefined) return false;
|
|
359
361
|
let z = o.zone;
|
|
360
|
-
let mx = x - z.x;
|
|
362
|
+
let mx = x - z.x; // - o.dx;
|
|
363
|
+
|
|
361
364
|
let my = y - z.y; //if( this.marginDiv ) e.clientY -= this.margin * 0.5
|
|
362
365
|
//if( o.group && o.group.marginDiv ) my += o.group.margin * 0.5
|
|
366
|
+
//if( o.group !== null ) mx -= o.dx
|
|
363
367
|
|
|
364
368
|
let over = mx >= 0 && my >= 0 && mx <= z.w && my <= z.h; //if( o.marginDiv ) my -= o.margin * 0.5
|
|
365
369
|
|
|
@@ -775,6 +779,9 @@
|
|
|
775
779
|
fontShadow: 'none',
|
|
776
780
|
//'#000',
|
|
777
781
|
fontSize: 12,
|
|
782
|
+
joyOver: 'rgba(48,138,255,0.25)',
|
|
783
|
+
joyOut: 'rgba(100,100,100,0.5)',
|
|
784
|
+
joySelect: '#308AFF',
|
|
778
785
|
hide: 'rgba(0,0,0,0)'
|
|
779
786
|
},
|
|
780
787
|
// style css
|
|
@@ -1532,6 +1539,14 @@
|
|
|
1532
1539
|
t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_neo + "'/>";
|
|
1533
1540
|
break;
|
|
1534
1541
|
|
|
1542
|
+
case 'phy':
|
|
1543
|
+
t[1] = "<path id='logoin' stroke='" + color + "' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='" + T.logo_phy + "'/>";
|
|
1544
|
+
break;
|
|
1545
|
+
|
|
1546
|
+
case 'config':
|
|
1547
|
+
t[1] = "<path id='logoin' stroke='" + color + "' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='" + T.logo_config + "'/>";
|
|
1548
|
+
break;
|
|
1549
|
+
|
|
1535
1550
|
case 'github':
|
|
1536
1551
|
t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_github + "'/>";
|
|
1537
1552
|
break;
|
|
@@ -1565,6 +1580,15 @@
|
|
|
1565
1580
|
67.2 130.85 51.15 114.8 35 92 35 69.25 35 53.05 51.15 37 67.2 37 90 L 37 204 50 204 50 90 Q 50 72.6 62.25 60.35 74.6 48 92 48 109.4 48 121.65 60.35 134 72.6 134 90 L
|
|
1566
1581
|
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
|
|
1567
1582
|
`,
|
|
1583
|
+
logo_phy: `
|
|
1584
|
+
M 103.55 37.95 L 127.95 37.95 Q 162.35 37.95 186.5 55 210.9 72.35 210.9 96.5 210.9 120.65 186.5 137.7 162.35 155 127.95 155 L 127.95 237.95 M 127.95 155
|
|
1585
|
+
Q 93.55 155 69.15 137.7 45 120.65 45 96.5 45 72.35 69.15 55 70.9 53.8 72.85 52.85 M 127.95 155 L 127.95 37.95
|
|
1586
|
+
`,
|
|
1587
|
+
logo_config: `
|
|
1588
|
+
M 204.35 51.65 L 173.25 82.75 Q 192 101.5 192 128 L 236 128 M 192 128 Q 192 154.55 173.25 173.25 L 204.4 204.4 M 51.65 51.65 L 82.75 82.75 Q 101.5 64 128 64
|
|
1589
|
+
L 128 20 M 51.6 204.4 L 82.75 173.25 Q 64 154.55 64 128 L 20 128 M 128 236 L 128 192 Q 101.5 192 82.75 173.25 M 64 128 Q 64 101.5 82.75 82.75 M 173.25 173.25
|
|
1590
|
+
Q 154.55 192 128 192 M 128 64 Q 154.55 64 173.25 82.75
|
|
1591
|
+
`,
|
|
1568
1592
|
logo_donate: `
|
|
1569
1593
|
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
|
|
1570
1594
|
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
|
|
@@ -1682,6 +1706,15 @@
|
|
|
1682
1706
|
}
|
|
1683
1707
|
}];
|
|
1684
1708
|
break;
|
|
1709
|
+
|
|
1710
|
+
case 'lut':
|
|
1711
|
+
t = [{
|
|
1712
|
+
description: 'Lut',
|
|
1713
|
+
accept: {
|
|
1714
|
+
'text/plain': ['.cube', '.3dl']
|
|
1715
|
+
}
|
|
1716
|
+
}];
|
|
1717
|
+
break;
|
|
1685
1718
|
}
|
|
1686
1719
|
|
|
1687
1720
|
return t;
|
|
@@ -1692,7 +1725,7 @@
|
|
|
1692
1725
|
|
|
1693
1726
|
static async load(o = {}) {
|
|
1694
1727
|
if (typeof window.showOpenFilePicker !== 'function') {
|
|
1695
|
-
window.showOpenFilePicker =
|
|
1728
|
+
window.showOpenFilePicker = Files.showOpenFilePickerPolyfill;
|
|
1696
1729
|
}
|
|
1697
1730
|
|
|
1698
1731
|
try {
|
|
@@ -1702,7 +1735,7 @@
|
|
|
1702
1735
|
multiple: false //startIn:'./assets'
|
|
1703
1736
|
|
|
1704
1737
|
};
|
|
1705
|
-
options.types =
|
|
1738
|
+
options.types = Files.autoTypes(type); // create a new handle
|
|
1706
1739
|
|
|
1707
1740
|
const handle = await window.showOpenFilePicker(options);
|
|
1708
1741
|
const file = await handle[0].getFile(); //let content = await file.text()
|
|
@@ -1723,18 +1756,18 @@
|
|
|
1723
1756
|
let img = new Image();
|
|
1724
1757
|
|
|
1725
1758
|
img.onload = function () {
|
|
1726
|
-
if (o.callback) o.callback(img, fname);
|
|
1759
|
+
if (o.callback) o.callback(img, fname, ftype);
|
|
1727
1760
|
};
|
|
1728
1761
|
|
|
1729
1762
|
img.src = content;
|
|
1730
1763
|
break;
|
|
1731
1764
|
|
|
1732
1765
|
case 'json':
|
|
1733
|
-
if (o.callback) o.callback(JSON.parse(content), fname);
|
|
1766
|
+
if (o.callback) o.callback(JSON.parse(content), fname, ftype);
|
|
1734
1767
|
break;
|
|
1735
1768
|
|
|
1736
1769
|
default:
|
|
1737
|
-
if (o.callback) o.callback(content, fname);
|
|
1770
|
+
if (o.callback) o.callback(content, fname, ftype);
|
|
1738
1771
|
break;
|
|
1739
1772
|
}
|
|
1740
1773
|
};
|
|
@@ -1767,11 +1800,11 @@
|
|
|
1767
1800
|
|
|
1768
1801
|
|
|
1769
1802
|
static async save(o = {}) {
|
|
1770
|
-
|
|
1803
|
+
let usePoly = false;
|
|
1771
1804
|
|
|
1772
1805
|
if (typeof window.showSaveFilePicker !== 'function') {
|
|
1773
|
-
window.showSaveFilePicker =
|
|
1774
|
-
|
|
1806
|
+
window.showSaveFilePicker = Files.showSaveFilePickerPolyfill;
|
|
1807
|
+
usePoly = true;
|
|
1775
1808
|
}
|
|
1776
1809
|
|
|
1777
1810
|
try {
|
|
@@ -1780,12 +1813,12 @@
|
|
|
1780
1813
|
suggestedName: o.name || 'hello',
|
|
1781
1814
|
data: o.data || ''
|
|
1782
1815
|
};
|
|
1783
|
-
options.types =
|
|
1816
|
+
options.types = Files.autoTypes(type);
|
|
1784
1817
|
options.finalType = Object.keys(options.types[0].accept)[0];
|
|
1785
1818
|
options.suggestedName += options.types[0].accept[options.finalType][0]; // create a new handle
|
|
1786
1819
|
|
|
1787
1820
|
const handle = await window.showSaveFilePicker(options);
|
|
1788
|
-
if (
|
|
1821
|
+
if (usePoly) return; // create a FileSystemWritableFileStream to write to
|
|
1789
1822
|
|
|
1790
1823
|
const file = await handle.createWritable();
|
|
1791
1824
|
let blob = new Blob([options.data], {
|
|
@@ -1951,6 +1984,7 @@
|
|
|
1951
1984
|
this.isListen = false;
|
|
1952
1985
|
this.top = 0;
|
|
1953
1986
|
this.ytop = 0;
|
|
1987
|
+
this.dx = o.dx || 0;
|
|
1954
1988
|
this.isSelectable = o.selectable !== undefined ? o.selectable : false;
|
|
1955
1989
|
this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
|
|
1956
1990
|
this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
|
|
@@ -2788,6 +2822,10 @@
|
|
|
2788
2822
|
this.c[n].textContent = string;
|
|
2789
2823
|
}
|
|
2790
2824
|
|
|
2825
|
+
switchValues(n, string) {
|
|
2826
|
+
this.c[n + 2].innerHTML = this.values[n] = string;
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2791
2829
|
icon(string, y = 0, n = 2) {
|
|
2792
2830
|
//if(y) this.s[n].margin = ( y ) +'px 0px';
|
|
2793
2831
|
this.s[n].padding = y + 'px 0px';
|
|
@@ -3836,7 +3874,8 @@
|
|
|
3836
3874
|
this.current = -1;
|
|
3837
3875
|
this.proto = null;
|
|
3838
3876
|
this.isEmpty = true;
|
|
3839
|
-
this.decal = o.group ? 8 : 0;
|
|
3877
|
+
this.decal = o.group ? 8 : 0; //this.dd = o.group ? o.group.decal + 8 : 0
|
|
3878
|
+
|
|
3840
3879
|
this.baseH = this.h;
|
|
3841
3880
|
let fltop = Math.floor(this.h * 0.5) - 3;
|
|
3842
3881
|
const cc = this.colors;
|
|
@@ -3989,8 +4028,21 @@
|
|
|
3989
4028
|
}
|
|
3990
4029
|
}
|
|
3991
4030
|
|
|
3992
|
-
let u = this.ADD.apply(this, a);
|
|
4031
|
+
let u = this.ADD.apply(this, a);
|
|
4032
|
+
|
|
4033
|
+
if (u.isGroup) {
|
|
4034
|
+
//o.add = add;
|
|
4035
|
+
u.dx = 8;
|
|
4036
|
+
} //u.dx += 4
|
|
4037
|
+
//console.log(this.decal)
|
|
4038
|
+
//u.zone.d -= 8
|
|
4039
|
+
|
|
4040
|
+
|
|
4041
|
+
Roots.forceZone = true; //u.margin += this.margin
|
|
3993
4042
|
//console.log( u.margin )
|
|
4043
|
+
//Roots.needReZone = true
|
|
4044
|
+
//Roots.resize()
|
|
4045
|
+
//console.log(Roots.needResize)
|
|
3994
4046
|
|
|
3995
4047
|
this.uis.push(u);
|
|
3996
4048
|
this.isEmpty = false;
|
|
@@ -4072,7 +4124,8 @@
|
|
|
4072
4124
|
s[1].borderBottom = cc.borderSize + 'px solid rgba(0,0,0,0)';
|
|
4073
4125
|
}
|
|
4074
4126
|
|
|
4075
|
-
this.parentHeight();
|
|
4127
|
+
this.parentHeight(); //Roots.isLeave = true
|
|
4128
|
+
//Roots.needResize = true
|
|
4076
4129
|
}
|
|
4077
4130
|
|
|
4078
4131
|
close() {
|
|
@@ -4163,11 +4216,12 @@
|
|
|
4163
4216
|
this.pos = new V2();
|
|
4164
4217
|
this.tmp = new V2();
|
|
4165
4218
|
this.interval = null;
|
|
4166
|
-
this.c[0].style.display = 'block';
|
|
4219
|
+
this.c[0].style.display = 'block';
|
|
4220
|
+
this.haveText = o.text !== undefined ? o.text : true; //this.radius = this.w * 0.5;
|
|
4167
4221
|
//this.distance = this.radius*0.25;
|
|
4168
4222
|
|
|
4169
4223
|
this.distance = this.diam * 0.5 * 0.25;
|
|
4170
|
-
this.h = o.h || this.w + 10;
|
|
4224
|
+
this.h = o.h || this.w + (this.haveText ? 10 : 0);
|
|
4171
4225
|
this.c[0].style.width = this.w + 'px';
|
|
4172
4226
|
|
|
4173
4227
|
if (this.c[1] !== undefined) {
|
|
@@ -4180,7 +4234,7 @@
|
|
|
4180
4234
|
|
|
4181
4235
|
let cc = this.colors;
|
|
4182
4236
|
this.c[2] = this.dom('div', this.css.txt + 'justify-content:center; top:' + (this.h - 20) + 'px; width:100%; color:' + cc.text);
|
|
4183
|
-
this.c[2].textContent = this.value;
|
|
4237
|
+
this.c[2].textContent = this.haveText ? this.value : '';
|
|
4184
4238
|
this.c[3] = this.getJoystick(this.model);
|
|
4185
4239
|
this.setSvg(this.c[3], 'viewBox', '0 0 ' + this.diam + ' ' + this.diam);
|
|
4186
4240
|
this.setCss(this.c[3], {
|
|
@@ -4189,6 +4243,7 @@
|
|
|
4189
4243
|
left: 0,
|
|
4190
4244
|
top: this.top
|
|
4191
4245
|
});
|
|
4246
|
+
this.mode(0);
|
|
4192
4247
|
this.ratio = 128 / this.w;
|
|
4193
4248
|
this.init();
|
|
4194
4249
|
this.update(false);
|
|
@@ -4204,9 +4259,9 @@
|
|
|
4204
4259
|
this.setSvg(this.c[3], 'fill', 'url(#gradIn)', 4);
|
|
4205
4260
|
this.setSvg(this.c[3], 'stroke', '#000', 4);
|
|
4206
4261
|
} else {
|
|
4207
|
-
this.setSvg(this.c[3], 'stroke',
|
|
4262
|
+
this.setSvg(this.c[3], 'stroke', cc.joyOut, 2); //this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.1)', 3 );
|
|
4208
4263
|
|
|
4209
|
-
this.setSvg(this.c[3], 'stroke',
|
|
4264
|
+
this.setSvg(this.c[3], 'stroke', cc.joyOut, 4);
|
|
4210
4265
|
this.setSvg(this.c[3], 'fill', 'none', 4);
|
|
4211
4266
|
}
|
|
4212
4267
|
|
|
@@ -4218,10 +4273,10 @@
|
|
|
4218
4273
|
this.setSvg(this.c[3], 'fill', 'url(#gradIn2)', 4);
|
|
4219
4274
|
this.setSvg(this.c[3], 'stroke', 'rgba(0,0,0,0)', 4);
|
|
4220
4275
|
} else {
|
|
4221
|
-
this.setSvg(this.c[3], 'stroke',
|
|
4276
|
+
this.setSvg(this.c[3], 'stroke', cc.joyOver, 2); //this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.3)', 3 );
|
|
4222
4277
|
|
|
4223
|
-
this.setSvg(this.c[3], 'stroke', cc.
|
|
4224
|
-
this.setSvg(this.c[3], 'fill',
|
|
4278
|
+
this.setSvg(this.c[3], 'stroke', cc.joySelect, 4);
|
|
4279
|
+
this.setSvg(this.c[3], 'fill', cc.joyOver, 4);
|
|
4225
4280
|
}
|
|
4226
4281
|
|
|
4227
4282
|
break;
|
|
@@ -4323,7 +4378,7 @@
|
|
|
4323
4378
|
this.setSvg(this.c[3], 'cy', y * this.ratio, 4);
|
|
4324
4379
|
this.value[0] = (this.pos.x * this.multiplicator).toFixed(this.precision) * 1;
|
|
4325
4380
|
this.value[1] = (this.pos.y * this.multiplicator).toFixed(this.precision) * 1;
|
|
4326
|
-
this.c[2].textContent = this.value;
|
|
4381
|
+
if (this.haveText) this.c[2].textContent = this.value;
|
|
4327
4382
|
}
|
|
4328
4383
|
|
|
4329
4384
|
clear() {
|
|
@@ -6753,7 +6808,10 @@
|
|
|
6753
6808
|
}
|
|
6754
6809
|
|
|
6755
6810
|
let name = type.toLowerCase();
|
|
6756
|
-
|
|
6811
|
+
|
|
6812
|
+
if (name === 'group') {
|
|
6813
|
+
o.add = add; //o.dx = 8
|
|
6814
|
+
}
|
|
6757
6815
|
|
|
6758
6816
|
switch (name) {
|
|
6759
6817
|
case 'bool':
|