uil 4.2.2 → 4.2.6

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 CHANGED
@@ -12,7 +12,8 @@
12
12
  /**
13
13
  * @author lth / https://github.com/lo-th
14
14
  */
15
- // INTENAL FUNCTION
15
+ const REVISION = '4.2.6'; // INTENAL FUNCTION
16
+
16
17
  const R = {
17
18
  ui: [],
18
19
  dom: null,
@@ -181,9 +182,7 @@
181
182
  e.type = 'mouseup';
182
183
  }
183
184
 
184
- if (event.type === 'pointerleave') {
185
- R.isLeave = true;
186
- }
185
+ if (event.type === 'pointerleave') R.isLeave = true;
187
186
  if (event.type === 'pointerdown') e.type = 'mousedown';
188
187
  if (event.type === 'pointerup') e.type = 'mouseup';
189
188
 
@@ -229,7 +228,8 @@
229
228
  if (R.ID.isCanvasOnly) {
230
229
  e.clientX = R.ID.mouse.x;
231
230
  e.clientY = R.ID.mouse.y;
232
- }
231
+ } //if( R.ID.marginDiv ) e.clientY -= R.ID.margin * 0.5
232
+
233
233
 
234
234
  R.ID.handleEvent(e);
235
235
  }
@@ -283,40 +283,38 @@
283
283
  // ----------------------
284
284
  // GUI / GROUP FUNCTION
285
285
  // ----------------------
286
- calcUis: function (uis, zone, py) {
286
+ calcUis: (uis, zone, py) => {
287
287
  //console.log('calc_uis')
288
288
  let i = uis.length,
289
289
  u,
290
290
  px = 0,
291
291
  n = 0,
292
- tw;
292
+ tw,
293
+ m;
293
294
  let height = 0;
294
- let m = 1;
295
295
 
296
296
  while (i--) {
297
297
  u = uis[n];
298
298
  n++;
299
299
  if (u.isGroup) u.calcUis();
300
+ m = u.margin; //div = u.marginDiv
301
+
300
302
  u.zone.w = u.w;
301
- u.zone.h = u.h;
302
- m = u.margin;
303
+ u.zone.h = u.h + m;
303
304
 
304
305
  if (!u.autoWidth) {
305
- if (px === 0) {
306
- height += u.h + m;
307
- }
308
-
306
+ if (px === 0) height += u.h + m;
309
307
  u.zone.x = zone.x + px;
310
- u.zone.y = py;
311
- tw = R.getWidth(u);
312
- if (tw) u.zone.w = u.w = tw; // focrce width if content is canvas
313
- else if (u.fw) u.zone.w = u.w = u.fw; //console.log( u.name, u.zone.w, u.w, zone, tw )
314
- //console.log( tw )
308
+ u.zone.y = py; // + u.mtop
309
+ //if(div) u.zone.y += m * 0.5
315
310
 
311
+ tw = R.getWidth(u);
312
+ if (tw) u.zone.w = u.w = tw;else if (u.fw) u.zone.w = u.w = u.fw;
316
313
  px += u.zone.w;
317
314
 
318
315
  if (px >= zone.w) {
319
- py += u.h + m;
316
+ py += u.h + m; //if(div) py += m * 0.5
317
+
320
318
  px = 0;
321
319
  }
322
320
  } else {
@@ -359,8 +357,11 @@
359
357
  if (x === undefined || y === undefined) return false;
360
358
  let z = o.zone;
361
359
  let mx = x - z.x;
362
- let my = y - z.y;
363
- let over = mx >= 0 && my >= 0 && mx <= z.w && my <= z.h;
360
+ let my = y - z.y; //if( this.marginDiv ) e.clientY -= this.margin * 0.5
361
+ //if( o.group && o.group.marginDiv ) my += o.group.margin * 0.5
362
+
363
+ let over = mx >= 0 && my >= 0 && mx <= z.w && my <= z.h; //if( o.marginDiv ) my -= o.margin * 0.5
364
+
364
365
  if (over) o.local.set(mx, my);else o.local.neg();
365
366
  return over;
366
367
  },
@@ -667,11 +668,12 @@
667
668
  pi60: Math.PI / 3,
668
669
  torad: Math.PI / 180,
669
670
  todeg: 180 / Math.PI,
670
- clamp: function (v, min, max) {
671
+ clamp: (v, min, max) => {
671
672
  v = v < min ? min : v;
672
673
  v = v > max ? max : v;
673
674
  return v;
674
675
  },
676
+ isDivid: v => v * 0.5 === Math.floor(v * 0.5),
675
677
  size: {
676
678
  w: 240,
677
679
  h: 20,
@@ -681,7 +683,7 @@
681
683
  // ----------------------
682
684
  // COLOR
683
685
  // ----------------------
684
- defineColor: function (o, cc = T.colors) {
686
+ defineColor: (o, cc = T.colors) => {
685
687
  let color = { ...cc
686
688
  };
687
689
  let textChange = ['fontFamily', 'fontWeight', 'fontShadow', 'fontSize'];
@@ -723,8 +725,8 @@
723
725
  }
724
726
 
725
727
  if (o.fontSelect) color.textSelect = o.fontSelect;
726
- if (o.groupBorder) color.gborder = o.groupBorder;
727
- if (o.transparent) o.bg = 'none'; //if( o.bg ) color.background = color.backgroundOver = o.bg
728
+ if (o.groupBorder) color.gborder = o.groupBorder; //if( o.transparent ) o.bg = 'none'
729
+ //if( o.bg ) color.background = color.backgroundOver = o.bg
728
730
 
729
731
  if (o.bgOver) color.backgroundOver = o.bgOver;
730
732
 
@@ -740,21 +742,21 @@
740
742
  return color;
741
743
  },
742
744
  colors: {
743
- sx: 3,
744
- sy: 3,
745
+ sx: 4,
746
+ //4
747
+ sy: 2,
748
+ //2
749
+ radius: 2,
745
750
  content: 'none',
746
- background: 'rgba(50,50,50,0.3)',
747
- backgroundOver: 'rgba(50,50,50,0.4)',
751
+ background: 'rgba(50,50,50,0.15)',
752
+ backgroundOver: 'rgba(50,50,50,0.3)',
748
753
  title: '#CCC',
749
754
  titleoff: '#BBB',
750
755
  text: '#DDD',
751
756
  textOver: '#EEE',
752
757
  textSelect: '#FFF',
753
- //inputBg: 'rgba(0,0,0,0.25)',
754
- //itemBg:'rgba(0,0,0,0.25)',
755
758
  back: 'rgba(0,0,0,0.2)',
756
759
  backoff: 'rgba(0,0,0,0.3)',
757
- //inputOver: 'rgba(0,0,0,0.2)',
758
760
  // input and button border
759
761
  border: '#4c4c4c',
760
762
  borderSize: 1,
@@ -772,19 +774,13 @@
772
774
  fontShadow: 'none',
773
775
  //'#000',
774
776
  fontSize: 12,
775
- radius: 3,
776
777
  hide: 'rgba(0,0,0,0)'
777
778
  },
778
779
  // style css
779
780
  css: {
780
- //unselect: '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;',
781
781
  basic: 'position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; overflow:hidden; ' + '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;',
782
- button: 'display:flex; justify-content:center; align-items:center; text-align:center;',
783
- middle: 'display:flex; align-items:center;'
784
- /*txt: T.css.basic + 'font-family:'+ T.colors.fontFamily +'; font-size:'+T.colors.fontSize+'px; color:'+T.colors.text+'; padding:2px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;',
785
- txtselect: T.css.txt + 'display:flex; justify-content:left; align-items:center; text-align:left;' +'padding:2px 5px; border:1px dashed ' + T.colors.border + '; background:'+ T.colors.txtselectbg+';',
786
- item: T.css.txt + 'position:relative; background:rgba(0,0,0,0.2); margin-bottom:1px;',*/
787
-
782
+ button: 'display:flex; align-items:center; justify-content:center; text-align:center;',
783
+ middle: 'display:flex; align-items:center; justify-content:left; text-align:left; flex-direction: row-reverse;'
788
784
  },
789
785
  // svg path
790
786
  svgs: {
@@ -809,7 +805,9 @@
809
805
  object: 'M 10 1 L 7 4 4 1 1 1 1 13 4 13 4 5 7 8 10 5 10 13 13 13 13 1 10 1 Z',
810
806
  none: 'M 9 5 L 5 5 5 9 9 9 9 5 Z',
811
807
  cursor: 'M 4 7 L 1 10 1 12 2 13 4 13 7 10 9 14 14 0 0 5 4 7 Z',
812
- load: 'M 14 8 L 12 8 12 12 2 12 2 8 0 8 0 14 14 14 14 8 M 8 5 L 8 0 6 0 6 5 3 5 7 9 11 5 8 5 Z'
808
+ load: 'M 13 8 L 11.5 6.5 9 9 9 3 5 3 5 9 2.5 6.5 1 8 7 14 13 8 M 9 2 L 9 0 5 0 5 2 9 2 Z',
809
+ save: 'M 9 12 L 5 12 5 14 9 14 9 12 M 11.5 7.5 L 13 6 7 0 1 6 2.5 7.5 5 5 5 11 9 11 9 5 11.5 7.5 Z',
810
+ extern: 'M 14 14 L 14 0 0 0 0 14 14 14 M 12 6 L 12 12 2 12 2 6 12 6 M 12 2 L 12 4 2 4 2 2 12 2 Z'
813
811
  },
814
812
 
815
813
  rezone() {
@@ -842,15 +840,13 @@
842
840
 
843
841
  if (isNaN(size)) {
844
842
  if (size.search('em') === -1) size += 'px';
845
- } else size += 'px';
843
+ } else size += 'px'; //let align = 'display:flex; justify-content:left; align-items:center; text-align:left;'
846
844
 
847
- let align = 'display:flex; justify-content:left; align-items:center; text-align:left;';
848
- T.css.txt = T.css.basic + align + ' font-family:' + font + '; font-weight:' + weight + '; font-size:' + size + '; color:' + cc.text + '; padding:0px 8px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap; letter-spacing: normal;';
849
- if (shadow !== 'none') T.css.txt += ' text-shadow: 1px 1px 1px ' + shadow + ';';
850
- T.css.txtselect = T.css.txt + 'padding:0px 4px; border:1px dashed ' + cc.border + ';'; //T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; '//display:block; padding:4px 4px;';//
851
845
 
852
- T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; display:block; padding:2px 4px;'; //
853
- //console.log( T.css.txt )
846
+ T.css.txt = T.css.basic + T.css.middle + ' font-family:' + font + '; font-weight:' + weight + '; font-size:' + size + '; color:' + cc.text + '; padding:0px 8px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap; letter-spacing: normal;';
847
+ if (shadow !== 'none') T.css.txt += ' text-shadow: 1px 1px 1px ' + shadow + ';';
848
+ T.css.txtselect = T.css.txt + 'padding:0px 4px; border:1px dashed ' + cc.border + ';';
849
+ T.css.item = T.css.txt + 'padding:0px 4px; position:relative; margin-bottom:1px; ';
854
850
  },
855
851
  // note
856
852
  //https://developer.mozilla.org/fr/docs/Web/CSS/css_flexible_box_layout/aligning_items_in_a_flex_container
@@ -1002,6 +998,7 @@
1002
998
  // Color function
1003
999
  // ----------------------
1004
1000
  ColorLuma: function (hex, l) {
1001
+ //if( hex.substring(0, 3) === 'rgba' ) hex = '#000';
1005
1002
  if (hex === 'n') hex = '#000'; // validate hex string
1006
1003
 
1007
1004
  hex = String(hex).replace(/[^0-9a-f]/gi, '');
@@ -1675,6 +1672,15 @@
1675
1672
  }
1676
1673
  }];
1677
1674
  break;
1675
+
1676
+ case 'icon':
1677
+ t = [{
1678
+ description: 'Icons',
1679
+ accept: {
1680
+ 'image/x-ico': ['.ico']
1681
+ }
1682
+ }];
1683
+ break;
1678
1684
  }
1679
1685
 
1680
1686
  return t;
@@ -1942,6 +1948,8 @@
1942
1948
  this.isUI = o.isUI || false;
1943
1949
  this.group = o.group || null;
1944
1950
  this.isListen = false;
1951
+ this.top = 0;
1952
+ this.ytop = 0;
1945
1953
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1946
1954
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1947
1955
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
@@ -1953,7 +1961,8 @@
1953
1961
  x: 0,
1954
1962
  y: 0,
1955
1963
  w: 0,
1956
- h: 0
1964
+ h: 0,
1965
+ d: 0
1957
1966
  };
