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.
@@ -7,7 +7,7 @@
7
7
  * @author lth / https://github.com/lo-th
8
8
  */
9
9
 
10
- const REVISION = '4.2.7';
10
+ const REVISION = '4.2.8';
11
11
 
12
12
  // INTENAL FUNCTION
13
13
 
@@ -24,6 +24,7 @@ const R = {
24
24
 
25
25
  needReZone: true,
26
26
  needResize:false,
27
+ forceZone:false,
27
28
  isEventsInit: false,
28
29
  isLeave:false,
29
30
 
@@ -230,7 +231,7 @@ const R = {
230
231
 
231
232
  if( R.needResize ) R.resize();
232
233
 
233
- R.findZone();
234
+ R.findZone(R.forceZone);
234
235
 
235
236
  let e = R.e;
236
237
  let leave = false;
@@ -275,6 +276,7 @@ const R = {
275
276
  if( time < 200 ) { R.selectAll(); return false }
276
277
 
277
278
  R.prevTime = R.downTime;
279
+ R.forceZone = false;
278
280
  }
279
281
 
280
282
  // for imput
@@ -417,11 +419,10 @@ const R = {
417
419
 
418
420
  px = 0;
419
421
 
420
- u.zone.x = zone.x;
422
+ u.zone.x = zone.x+u.dx;
421
423
  u.zone.y = py;
422
424
  py += u.h + m;
423
425
 
424
-
425
426
  height += u.h + m;
426
427
 
427
428
  }
@@ -465,6 +466,7 @@ const R = {
465
466
 
466
467
  R.needReZone = false;
467
468
 
469
+
468
470
  },
469
471
 
470
472
  onZone: function ( o, x, y ) {
@@ -472,11 +474,12 @@ const R = {
472
474
  if( x === undefined || y === undefined ) return false;
473
475
 
474
476
  let z = o.zone;
475
- let mx = x - z.x;
477
+ let mx = x - z.x;// - o.dx;
476
478
  let my = y - z.y;
477
479
 
478
480
  //if( this.marginDiv ) e.clientY -= this.margin * 0.5
479
481
  //if( o.group && o.group.marginDiv ) my += o.group.margin * 0.5
482
+ //if( o.group !== null ) mx -= o.dx
480
483
 
481
484
  let over = ( mx >= 0 ) && ( my >= 0 ) && ( mx <= z.w ) && ( my <= z.h );
482
485
 
@@ -1036,6 +1039,10 @@ const T = {
1036
1039
  fontShadow: 'none',//'#000',
1037
1040
  fontSize:12,
1038
1041
 
1042
+ joyOver:'rgba(48,138,255,0.25)',
1043
+ joyOut: 'rgba(100,100,100,0.5)',
1044
+ joySelect: '#308AFF',
1045
+
1039
1046
 
1040
1047
  hide: 'rgba(0,0,0,0)',
1041
1048
 
@@ -1684,6 +1691,12 @@ const T = {
1684
1691
  case 'neo':
1685
1692
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_neo+"'/>";
1686
1693
  break;
1694
+ case 'phy':
1695
+ t[1]="<path id='logoin' stroke='"+color+"' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='"+T.logo_phy+"'/>";
1696
+ break;
1697
+ case 'config':
1698
+ t[1]="<path id='logoin' stroke='"+color+"' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='"+T.logo_config+"'/>";
1699
+ break;
1687
1700
  case 'github':
1688
1701
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_github+"'/>";
1689
1702
  break;
@@ -1720,6 +1733,17 @@ const T = {
1720
1733
  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
1721
1734
  `,
1722
1735
 
1736
+ logo_phy:`
1737
+ 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
1738
+ 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
1739
+ `,
1740
+
1741
+ logo_config:`
1742
+ 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
1743
+ 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
1744
+ Q 154.55 192 128 192 M 128 64 Q 154.55 64 173.25 82.75
1745
+ `,
1746
+
1723
1747
  logo_donate:`
1724
1748
  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
1725
1749
  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
@@ -1769,7 +1793,7 @@ class Files {
1769
1793
  case 'mp4':
1770
1794
  t = [ { accept: { 'video/mp4': '.mp4'} }, ];
1771
1795
  break;
1772
- case 'bin':case 'hex':
1796
+ case 'bin': case 'hex':
1773
1797
  t = [ { description: 'Binary Files', accept: { 'application/octet-stream': ['.bin', '.hex'] } }, ];
1774
1798
  break;
1775
1799
  case 'text':
@@ -1787,6 +1811,9 @@ class Files {
1787
1811
  case 'icon':
1788
1812
  t = [ { description: 'Icons', accept: { 'image/x-ico': ['.ico'] } }, ];
1789
1813
  break;
1814
+ case 'lut':
1815
+ t = [ { description: 'Lut', accept: { 'text/plain': ['.cube', '.3dl'] } }, ];
1816
+ break;
1790
1817
 
1791
1818
  }
1792
1819
 
@@ -1802,7 +1829,7 @@ class Files {
1802
1829
  static async load( o = {} ) {
1803
1830
 
1804
1831
  if (typeof window.showOpenFilePicker !== 'function') {
1805
- window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
1832
+ window.showOpenFilePicker = Files.showOpenFilePickerPolyfill;
1806
1833
  }
1807
1834
 
1808
1835
  try {
@@ -1815,7 +1842,7 @@ class Files {
1815
1842
  //startIn:'./assets'
1816
1843
  };
1817
1844
 
1818
- options.types = this.autoTypes( type );
1845
+ options.types = Files.autoTypes( type );
1819
1846
 
1820
1847
  // create a new handle
1821
1848
  const handle = await window.showOpenFilePicker( options );
@@ -1843,15 +1870,15 @@ class Files {
1843
1870
  case 'image':
1844
1871
  let img = new Image;
1845
1872
  img.onload = function() {
1846
- if( o.callback ) o.callback( img, fname );
1873
+ if( o.callback ) o.callback( img, fname, ftype );
1847
1874
  };
1848
1875
  img.src = content;
1849
1876
  break;
1850
1877
  case 'json':
1851
- if( o.callback ) o.callback( JSON.parse( content ), fname );
1878
+ if( o.callback ) o.callback( JSON.parse( content ), fname, ftype );
1852
1879
  break;
1853
1880
  default:
1854
- if( o.callback ) o.callback( content, fname );
1881
+ if( o.callback ) o.callback( content, fname, ftype );
1855
1882
  break;
1856
1883
  }
1857
1884
 
@@ -1900,11 +1927,11 @@ class Files {
1900
1927
 
1901
1928
  static async save( o = {} ) {
1902
1929
 
1903
- this.usePoly = false;
1930
+ let usePoly = false;
1904
1931
 
1905
1932
  if (typeof window.showSaveFilePicker !== 'function') {
1906
- window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1907
- this.usePoly = true;
1933
+ window.showSaveFilePicker = Files.showSaveFilePickerPolyfill;
1934
+ usePoly = true;
1908
1935
  }
1909
1936
 
1910
1937
  try {
@@ -1916,16 +1943,15 @@ class Files {
1916
1943
  data: o.data || ''
1917
1944
  };
1918
1945
 
1919
-
1920
- options.types = this.autoTypes( type );
1921
- options.finalType = Object.keys(options.types[0].accept )[0];
1946
+ options.types = Files.autoTypes( type );
1947
+ options.finalType = Object.keys( options.types[0].accept )[0];
1922
1948
  options.suggestedName += options.types[0].accept[options.finalType][0];
1923
1949
 
1924
1950
 
1925
1951
  // create a new handle
1926
1952
  const handle = await window.showSaveFilePicker( options );
1927
1953
 
1928
- if( this.usePoly ) return
1954
+ if( usePoly ) return
1929
1955
 
1930
1956
  // create a FileSystemWritableFileStream to write to
1931
1957
  const file = await handle.createWritable();
@@ -2161,6 +2187,8 @@ class Proto {
2161
2187
  this.top = 0;
2162
2188
  this.ytop = 0;
2163
2189
 
2190
+ this.dx = o.dx || 0;
2191
+
2164
2192
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
2165
2193
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
2166
2194
 
@@ -2364,9 +2392,6 @@ class Proto {
2364
2392
 
2365
2393
  }
2366
2394
 
2367
-
2368
-
2369
-
2370
2395
  }
2371
2396
 
2372
2397
  addTransition(){
@@ -3155,6 +3180,10 @@ class Button extends Proto {
3155
3180
 
3156
3181
  }
3157
3182
 
3183
+ switchValues( n, string ){
3184
+ this.c[n+2].innerHTML = this.values[n] = string;
3185
+ }
3186
+
3158
3187
  icon ( string, y = 0, n = 2 ) {
3159
3188
 
3160
3189
  //if(y) this.s[n].margin = ( y ) +'px 0px';
@@ -4505,6 +4534,7 @@ class Group extends Proto {
4505
4534
  this.isEmpty = true;
4506
4535
 
4507
4536
  this.decal = o.group ? 8 : 0;
4537
+ //this.dd = o.group ? o.group.decal + 8 : 0
4508
4538
 
4509
4539
  this.baseH = this.h;
4510
4540
 
@@ -4696,9 +4726,23 @@ class Group extends Proto {
4696
4726
  }
4697
4727
 
4698
4728
  let u = this.ADD.apply( this, a );
4729
+
4730
+ if( u.isGroup ){
4731
+ //o.add = add;
4732
+ u.dx = 8;
4733
+ }
4734
+
4735
+ //u.dx += 4
4736
+ //console.log(this.decal)
4737
+ //u.zone.d -= 8
4738
+ Roots.forceZone = true;
4699
4739
  //u.margin += this.margin
4700
4740
 
4701
4741
  //console.log( u.margin )
4742
+ //Roots.needReZone = true
4743
+
4744
+ //Roots.resize()
4745
+ //console.log(Roots.needResize)
4702
4746
 
4703
4747
  this.uis.push( u );
4704
4748
 
@@ -4812,6 +4856,9 @@ class Group extends Proto {
4812
4856
 
4813
4857
  this.parentHeight();
4814
4858
 
4859
+ //Roots.isLeave = true
4860
+ //Roots.needResize = true
4861
+
4815
4862
  }
4816
4863
 
4817
4864
  close () {
@@ -4944,12 +4991,13 @@ class Joystick extends Proto {
4944
4991
 
4945
4992
  this.interval = null;
4946
4993
  this.c[0].style.display = 'block';
4994
+ this.haveText = o.text !== undefined ? o.text : true;
4947
4995
 
4948
4996
  //this.radius = this.w * 0.5;
4949
4997
  //this.distance = this.radius*0.25;
4950
4998
  this.distance = (this.diam*0.5)*0.25;
4951
4999
 
4952
- this.h = o.h || this.w + 10;
5000
+ this.h = o.h || this.w + (this.haveText ? 10 : 0);
4953
5001
 
4954
5002
  this.c[0].style.width = this.w +'px';
4955
5003
 
@@ -4965,12 +5013,14 @@ class Joystick extends Proto {
4965
5013
  let cc = this.colors;
4966
5014
 
4967
5015
  this.c[2] = this.dom( 'div', this.css.txt + 'justify-content:center; top:'+(this.h-20)+'px; width:100%; color:'+ cc.text );
4968
- this.c[2].textContent = this.value;
5016
+ this.c[2].textContent = this.haveText ? this.value : '';
4969
5017
 
4970
5018
  this.c[3] = this.getJoystick( this.model );
4971
5019
  this.setSvg( this.c[3], 'viewBox', '0 0 '+this.diam+' '+this.diam );
4972
5020
  this.setCss( this.c[3], { width:this.diam, height:this.diam, left:0, top:this.top });
4973
5021
 
5022
+ this.mode(0);
5023
+
4974
5024
 
4975
5025
  this.ratio = 128/this.w;
4976
5026
 
@@ -4990,9 +5040,9 @@ class Joystick extends Proto {
4990
5040
  this.setSvg( this.c[3], 'fill', 'url(#gradIn)', 4 );
4991
5041
  this.setSvg( this.c[3], 'stroke', '#000', 4 );
4992
5042
  } else {
4993
- this.setSvg( this.c[3], 'stroke', 'rgba(100,100,100,0.25)', 2 );
5043
+ this.setSvg( this.c[3], 'stroke', cc.joyOut, 2 );
4994
5044
  //this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.1)', 3 );
4995
- this.setSvg( this.c[3], 'stroke', '#666', 4 );
5045
+ this.setSvg( this.c[3], 'stroke', cc.joyOut, 4 );
4996
5046
  this.setSvg( this.c[3], 'fill', 'none', 4 );
4997
5047
  }
4998
5048
 
@@ -5002,10 +5052,10 @@ class Joystick extends Proto {
5002
5052
  this.setSvg( this.c[3], 'fill', 'url(#gradIn2)', 4 );
5003
5053
  this.setSvg( this.c[3], 'stroke', 'rgba(0,0,0,0)', 4 );
5004
5054
  } else {
5005
- this.setSvg( this.c[3], 'stroke', 'rgba(48,138,255,0.25)', 2 );
5055
+ this.setSvg( this.c[3], 'stroke', cc.joyOver, 2 );
5006
5056
  //this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.3)', 3 );
5007
- this.setSvg( this.c[3], 'stroke', cc.select, 4 );
5008
- this.setSvg( this.c[3], 'fill', 'rgba(48,138,255,0.25)', 4 );
5057
+ this.setSvg( this.c[3], 'stroke', cc.joySelect, 4 );
5058
+ this.setSvg( this.c[3], 'fill', cc.joyOver, 4 );
5009
5059
  }
5010
5060
  break;
5011
5061
 
@@ -5124,7 +5174,7 @@ class Joystick extends Proto {
5124
5174
  let x = (this.diam*0.5) - ( -this.pos.x * this.distance );
5125
5175
  let y = (this.diam*0.5) - ( -this.pos.y * this.distance );
5126
5176
 
5127
- if(this.model === 0){
5177
+ if(this.model === 0){
5128
5178
 
5129
5179
  let sx = x + ((this.pos.x)*5) + 5;
5130
5180
  let sy = y + ((this.pos.y)*5) + 10;
@@ -5144,7 +5194,7 @@ class Joystick extends Proto {
5144
5194
  this.value[0] = ( this.pos.x * this.multiplicator ).toFixed( this.precision ) * 1;
5145
5195
  this.value[1] = ( this.pos.y * this.multiplicator ).toFixed( this.precision ) * 1;
5146
5196
 
5147
- this.c[2].textContent = this.value;
5197
+ if(this.haveText) this.c[2].textContent = this.value;
5148
5198
 
5149
5199
  }
5150
5200
 
@@ -8139,11 +8189,12 @@ const add = function () {
8139
8189
 
8140
8190
  }
8141
8191
 
8142
-
8143
-
8144
8192
  let name = type.toLowerCase();
8145
8193
 
8146
- if( name === 'group' ) o.add = add;
8194
+ if( name === 'group' ){
8195
+ o.add = add;
8196
+ //o.dx = 8
8197
+ }
8147
8198
 
8148
8199
  switch( name ){
8149
8200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uil",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "description": "JavaScript gui library",
5
5
  "main": "build/uil.js",
6
6
  "repository": "lo-th/uil",