1958
1967
  this.local = new V2().neg();
1959
1968
  this.isCanvasOnly = false;
@@ -2019,16 +2028,20 @@
2019
2028
  this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;');
2020
2029
  this.s[0] = this.c[0].style; // bottom margin
2021
2030
 
2022
- this.margin = o.margin || 1;
2031
+ this.margin = this.colors.sy;
2032
+ this.mtop = 0;
2033
+ let marginDiv = Tools.isDivid(this.margin);
2023
2034
 
2024
2035
  if (this.isUI && this.margin) {
2025
- this.s[0].boxSizing = 'content-box'; //this.s[0].marginBottom = this.margin + 'px';
2036
+ this.s[0].boxSizing = 'content-box';
2037
+
2038
+ if (marginDiv) {
2039
+ this.mtop = this.margin * 0.5; //this.s[0].borderTop = '${this.mtop}px solid transparent'
2040
+ //console.log(`${this.mtop}px solid transparent`)
2026
2041
 
2027
- if (this.margin * 0.5 === Math.floor(this.margin * 0.5)) {
2028
- this.s[0].borderTop = this.margin * 0.5 + 'px solid transparent';
2029
- this.s[0].borderBottom = this.margin * 0.5 + 'px solid transparent';
2042
+ this.s[0].borderTop = this.mtop + 'px solid transparent';
2043
+ this.s[0].borderBottom = this.mtop + 'px solid transparent';
2030
2044
  } else {
2031
- //this.s[0].borderTop = (this.margin*0.5) + 'px solid transparent'
2032
2045
  this.s[0].borderBottom = this.margin + 'px solid transparent';
2033
2046
  }
2034
2047
  } // with title
@@ -2058,7 +2071,8 @@
2058
2071
 
2059
2072
 
2060
2073
  init() {
2061
- this.zone.h = this.h;
2074
+ this.ytop = this.top + this.mtop;
2075
+ this.zone.h = this.h + this.margin;
2062
2076
  this.zone.w = this.w;
2063
2077
  let s = this.s; // style cache
2064
2078
 
@@ -2079,8 +2093,7 @@
2079
2093
  if (c[1] !== undefined && this.autoWidth) {
2080
2094
  s[1] = c[1].style;
2081
2095
  s[1].top = 1 + 'px';
2082
- s[1].height = this.h - 2 + 'px'; //s[1].height = (this.h-4) + 'px';
2083
- // s[1].lineHeight = (this.h-8) + 'px';
2096
+ s[1].height = this.h - 2 + 'px';
2084
2097
  }
2085
2098
 
2086
2099
  let frag = Tools.frag;
@@ -2162,6 +2175,10 @@
2162
2175
  reset() {} /////////
2163
2176
 
2164
2177
 
2178
+ content() {
2179
+ return this.c[0];
2180
+ }
2181
+
2165
2182
  getDom() {
2166
2183
  return this.c[0];
2167
2184
  }
@@ -2341,6 +2358,10 @@
2341
2358
  case 5:
2342
2359
  s = 0.00001;
2343
2360
  break;
2361
+
2362
+ case 6:
2363
+ s = 0.000001;
2364
+ break;
2344
2365
  }
2345
2366
 
2346
2367
  this.step = o.step === undefined ? s : o.step;
@@ -2359,7 +2380,11 @@
2359
2380
  handleEvent(e) {
2360
2381
  if (this.lock) return;
2361
2382
  if (this.neverlock) Roots.lock = false;
2362
- if (!this[e.type]) return console.error(e.type, 'this type of event no existe !');
2383
+ if (!this[e.type]) return console.error(e.type, 'this type of event no existe !'); // TODO !!!!
2384
+ //if( this.marginDiv ) z.d -= this.margin * 0.5
2385
+ //if( this.marginDiv ) e.clientY -= this.margin * 0.5
2386
+ //if( this.group && this.group.marginDiv ) e.clientY -= this.group.margin * 0.5
2387
+
2363
2388
  return this[e.type](e);
2364
2389
  }
2365
2390
 
@@ -2467,7 +2492,7 @@
2467
2492
  } else {
2468
2493
  this.p = 0;
2469
2494
  if (this.c[1] !== undefined) this.c[1].textContent = '';
2470
- this.c[2] = this.dom('div', this.css.txt + this.css.button + 'top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:1px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
2495
+ this.c[2] = this.dom('div', this.css.txt + this.css.button + 'top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:' + cc.borderSize + 'px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
2471
2496
  }
2472
2497
 
2473
2498
  this.stat = -1;
@@ -2587,7 +2612,7 @@
2587
2612
  s[3].left = w + 'px';
2588
2613
  } else {
2589
2614
  s[2].left = this.sa + 'px';
2590
- s[2].width = this.w - 20 + 'px';
2615
+ s[2].width = this.sb + 'px';
2591
2616
  }
2592
2617
  }
2593
2618
 
@@ -2626,19 +2651,18 @@
2626
2651
  this.stat[i] = sel ? 3 : 1;
2627
2652
  }
2628
2653
 
2629
- if (!o.value && !o.values) {
2630
- if (this.c[1] !== undefined) {
2631
- this.c[1].textContent = ''; //this.txt = ''
2632
- }
2654
+ if (this.txt === '') this.p = 0;
2655
+
2656
+ if (!o.value && !o.values || this.p === 0) {
2657
+ if (this.c[1] !== undefined) this.c[1].textContent = '';
2633
2658
  }
2634
2659
 
2635
- if (this.txt === '') this.p = 0;
2636
2660
  this.init();
2637
2661
  }
2638
2662
 
2639
2663
  onOff() {
2640
2664
  this.on = !this.on;
2641
- this.label(this.on ? this.onName : this.txt);
2665
+ this.label(this.on ? this.onName : this.value);
2642
2666
  }
2643
2667
 
2644
2668
  testZone(e) {
@@ -2814,7 +2838,6 @@
2814
2838
  this.pi90 = Tools.pi90;
2815
2839
  this.offset = new V2();
2816
2840
  this.h = o.h || this.w + 10;
2817
- this.top = 0;
2818
2841
  this.c[0].style.width = this.w + 'px';
2819
2842
  this.c[0].style.display = 'block';
2820
2843
 
@@ -2904,7 +2927,7 @@
2904
2927
 
2905
2928
  let off = this.offset;
2906
2929
  off.x = this.w * 0.5 - (e.clientX - this.zone.x);
2907
- off.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.top);
2930
+ off.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.ytop);
2908
2931
  this.r = off.angle() - this.pi90;
2909
2932
  this.r = (this.r % this.twoPi + this.twoPi) % this.twoPi;
2910
2933
 
@@ -2991,15 +3014,16 @@
2991
3014
  this.offset = new V2();
2992
3015
  this.decal = new V2();
2993
3016
  this.pp = new V2();
2994
- this.c[2] = this.dom('div', this.css.txt + 'height:' + (this.h - 4) + 'px;' + 'border-radius:' + this.radius + 'px; line-height:' + (this.h - 8) + 'px;');
2995
- this.s[2] = this.c[2].style;
2996
- this.s[2].textShadow = 'none';
3017
+ let cc = this.colors; // this.c[2] = this.dom( 'div', this.css.txt + this.css.middle + 'top:1px; height:'+(this.h-2)+'px;' + 'border-radius:'+this.radius+'px; text-shadow:none; border:'+cc.borderSize+'px solid '+cc.border+';' )
2997
3018
 
2998
- if (this.up) {
2999
- this.s[2].top = 'auto';
3000
- this.s[2].bottom = '2px';
3001
- } //this.c[0].style.textAlign = 'center';
3019
+ this.c[2] = this.dom('div', `${this.css.txt} ${this.css.middle} top:1px; height:${this.h - 2}px; border-radius:${this.radius}px; text-shadow:none; border:${cc.borderSize}px solid ${cc.border};`); //this.s[2] = this.c[2].style;
3020
+ //this.s[2].textShadow = 'none'
3002
3021
 
3022
+ /*if( this.up ){
3023
+ this.s[2].top = 'auto';
3024
+ this.s[2].bottom = '2px';
3025
+ }*/
3026
+ //this.c[0].style.textAlign = 'center';
3003
3027
 
3004
3028
  this.c[0].style.display = 'block';
3005
3029
  this.c[3] = this.getColorRing();
@@ -3019,8 +3043,8 @@
3019
3043
  this.tsl = Math.sqrt(3) * this.tr;
3020
3044
  this.hue = 0;
3021
3045
  this.d = 256;
3022
- this.setColor(this.value);
3023
3046
  this.init();
3047
+ this.setColor(this.value);
3024
3048
  if (o.open !== undefined) this.open();
3025
3049
  }
3026
3050
 
@@ -3075,7 +3099,7 @@
3075
3099
  if (name === 'color') {
3076
3100
  off = this.offset;
3077
3101
  off.x = e.clientX - (this.zone.x + this.decal.x + this.mid);
3078
- off.y = e.clientY - (this.zone.y + this.decal.y + this.mid);
3102
+ off.y = e.clientY - (this.zone.y + this.decal.y + this.mid) - this.ytop;
3079
3103
  d = off.length() * this.ratio;
3080
3104
  rr = off.angle();
3081
3105
  if (rr < 0) rr += 2 * T.PI;
@@ -3243,7 +3267,9 @@
3243
3267
  super.rSize();
3244
3268
  let s = this.s;
3245
3269
  s[2].width = this.sb + 'px';
3246
- s[2].left = this.sa + 'px';
3270
+ s[2].left = this.sa + 'px'; //console.log(this.sb)
3271
+
3272
+ this.cw = this.sb > 256 ? 256 : this.sb;
3247
3273
  this.rSizeColor(this.cw);
3248
3274
  this.decal.x = Math.floor((this.w - this.wfixe) * 0.5); //s[3].left = this.decal.x + 'px';
3249
3275
  }
@@ -3744,7 +3770,7 @@
3744
3770
  nup = this.mode(this.isDown ? 2 : 1, name); //this.cursor( this.current !== -1 ? 'move' : 'pointer' );
3745
3771
 
3746
3772
  if (this.isDown) {
3747
- this.v[name] = this.clamp(1 - (e.clientY - this.zone.y - this.top - 10) / this.gh, 0, 1);
3773
+ this.v[name] = this.clamp(1 - (e.clientY - this.zone.y - this.ytop - 10) / this.gh, 0, 1);
3748
3774
  this.update(true);
3749
3775
  }
3750
3776
  }
@@ -3815,70 +3841,57 @@
3815
3841
  this.baseH = this.h;
3816
3842
  let fltop = Math.floor(this.h * 0.5) - 3;
3817
3843
  const cc = this.colors;
3818
- this.isLine = o.line !== undefined ? o.line : false;
3819
3844
  this.useFlex = true;
3820
3845
  let flexible = this.useFlex ? 'display:flex; flex-flow: row wrap;' : '';
3821
- this.c[2] = this.dom('div', this.css.basic + flexible + 'width:100%; left:0; height:auto; overflow:hidden; top:' + (this.h - 1) + 'px');
3846
+ this.c[2] = this.dom('div', this.css.basic + flexible + 'width:100%; left:0; height:auto; overflow:hidden; top:' + this.h + 'px');
3822
3847
  this.c[3] = this.dom('path', this.css.basic + 'position:absolute; width:6px; height:6px; left:0; top:' + fltop + 'px;', {
3823
3848
  d: this.svgs.g1,
3824
3849
  fill: cc.text,
3825
3850
  stroke: 'none'
3826
- }); //this.c[3] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:this.svgs.group, fill:cc.text, stroke:'none'})
3827
- //this.c[3] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:this.svgs.group, fill:cc.text, stroke:'none'})
3828
- //this.c[4] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:'+(this.decal-1)+'px; top:'+fltop+'px;', { d:this.svgs.arrow, fill:cc.text, stroke:'none'})
3829
- // bottom line
3830
-
3831
- 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'); //else this.c[5] = this.dom( 'div', this.css.basic + 'width:100%; left:0; height:auto; top:'+(this.h-1)+'px')
3832
-
3833
- let s = this.s;
3834
- s[0].height = this.h + 'px';
3851
+ });
3852
+ let bh = this.mtop === 0 ? this.margin : this.mtop;
3853
+ this.c[4] = this.dom('div', this.css.basic + 'width:100%; left:0; height:' + (bh + 1) + 'px; top:' + (this.h - 1) + 'px; background:none;');
3854
+ this.s;
3835
3855
  this.c[1].name = 'group';
3836
-
3837
- if (cc.groups !== 'none') {
3838
- s[1].background = cc.groups;
3839
- s[1].border = cc.borderSize + 'px solid ' + cc.border;
3840
- s[1].borderRadius = this.radius + 'px'; //s[5].border = '2px solid ' + '#000'
3841
- //s[1].marginRight = 10+'px';
3842
- } //this.c[1].innerHTML = this.dd + this.name
3843
- //s[1].padding = '0px ' + (10+this.decal)+'px';
3844
-
3845
-
3846
- s[1].lineHeight = this.h - 4;
3847
- s[1].color = cc.text; //s[1].fontWeight = 'bold';
3848
-
3849
3856
  this.init();
3850
-
3851
- if (this.radius !== 0) {
3852
- //s[0].borderRadius = this.radius+'px'
3853
- s[1].borderRadius = this.radius + 'px';
3854
- s[2].borderRadius = this.radius + 'px';
3855
- } //s[1].paddingLeft = (10+this.decal)+'px'
3856
-
3857
-
3858
3857
  this.setBG(o.bg);
3859
3858
  if (o.open) this.open();
3860
3859
  }
3861
3860
 
3862
3861
  setBG(bg) {
3863
- this.colors;
3864
- const s = this.s; //if( bg !== undefined ) this.colors.background = bg
3865
- //this.c[0].style.background = this.colors.background;
3862
+ const cc = this.colors;
3863
+ const s = this.s;
3864
+ if (bg !== undefined) cc.groups = bg;
3865
+ if (cc.groups === 'none') cc.groups = cc.background;
3866
+ cc.background = 'none';
3867
+ s[0].background = 'none';
3868
+ s[1].background = cc.groups;
3869
+ s[2].background = cc.groups;
3866
3870
 
3867
- s[1].background = bg; //this.colors.background
3871
+ if (cc.gborder !== 'none') {
3872
+ s[1].border = cc.borderSize + 'px solid ' + cc.gborder;
3873
+ }
3868
3874
 
3869
- s[2].background = bg; //s[5].border = '1px solid ' + '#000'
3870
- // s[5].background = '#000'
3875
+ if (this.radius !== 0) {
3876
+ s[1].borderRadius = this.radius + 'px';
3877
+ s[2].borderRadius = this.radius + 'px';
3878
+ }
3879
+ /*let i = this.uis.length;
3880
+ while(i--){
3881
+ this.uis[i].setBG( 'none' );
3882
+ //this.uis[i].setBG( this.colors.background );
3883
+ }*/
3871
3884
 
3872
- this.uis.length;
3873
3885
  }
3874
3886
 
3875
3887
  testZone(e) {
3876
3888
  let l = this.local;
3877
3889
  if (l.x === -1 && l.y === -1) return '';
3878
3890
  let name = '';
3879
- if (l.y < this.baseH) name = 'title';else {
3891
+ if (l.y < this.baseH + this.margin) name = 'title';else {
3880
3892
  if (this.isOpen) name = 'content';
3881
- }
3893
+ } //console.log(name)
3894
+
3882
3895
  return name;
3883
3896
  }
3884
3897
 
@@ -3913,13 +3926,20 @@
3913
3926
 
3914
3927
  switch (name) {
3915
3928
  case 'content':
3916
- this.cursor();
3929
+ //this.cursor()
3930
+ //if( this.marginDiv ) e.clientY -= this.margin * 0.5
3917
3931
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
3918
- if (this.proto) protoChange = this.proto.handleEvent(e);
3932
+
3933
+ if (this.proto) {
3934
+ //e.clientY -= this.margin
3935
+ protoChange = this.proto.handleEvent(e);
3936
+ }
3937
+
3919
3938
  if (!Roots.lock) this.getNext(e, change);
3920
3939
  break;
3921
3940
 
3922
3941
  case 'title':
3942
+ //this.cursor( this.isOpen ? 'n-resize':'s-resize' );
3923
3943
  this.cursor('pointer');
3924
3944
 
3925
3945
  if (type === 'mousedown') {
@@ -3970,7 +3990,9 @@
3970
3990
  }
3971
3991
  }
3972
3992
 
3973
- let u = this.ADD.apply(this, a);
3993
+ let u = this.ADD.apply(this, a); //u.margin += this.margin
3994
+ //console.log( u.margin )
3995
+
3974
3996
  this.uis.push(u);
3975
3997
  this.isEmpty = false;
3976
3998
  return u;
@@ -4012,7 +4034,7 @@
4012
4034
  let id = this.uis.indexOf(n);
4013
4035
 
4014
4036
  if (id !== -1) {
4015
- this.calc(-(this.uis[id].h + 1));
4037
+ this.calc(-(this.uis[id].h + this.margin));
4016
4038
  this.c[2].removeChild(this.uis[id].c[0]);
4017
4039
  this.uis.splice(id, 1);
4018
4040
 
@@ -4025,11 +4047,14 @@
4025
4047
 
4026
4048
  open() {
4027
4049
  super.open();
4028
- this.setSvg(this.c[3], 'd', this.svgs.g2); //this.setSvg( this.c[4], 'd', this.svgs.arrowDown )
4050
+ this.setSvg(this.c[3], 'd', this.svgs.g2);
4051
+ this.rSizeContent(); //let t = this.h - this.baseH
4029
4052
 
4030
- this.rSizeContent();
4031
- this.h - this.baseH;
4032
4053
  const s = this.s;
4054
+ const cc = this.colors; //s[2].top = (this.h-1) + 'px'
4055
+
4056
+ s[2].top = this.h + this.mtop + 'px';
4057
+ s[4].background = cc.groups; //'#0f0'
4033
4058
 
4034
4059
  if (this.radius) {
4035
4060
  s[1].borderRadius = '0px';
@@ -4040,23 +4065,43 @@
4040
4065
  s[2].borderBottomRightRadius = this.radius + 'px';
4041
4066
  }
4042
4067
 
4068
+ if (cc.gborder !== 'none') {
4069
+ s[4].borderLeft = cc.borderSize + 'px solid ' + cc.gborder;
4070
+ s[4].borderRight = cc.borderSize + 'px solid ' + cc.gborder;
4071
+ s[2].border = cc.borderSize + 'px solid ' + cc.gborder;
4072
+ s[2].borderTop = 'none';
4073
+ s[1].borderBottom = cc.borderSize + 'px solid rgba(0,0,0,0)';
4074
+ }
4075
+
4043
4076
  this.parentHeight();
4044
4077
  }
4045
4078
 
4046
4079
  close() {
4047
- super.close();
4048
- this.h - this.baseH;
4049
- this.setSvg(this.c[3], 'd', this.svgs.g1); //this.setSvg( this.c[4], 'd', this.svgs.arrow )
4080
+ super.close(); //let t = this.h - this.baseH
4050
4081
 
4082
+ this.setSvg(this.c[3], 'd', this.svgs.g1);
4051
4083
  this.h = this.baseH;
4052
4084
  const s = this.s;
4053
- s[0].height = this.h + 'px';
4085
+ const cc = this.colors;
4086
+ s[0].height = this.h + 'px'; //s[1].height = (this.h-2) + 'px'
4087
+ //s[2].top = this.h + 'px'
4088
+
4089
+ s[2].top = this.h + this.mtop + 'px';
4090
+ s[4].background = 'none';
4091
+
4092
+ if (cc.gborder !== 'none') {
4093
+ s[4].border = 'none';
4094
+ s[2].border = 'none';
4095
+ s[1].border = cc.borderSize + 'px solid ' + cc.gborder;
4096
+ }
4097
+
4054
4098
  if (this.radius) s[1].borderRadius = this.radius + 'px';
4055
4099
  this.parentHeight();
4056
4100
  }
4057
4101
 
4058
4102
  calcUis() {
4059
- if (!this.isOpen) this.h = this.baseH;else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH) + this.baseH;
4103
+ if (!this.isOpen) this.h = this.baseH; //else this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH ) + this.baseH;
4104
+ else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH + this.margin) + this.baseH;
4060
4105
  this.s[0].height = this.h + 'px';
4061
4106
  }
4062
4107
 
@@ -4083,15 +4128,24 @@
4083
4128
  super.rSize();
4084
4129
  let s = this.s;
4085
4130
  this.w = this.w - this.decal;
4086
- s[3].left = this.sa + this.sb - 6 + 'px'; //s[1].width = this.isbgGroup ? (this.w-5) + 'px' : this.w + 'px'
4087
-
4131
+ s[3].left = this.sa + this.sb - 6 + 'px';
4088
4132
  s[1].width = this.w + 'px';
4089
- s[2].width = this.w + 'px'; //s[1].width = (this.w - this.decal) + 'px'
4090
- //s[2].width = (this.w - this.decal) + 'px'
4091
-
4133
+ s[2].width = this.w + 'px';
4092
4134
  s[1].left = this.decal + 'px';
4093
4135
  s[2].left = this.decal + 'px';
4094
4136
  if (this.isOpen) this.rSizeContent();
4137
+ } //
4138
+
4139
+
4140
+ uiout() {
4141
+ if (this.lock) return;
4142
+ if (this.s) this.s[0].background = this.colors.background;
4143
+ }
4144
+
4145
+ uiover() {
4146
+ if (this.lock) return; //if( this.isOpen ) return;
4147
+
4148
+ if (this.s) this.s[0].background = this.colors.backgroundOver;
4095
4149
  }
4096
4150
 
4097
4151
  }
@@ -4115,7 +4169,6 @@
4115
4169
 
4116
4170
  this.distance = this.diam * 0.5 * 0.25;
4117
4171
  this.h = o.h || this.w + 10;
4118
- this.top = 0;
4119
4172
  this.c[0].style.width = this.w + 'px';
4120
4173
 
4121
4174
  if (this.c[1] !== undefined) {
@@ -4215,7 +4268,7 @@
4215
4268
  //this.tmp.y = this.radius - ( e.clientY - this.zone.y - this.top );
4216
4269
 
4217
4270
  this.tmp.x = this.w * 0.5 - (e.clientX - this.zone.x);
4218
- this.tmp.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.top);
4271
+ this.tmp.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.ytop);
4219
4272
  let distance = this.tmp.length();
4220
4273
 
4221
4274
  if (distance > this.distance) {
@@ -4296,7 +4349,6 @@
4296
4349
  this.cirRange = this.mPI * 2;
4297
4350
  this.offset = new V2();
4298
4351
  this.h = o.h || this.w + 10;
4299
- this.top = 0;
4300
4352
  this.c[0].style.width = this.w + 'px';
4301
4353
  this.c[0].style.display = 'block';
4302
4354
 
@@ -4399,7 +4451,7 @@
4399
4451
  //off.y = this.radius - ( e.clientY - this.zone.y - this.top );
4400
4452
 
4401
4453
  off.x = this.w * 0.5 - (e.clientX - this.zone.x);
4402
- off.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.top);
4454
+ off.y = this.diam * 0.5 - (e.clientY - this.zone.y - this.ytop);
4403
4455
  this.r = -Math.atan2(off.x, off.y);
4404
4456
  if (this.oldr !== null) this.r = Math.abs(this.r - this.oldr) > Math.PI ? this.oldr : this.r;
4405
4457
  this.r = this.r > this.mPI ? this.mPI : this.r;
@@ -4509,9 +4561,9 @@
4509
4561
  this.isWithImage = this.path !== '' ? true : false;
4510
4562
  this.preLoadComplete = false;
4511
4563
  this.tmpImage = {};
4512
- this.tmpUrl = []; //this.autoHeight = false;
4513
-
4514
- let align = o.align || 'center'; // scroll size
4564
+ this.tmpUrl = [];
4565
+ this.m = o.m !== undefined ? o.m : 5;
4566
+ let align = o.align || 'left'; // scroll size
4515
4567
 
4516
4568
  let ss = o.scrollSize || 10;
4517
4569
  this.ss = ss + 1;
@@ -4526,7 +4578,7 @@
4526
4578
  let fltop = Math.floor(this.h * 0.5) - 3;
4527
4579
  let cc = this.colors;
4528
4580
  this.c[2] = this.dom('div', this.css.basic + 'top:0; display:none; border-radius:' + this.radius + 'px;');
4529
- this.c[3] = this.dom('div', this.css.item + 'position:absolute; text-align:' + align + '; line-height:' + (this.h - 4) + 'px; top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:1px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
4581
+ this.c[3] = this.dom('div', this.css.item + 'padding:0px ' + this.m + 'px; margin-bottom:0px; position:absolute; justify-content:' + align + '; text-align:' + align + '; line-height:' + (this.h - 4) + 'px; top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:1px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
4530
4582
  this.c[4] = this.dom('path', this.css.basic + 'position:absolute; width:6px; height:6px; top:' + fltop + 'px;', {
4531
4583
  d: this.svgs.g1,
4532
4584
  fill: cc.text,
@@ -4541,7 +4593,7 @@
4541
4593
  if (o.list) {
4542
4594
  if (o.list instanceof Array) {
4543
4595
  this.list = o.list;
4544
- } else {
4596
+ } else if (o.list instanceof Object) {
4545
4597
  this.refObject = o.list;
4546
4598
 
4547
4599
  for (let g in this.refObject) this.list.push(g);
@@ -4551,7 +4603,8 @@
4551
4603
  this.items = [];
4552
4604
  this.prevName = '';
4553
4605
  this.baseH = this.h;
4554
- this.itemHeight = o.itemHeight || this.h - 3; // force full list
4606
+ this.itemHeight = o.itemHeight || this.h; //(this.h-3);
4607
+ // force full list
4555
4608
 
4556
4609
  this.full = o.full || false;
4557
4610
  this.py = 0;
@@ -4566,8 +4619,7 @@
4566
4619
  if (this.up) {
4567
4620
  this.c[2].style.top = 'auto';
4568
4621
  this.c[3].style.top = 'auto';
4569
- this.c[4].style.top = 'auto'; //this.c[5].style.top = 'auto';
4570
-
4622
+ this.c[4].style.top = 'auto';
4571
4623
  this.c[2].style.bottom = this.h - 2 + 'px';
4572
4624
  this.c[3].style.bottom = '1px';
4573
4625
  this.c[4].style.bottom = fltop + 'px';
@@ -4611,12 +4663,8 @@
4611
4663
  this.setList(this.list);
4612
4664
  this.init();
4613
4665
  if (this.isOpenOnStart) this.open(true);
4614
- }
4615
- /*send ( v ) {
4616
- super.send( v );
4617
- //Proto.prototype.send.call( this, v );
4618
- }*/
4619
- // image list
4666
+ this.baseH += this.mtop;
4667
+ } // image list
4620
4668
 
4621
4669
 
4622
4670
  preloadImage() {
@@ -4773,10 +4821,9 @@
4773
4821
  // is item
4774
4822
  if (this.current) {
4775
4823
  this.value = this.list[this.current.id];
4776
- if (this.isSelectable) this.selected(); //this.value = this.refObject !== null ? this.refObject[this.list[this.current.id]] : this.list[this.current.id]
4777
- //this.value = this.current.textContent;
4824
+ if (this.isSelectable) this.selected(); //this.send( this.refObject !== null ? this.refObject[ this.list[this.current.id]] : this.value );
4778
4825
 
4779
- this.send(this.refObject !== null ? this.refObject[this.list[this.current.id]] : this.value);
4826
+ this.send(this.value);
4780
4827
 
4781
4828
  if (!this.listOnly) {
4782
4829
  this.close();
@@ -4802,7 +4849,8 @@
4802
4849
  this.modeScroll(1);
4803
4850
 
4804
4851
  if (this.isDown) {
4805
- this.modeScroll(2);
4852
+ this.modeScroll(2); //this.update( ( e.clientY - top ) - ( this.sh*0.5 ) );
4853
+
4806
4854
  let top = this.zone.y + this.baseH - 2;
4807
4855
  this.update(e.clientY - top - this.sh * 0.5);
4808
4856
  } //if(this.isDown) this.listmove(e);
@@ -4927,7 +4975,7 @@
4927
4975
 
4928
4976
  for (let i = 0; i < this.length; i++) {
4929
4977
  n = this.list[i];
4930
- item = this.dom('div', this.css.item + 'width:' + this.ww + 'px; height:' + this.itemHeight + 'px; line-height:' + (this.itemHeight - 5) + 'px; color:' + this.colors.text + '; background:' + this.colors.back + ';');
4978
+ item = this.dom('div', this.css.item + 'padding:0px ' + (this.m + 1) + 'px; width:' + this.ww + 'px; height:' + this.itemHeight + 'px; line-height:' + (this.itemHeight - 2) + 'px; color:' + this.colors.text + '; background:' + this.colors.back + ';');
4931
4979
  item.name = 'item' + i;
4932
4980
  item.id = i;
4933
4981
  item.select = false;
@@ -4940,15 +4988,18 @@
4940
4988
 
4941
4989
  if (this.miniCanvas) {
4942
4990
  let c = new Image();
4943
- c.src = this.tmpCanvas.toDataURL();
4991
+ c.src = this.tmpCanvas.toDataURL(); //item.style.marginLeft = (this.imageSize[0]+8)+'px'
4992
+
4944
4993
  /*let c = document.createElement('canvas')
4945
4994
  c.width = this.imageSize[0]
4946
4995
  c.height = this.imageSize[1]
4947
4996
  let ctx = c.getContext("2d")
4948
4997
  ctx.fillStyle = this.canvasBg
4949
4998
  ctx.fillRect(0, 0, this.imageSize[0], this.imageSize[1])*/
4999
+ //c.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'
5000
+ // c.style.cssText =' flex-shrink: 0;'
4950
5001
 
4951
- c.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'; //c.style.cssText = 'display:flex; align-content: flex-start; flex-wrap: wrap;'
5002
+ c.style.cssText = 'margin-right:4px;'; //c.style.cssText = 'display:flex; align-content: flex-start; flex-wrap: wrap;'
4952
5003
  //item.style.float = 'right'
4953
5004
 
4954
5005
  item.appendChild(c);
@@ -5014,8 +5065,10 @@
5014
5065
  this.canvas = document.createElement('canvas');
5015
5066
  this.canvas.width = this.imageSize[0];
5016
5067
  this.canvas.height = this.imageSize[1];
5017
- this.canvas.style.cssText = 'position:absolute; top:0px; left:0px;';
5068
+ this.canvas.style.cssText = 'margin-right:4px;';
5018
5069
  this.ctx = this.canvas.getContext("2d");
5070
+ this.c[3].style.textAlign = 'left';
5071
+ this.c[3].style.justifyContent = 'left';
5019
5072
  this.c[3].appendChild(this.canvas);
5020
5073
  }
5021
5074
 
@@ -5028,11 +5081,10 @@
5028
5081
  this.canvas = document.createElement('canvas');
5029
5082
  this.canvas.width = this.imageSize[0];
5030
5083
  this.canvas.height = this.imageSize[1];
5031
- (this.h - this.imageSize[1]) * 0.5;
5032
- this.canvas.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'; //this.canvas.style.cssText = 'position:absolute; top:'+h+'px; left:5px;'
5033
-
5084
+ this.canvas.style.cssText = 'margin-right:4px;';
5034
5085
  this.ctx = this.canvas.getContext("2d");
5035
5086
  this.c[3].style.textAlign = 'left';
5087
+ this.c[3].style.justifyContent = 'left';
5036
5088
  this.c[3].appendChild(this.canvas);
5037
5089
  }
5038
5090
 
@@ -5161,8 +5213,8 @@
5161
5213
  if (o.value.y !== undefined) this.value[1] = o.value.y;
5162
5214
  if (o.value.z !== undefined) this.value[2] = o.value.z;
5163
5215
  if (o.value.w !== undefined) this.value[3] = o.value.w;
5164
- this.isVector = true;
5165
5216
  this.isSingle = false;
5217
+ this.isVector = true;
5166
5218
  }
5167
5219
  }
5168
5220
 
@@ -5183,7 +5235,7 @@
5183
5235
 
5184
5236
  while (i--) {
5185
5237
  if (this.isAngle) this.value[i] = (this.value[i] * 180 / Math.PI).toFixed(this.precision);
5186
- this.c[3 + i] = this.dom('div', this.css.txtselect + ' height:' + (this.h - 4) + 'px; color:' + cc.text + '; background:' + cc.back + '; borderColor:' + cc.border + '; border-radius:' + this.radius + 'px;');
5238
+ this.c[3 + i] = this.dom('div', this.css.txtselect + 'top:1px; height:' + (this.h - 2) + 'px; color:' + cc.text + '; background:' + cc.back + '; borderColor:' + cc.border + '; border-radius:' + this.radius + 'px;');
5187
5239
  if (o.center) this.c[2 + i].style.textAlign = 'center';
5188
5240
  this.c[3 + i].textContent = this.value[i];
5189
5241
  this.c[3 + i].style.color = this.colors.text;
@@ -5193,10 +5245,10 @@
5193
5245
 
5194
5246
 
5195
5247
  this.selectId = 3 + this.lng;
5196
- this.c[this.selectId] = this.dom('div', this.css.txtselect + 'position:absolute; top:4px; height:' + (this.h - 8) + 'px; padding:0px 0px; width:0px; color:' + cc.textSelect + '; background:' + cc.select + '; border:none; border-radius:0px;'); // cursor
5248
+ this.c[this.selectId] = this.dom('div', this.css.txtselect + 'position:absolute; top:2px; height:' + (this.h - 4) + 'px; padding:0px 0px; width:0px; color:' + cc.textSelect + '; background:' + cc.select + '; border:none; border-radius:0px;'); // cursor
5197
5249
 
5198
5250
  this.cursorId = 4 + this.lng;
5199
- this.c[this.cursorId] = this.dom('div', this.css.basic + 'top:4px; height:' + (this.h - 8) + 'px; width:0px; background:' + cc.text + ';');
5251
+ this.c[this.cursorId] = this.dom('div', this.css.basic + 'top:2px; height:' + (this.h - 4) + 'px; width:0px; background:' + cc.text + ';');
5200
5252
  this.init();
5201
5253
  }
5202
5254
 
@@ -5211,22 +5263,7 @@
5211
5263
  }
5212
5264
 
5213
5265
  return '';
5214
- }
5215
- /* mode: function ( n, name ) {
5216
- if( n === this.cMode[name] ) return false;
5217
- //let m;
5218
- /*switch(n){
5219
- case 0: m = this.colors.border; break;
5220
- case 1: m = this.colors.borderOver; break;
5221
- case 2: m = this.colors.borderSelect; break;
5222
- }*/
5223
-
5224
- /* this.reset();
5225
- //this.c[name+2].style.borderColor = m;
5226
- this.cMode[name] = n;
5227
- return true;
5228
- },*/
5229
- // ----------------------
5266
+ } // ----------------------
5230
5267
  // EVENTS
5231
5268
  // ----------------------
5232
5269
 
@@ -5252,18 +5289,11 @@
5252
5289
  }
5253
5290
 
5254
5291
  return false;
5255
- /*
5256
- if( name === '' ) return false;
5257
- this.current = name;
5258
- this.isDown = true;
5259
- this.prev = { x:e.clientX, y:e.clientY, d:0, v: this.isSingle ? parseFloat(this.value) : parseFloat( this.value[ this.current ] ) };
5260
- return this.mode( 2, name );*/
5261
5292
  }
5262
5293
 
5263
5294
  mouseup(e) {
5264
5295
  if (this.isDown) {
5265
- this.isDown = false; //this.current = -1;
5266
-
5296
+ this.isDown = false;
5267
5297
  this.prev = {
5268
5298
  x: 0,
5269
5299
  y: 0,
@@ -5274,20 +5304,6 @@
5274
5304
  }
5275
5305
 
5276
5306
  return false;
5277
- /*let name = this.testZone( e );
5278
- this.isDown = false;
5279
- if( this.current !== -1 ){
5280
- //let tm = this.current;
5281
- let td = this.prev.d;
5282
- this.current = -1;
5283
- this.prev = { x:0, y:0, d:0, v:0 };
5284
- if( !td ){
5285
- this.setInput( this.c[ 3 + name ] );
5286
- return true;//this.mode( 2, name );
5287
- } else {
5288
- return this.reset();//this.mode( 0, tm );
5289
- }
5290
- }*/
5291
5307
  }
5292
5308
 
5293
5309
  mousemove(e) {
@@ -5316,23 +5332,11 @@
5316
5332
  }
5317
5333
 
5318
5334
  return nup;
5319
- } //keydown: function ( e ) { return true; },
5320
- // ----------------------
5335
+ } // ----------------------
5321
5336
 
5322
5337
 
5323
5338
  reset() {
5324
- let nup = false; //this.isDown = false;
5325
- //this.current = 0;
5326
-
5327
- /* let i = this.lng;
5328
- while(i--){
5329
- if(this.cMode[i]!==0){
5330
- this.cMode[i] = 0;
5331
- //this.c[2+i].style.borderColor = this.colors.border;
5332
- nup = true;
5333
- }
5334
- }*/
5335
-
5339
+ let nup = false;
5336
5340
  return nup;
5337
5341
  }
5338
5342
 
@@ -5343,7 +5347,7 @@
5343
5347
  if (v.z !== undefined) this.value[2] = v.z;
5344
5348
  if (v.w !== undefined) this.value[3] = v.w;
5345
5349
  } else {
5346
- if (this.isSingle) this.value = [v];else this.value = v;
5350
+ this.value = this.isSingle ? [v] : v;
5347
5351
  }
5348
5352
 
5349
5353
  this.update();
@@ -5389,9 +5393,7 @@
5389
5393
  let s = this.s;
5390
5394
  let d = this.current !== -1 ? this.tmp[this.current][0] + 5 : 0;
5391
5395
  s[this.cursorId].width = '1px';
5392
- s[this.cursorId].left = d + c + 'px'; //s[2].left = ( d + e ) + 'px';
5393
- //s[2].width = w + 'px';
5394
-
5396
+ s[this.cursorId].left = d + c + 'px';
5395
5397
  s[this.selectId].left = d + e + 'px';
5396
5398
  s[this.selectId].width = w + 'px';
5397
5399
  this.c[this.selectId].innerHTML = t;
@@ -5424,7 +5426,7 @@
5424
5426
  }
5425
5427
 
5426
5428
  if (!force) return;
5427
- if (this.isSingle) this.send(ar[0]);else this.send(ar);
5429
+ this.send(this.isSingle ? ar[0] : ar);
5428
5430
  } // ----------------------
5429
5431
  // REZISE
5430
5432
  // ----------------------
@@ -5670,14 +5672,14 @@
5670
5672
  this.isDown = false;
5671
5673
  let cc = this.colors; // text
5672
5674
 
5673
- this.c[2] = this.dom('div', this.css.txtselect + 'height:' + (this.h - 4) + 'px; color:' + cc.text + '; background:' + cc.back + '; borderColor:' + cc.border + '; border-radius:' + this.radius + 'px;');
5675
+ this.c[2] = this.dom('div', this.css.txtselect + 'top:1px; height:' + (this.h - 2) + 'px; color:' + cc.text + '; background:' + cc.back + '; borderColor:' + cc.border + '; border-radius:' + this.radius + 'px;');
5674
5676
  this.c[2].textContent = this.value; // selection
5675
5677
 
5676
- this.c[3] = this.dom('div', this.css.txtselect + 'position:absolute; top:4px; height:' + (this.h - 8) + 'px; padding:0px 0px; width:0px; color:' + cc.textSelect + '; background:' + cc.select + '; border:none; border-radius:0px;'); // cursor
5678
+ this.c[3] = this.dom('div', this.css.txtselect + 'position:absolute; top:2px; height:' + (this.h - 4) + 'px; padding:0px 0px; width:0px; color:' + cc.textSelect + '; background:' + cc.select + '; border:none; border-radius:0px;'); // cursor
5677
5679
 
5678
- this.c[4] = this.dom('div', this.css.basic + 'top:4px; height:' + (this.h - 8) + 'px; width:0px; background:' + cc.text + ';'); // fake
5680
+ this.c[4] = this.dom('div', this.css.basic + 'top:2px; height:' + (this.h - 4) + 'px; width:0px; background:' + cc.text + ';'); // fake
5679
5681
 
5680
- this.c[5] = this.dom('div', this.css.txtselect + 'height:' + (this.h - 4) + 'px; justify-content: center; font-style: italic; color:' + cc.border + ';');
5682
+ this.c[5] = this.dom('div', this.css.txtselect + 'top:1px; height:' + (this.h - 2) + 'px; border:none; justify-content: center; font-style: italic; color:' + cc.border + ';');
5681
5683
  if (this.value === '') this.c[5].textContent = this.placeHolder;
5682
5684
  this.init();
5683
5685
  }
@@ -5881,8 +5883,7 @@
5881
5883
 
5882
5884
  mousemove(e) {
5883
5885
  let up = false;
5884
- let name = this.testZone(e); //let sel = false;
5885
- //console.log(name)
5886
+ let name = this.testZone(e);
5886
5887
 
5887
5888
  if (name === 'over') {
5888
5889
  this.cursor('pointer');
@@ -6044,8 +6045,7 @@
6044
6045
 
6045
6046
  mousemove(e) {
6046
6047
  let up = false;
6047
- let name = this.testZone(e); //let sel = false;
6048
- //console.log(name)
6048
+ let name = this.testZone(e);
6049
6049
 
6050
6050
  if (name === 'over') {
6051
6051
  this.cursor('pointer');
@@ -6078,7 +6078,7 @@
6078
6078
 
6079
6079
  if (this.img !== null) {
6080
6080
  if (this.objectLink !== null) this.objectLink[this.val] = v;
6081
- if (this.callback) this.callback(v, this.img, this.name);
6081
+ if (this.callback) this.callback(this.value, this.img, this.name);
6082
6082
  }
6083
6083
  }
6084
6084
 
@@ -6094,12 +6094,6 @@
6094
6094
  let cc = this.colors;
6095
6095
 
6096
6096
  if (this.stat !== n) {
6097
- /*if( n===1 ) this.isActif = false
6098
- if( n===3 ){
6099
- if( !this.isActif ){ this.isActif = true; n=4; this.onActif( this ); }
6100
- else { this.isActif = false; }
6101
- }
6102
- if( n===2 && this.isActif ) n = 4;*/
6103
6097
  this.stat = n;
6104
6098
 
6105
6099
  switch (n) {
@@ -6281,17 +6275,19 @@
6281
6275
  if (typeof this.values === 'string') this.values = [this.values];
6282
6276
  this.lng = this.values.length;
6283
6277
  this.value = o.value || null;
6278
+ let cc = this.colors;
6284
6279
  this.isSelectable = o.selectable || false;
6285
- this.spaces = o.spaces || [5, 3];
6286
- this.bsize = o.bsize || [90, 20];
6287
- if (o.h) this.bsize[1] = o.h;
6280
+ this.spaces = o.spaces || [cc.sx, cc.sy];
6281
+ this.bsize = o.bsize || [90, this.h];
6288
6282
  this.bsizeMax = this.bsize[0];
6289
6283
  this.tmp = [];
6290
6284
  this.stat = [];
6291
6285
  this.grid = [2, Math.round(this.lng * 0.5)];
6292
- this.h = this.grid[1] * (this.bsize[1] + this.spaces[1]) + this.spaces[1];
6293
- this.c[1].textContent = '';
6294
- this.c[2] = this.dom('table', this.css.basic + 'width:100%; top:' + (this.spaces[1] - 2) + 'px; height:auto; border-collapse:separate; border:none; border-spacing: ' + (this.spaces[0] - 2) + 'px ' + (this.spaces[1] - 2) + 'px;');
6286
+ this.h = this.grid[1] * this.bsize[1] + this.grid[1] * this.spaces[1]; //+ 4 - (this.mtop*2) //+ (this.spaces[1] - this.mtop);
6287
+
6288
+ this.c[1].textContent = ''; //this.c[2] = this.dom( 'table', this.css.basic + 'width:100%; top:'+(this.spaces[1]-2)+'px; height:auto; border-collapse:separate; border:none; border-spacing: '+(this.spaces[0]-2)+'px '+(this.spaces[1]-2)+'px;' );
6289
+
6290
+ this.c[2] = this.dom('table', this.css.basic + 'width:100%; border-spacing: ' + (this.spaces[0] - 2) + 'px ' + this.spaces[1] + 'px; border:none;');
6295
6291
  let n = 0,
6296
6292
  b,
6297
6293
  td,
@@ -6304,7 +6300,6 @@
6304
6300
  this.stat = [];
6305
6301
  this.tmpX = [];
6306
6302
  this.tmpY = [];
6307
- let cc = this.colors;
6308
6303
 
6309
6304
  for (let i = 0; i < this.grid[1]; i++) {
6310
6305
  tr = this.c[2].insertRow();
@@ -6318,7 +6313,7 @@
6318
6313
  sel = false;
6319
6314
  if (this.values[n] === this.value && this.isSelectable) sel = true;
6320
6315
  b = document.createElement('div');
6321
- b.style.cssText = this.css.txt + this.css.button + 'position:static; width:' + this.bsize[0] + 'px; height:' + this.bsize[1] + 'px; border:' + cc.borderSize + 'px solid ' + cc.border + '; left:auto; right:auto; border-radius:' + this.radius + 'px;';
6316
+ b.style.cssText = this.css.txt + this.css.button + 'position:static; top:1px; width:' + this.bsize[0] + 'px; height:' + (this.bsize[1] - 2) + 'px; border:' + cc.borderSize + 'px solid ' + cc.border + '; left:auto; right:auto; border-radius:' + this.radius + 'px;';
6322
6317
  b.style.background = sel ? cc.select : cc.button;
6323
6318
  b.style.color = sel ? cc.textSelect : cc.text;
6324
6319
  b.innerHTML = this.values[n];
@@ -6336,12 +6331,14 @@
6336
6331
  }
6337
6332
  }
6338
6333
 
6334
+ this.s[0].border = 'none';
6339
6335
  this.init();
6340
6336
  }
6341
6337
 
6342
6338
  testZone(e) {
6343
6339
  let l = this.local;
6344
6340
  if (l.x === -1 && l.y === -1) return -1;
6341
+ l.y += this.mtop;
6345
6342
  let tx = this.tmpX;
6346
6343
  let ty = this.tmpY;
6347
6344
  let id = -1;
@@ -6558,7 +6555,6 @@
6558
6555
 
6559
6556
  this.value = Array.isArray(o.value) && o.value.length == 2 ? o.value : [0, 0];
6560
6557
  this.h = o.h || this.w + 10;
6561
- this.top = 0;
6562
6558
  this.c[0].style.width = this.w + 'px'; // Title
6563
6559
 
6564
6560
  if (this.c[1] !== undefined) {
@@ -6567,7 +6563,8 @@
6567
6563
  this.c[1].style.justifyContent = 'center';
6568
6564
  this.top = 10;
6569
6565
  this.h += 10;
6570
- }
6566
+ } //this.top -= this.margin
6567
+
6571
6568
 
6572
6569
  let cc = this.colors; // Value
6573
6570
 
@@ -6618,7 +6615,7 @@
6618
6615
  mousemove(e) {
6619
6616
  if (!this.isDown) return;
6620
6617
  let x = this.w * 0.5 - (e.clientX - this.zone.x);
6621
- let y = this.diam * 0.5 - (e.clientY - this.zone.y - this.top);
6618
+ let y = this.diam * 0.5 - (e.clientY - this.zone.y - this.ytop);
6622
6619
  let r = 256 / this.diam;
6623
6620
  x = -(x * r);
6624
6621
  y = -(y * r);
@@ -6736,7 +6733,7 @@
6736
6733
  o = a[2];
6737
6734
  o.name = a[1];
6738
6735
 
6739
- if (type === 'list') {
6736
+ if (type === 'list' && !o.list) {
6740
6737
  o.list = a[0][a[1]];
6741
6738
  } else o.value = a[0][a[1]];
6742
6739
  }
@@ -6902,7 +6899,9 @@
6902
6899
  this.mouse = new V2().neg();
6903
6900
  this.h = 0; //this.prevY = -1;
6904
6901
 
6905
- this.sw = 0; // bottom and close height
6902
+ this.sw = 0;
6903
+ this.margin = this.colors.sy;
6904
+ this.marginDiv = Tools.isDivid(this.margin); // bottom and close height
6906
6905
 
6907
6906
  this.isWithClose = o.close !== undefined ? o.close : true;
6908
6907
  this.bh = !this.isWithClose ? 0 : this.size.h;
@@ -7325,7 +7324,7 @@
7325
7324
  while (i--) {
7326
7325
  if (this.uis[i].value === name) {
7327
7326
  this.uis[i].selected(true);
7328
- if (this.isScroll) this.update(i * (this.uis[i].h + 1) * this.ratio);
7327
+ if (this.isScroll) this.update(i * (this.uis[i].h + this.margin) * this.ratio);
7329
7328
  }
7330
7329
  }
7331
7330
  } // ----------------------
@@ -7423,11 +7422,8 @@
7423
7422
 
7424
7423
  }
7425
7424
 
7426
- const REVISION = '4.2.2';
7427
-
7428
7425
  exports.Files = Files;
7429
7426
  exports.Gui = Gui;
7430
- exports.Proto = Proto;
7431
7427
  exports.REVISION = REVISION;
7432
7428
  exports.Tools = Tools;
7433
7429
  exports.add = add;