lexgui 0.1.29 → 0.1.31

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/lexgui.css CHANGED
@@ -91,6 +91,11 @@ body.noevents * {
91
91
  display: none !important;
92
92
  }
93
93
 
94
+ .hiddenOpacity {
95
+ opacity: 0 !important;
96
+ pointer-events: none;
97
+ }
98
+
94
99
  ::-webkit-file-upload-button {
95
100
  display: none;
96
101
  }
@@ -102,9 +107,11 @@ body.noevents * {
102
107
  bottom: 0;
103
108
  width: 100%;
104
109
  height: 100%;
105
- background-color: rgba(0, 0, 0, 0.6);
110
+ background-color: rgba(0, 0, 0, 0.5);
106
111
  position: absolute;
107
112
  z-index: 99;
113
+ opacity: 1;
114
+ transition: opacity 0.2s ease-in;
108
115
  }
109
116
 
110
117
  #lexroot {
@@ -1295,7 +1302,7 @@ input[type="range"] {
1295
1302
  height: 12px;
1296
1303
  border: 1px solid #c9c7de;
1297
1304
  border-radius: 6px;
1298
- background: var(--global-selected-dark);
1305
+ background: var(--global-selected);
1299
1306
  box-shadow: 0px 0px 6px #111;
1300
1307
  cursor: pointer;
1301
1308
  }
@@ -1557,11 +1564,11 @@ input[type="range"] {
1557
1564
  margin-top: 2px;
1558
1565
  }
1559
1566
 
1560
- .lexprogressbar.editable:hover{
1567
+ .lexprogressbar.editable:hover {
1561
1568
  cursor: grab;
1562
1569
  }
1563
1570
 
1564
- .lexprogressbar.editable:active{
1571
+ .lexprogressbar.editable:active {
1565
1572
  cursor: grabbing;
1566
1573
  }
1567
1574
 
@@ -1573,10 +1580,10 @@ meter::-webkit-meter-bar {
1573
1580
 
1574
1581
  /* (optimum) */
1575
1582
  meter:-moz-meter-optimum::-moz-meter-bar {
1576
- background: var(--global-selected-light);
1583
+ background: var(--global-selected);
1577
1584
  }
1578
1585
  meter::-webkit-meter-optimum-value {
1579
- background: var(--global-selected-light);
1586
+ background: var(--global-selected);
1580
1587
  }
1581
1588
 
1582
1589
  /* (sub-optimum)*/
@@ -1730,7 +1737,7 @@ meter::-webkit-meter-even-less-good-value {
1730
1737
  }
1731
1738
 
1732
1739
  .lexcontextmenu .lexcontextmenuentry:hover {
1733
- background-color: var(--global-selected-dark);
1740
+ background-color: var(--global-selected);
1734
1741
  color: #f5f5f5;
1735
1742
  }
1736
1743
 
@@ -1902,7 +1909,7 @@ meter::-webkit-meter-even-less-good-value {
1902
1909
  }
1903
1910
 
1904
1911
  .lexcontextmenubox .lexcontextmenuentry:hover:not(.cmtitle) {
1905
- background-color: var(--global-selected-dark);
1912
+ background-color: var(--global-selected);
1906
1913
  color: #f5f5f5;
1907
1914
  }
1908
1915
 
@@ -1926,16 +1933,35 @@ meter::-webkit-meter-even-less-good-value {
1926
1933
  /* Side Bar */
1927
1934
 
1928
1935
  .lexsidebar {
1929
-
1936
+ text-align: center;
1930
1937
  }
1931
1938
 
1932
1939
  .lexsidebar .lexsidebarentry {
1933
1940
  width: 64px;
1934
1941
  height: 64px;
1935
- padding-left: 7.5px;
1936
1942
  margin-top: -6px;
1937
1943
  }
1938
1944
 
1945
+ .lexsidebar .lexsidebarentry .lexsidebarentrydesc {
1946
+ position: absolute;
1947
+ margin-left: 12px;
1948
+ font-weight: 600;
1949
+ margin-top: 13px;
1950
+ background-color: #afafaf;
1951
+ color: var(--global-color-primary);
1952
+ font-size: 16px;
1953
+ border-radius: 6px;
1954
+ text-align: center;
1955
+ opacity: 0;
1956
+ z-index: 102;
1957
+ padding: 2px 6px;
1958
+ transition: opacity ease-in 0.1s;
1959
+ }
1960
+
1961
+ .lexsidebar .lexsidebarentry button:hover + .lexsidebarentrydesc {
1962
+ opacity: 1;
1963
+ }
1964
+
1939
1965
  .lexsidebar .lexsidebarentry:first-child {
1940
1966
  padding-top: 16px;
1941
1967
  }
@@ -1949,6 +1975,7 @@ meter::-webkit-meter-even-less-good-value {
1949
1975
  border-radius: 10px;
1950
1976
  border: 0px solid var(--global-color-transparent);
1951
1977
  transition: border 0.1s ease-in-out;
1978
+ cursor: pointer;
1952
1979
  }
1953
1980
 
1954
1981
  .lexsidebar .lexsidebarentry button:hover {
@@ -2152,6 +2179,12 @@ meter::-webkit-meter-even-less-good-value {
2152
2179
  line-height: 16px;
2153
2180
  }
2154
2181
 
2182
+ .lexareatabs .lexareatab.thumb {
2183
+ position: absolute;
2184
+ background-color: var(--global-selected);
2185
+ z-index: 0;
2186
+ }
2187
+
2155
2188
  .lexareatabs.row {
2156
2189
  width: 100%;
2157
2190
  }
@@ -2170,31 +2203,35 @@ meter::-webkit-meter-even-less-good-value {
2170
2203
  }
2171
2204
 
2172
2205
  .lexareatabs.fit {
2173
- background-color: var(--global-color-secondary);
2174
2206
  width: calc(100% - 14px);
2175
2207
  }
2176
2208
 
2177
2209
  .lexareatabs.fit .lexareatab {
2178
2210
  flex: 100%;
2179
2211
  border-radius: 10px;
2212
+ z-index: 1;
2180
2213
  }
2181
2214
 
2182
2215
  .lexareatabs .lexareatab:active {
2183
2216
  color: #b7b7cba4;
2184
2217
  }
2185
2218
 
2219
+ .lexareatabs.fit .lexareatab.selected {
2220
+ color: #f8f8f8;
2221
+ }
2222
+
2186
2223
  .lexareatabs.row .lexareatab.selected {
2187
- color: var(--global-text);
2224
+ color: var(--global-text-primary);
2188
2225
  background-color: var(--global-selected);
2189
2226
  }
2190
2227
 
2191
- .lexareatabs.fit .lexareatab.selected, .lexareatabs.folding .lexareatab.selected {
2228
+ .lexareatabs.folding .lexareatab.selected {
2192
2229
  color: var(--global-text-primary);
2193
2230
  background-color: #555556;
2194
2231
  }
2195
2232
 
2196
2233
  .lexareatabs .lexareatab:hover {
2197
- color: white;
2234
+ color: #f8f8f8;
2198
2235
  }
2199
2236
 
2200
2237
  .lexareatabscontainer {
@@ -2233,33 +2270,36 @@ meter::-webkit-meter-even-less-good-value {
2233
2270
 
2234
2271
  .lexcard img {
2235
2272
  width: 100%;
2236
- height: 164px;
2273
+ height: 128px;
2237
2274
  object-fit: cover;
2238
2275
  border-radius: 6px;
2239
- outline: 3px solid var(--global-text-secondary);
2276
+ outline: 3px solid var(--global-text-terciary);
2240
2277
  }
2241
2278
 
2242
2279
  .lexcard:hover a {
2243
- color: var(--global-selected-light);
2280
+ color: var(--global-selected);
2244
2281
  }
2245
2282
 
2246
2283
  .lexcard:hover img {
2247
- outline: 3px solid var(--global-selected-light);
2284
+ outline: 3px solid var(--global-selected);
2248
2285
  }
2249
2286
 
2250
2287
  .lexcard span {
2251
- width: calc(100% - 12px);
2288
+ width: calc(100% - 18px);
2252
2289
  display: flex;
2253
- background-color: rgba(15, 16, 19, 0.9);
2290
+ background-color: rgba(15, 16, 19, 0.8);
2254
2291
  align-items: center;
2255
2292
  height: 16px;
2256
2293
  position: absolute;
2257
2294
  top: 0;
2258
- padding: 6px;
2295
+ left: 0;
2296
+ padding: 8px;
2259
2297
  border-top-left-radius: 6px;
2260
2298
  border-top-right-radius: 6px;
2261
2299
  font-weight: bold;
2262
- font-size: 1.2em;
2300
+ font-size: 1.3em;
2301
+ font-family: var(--global-title-font);
2302
+ text-transform: uppercase;
2263
2303
  }
2264
2304
 
2265
2305
  .lexcard span a {
@@ -2268,7 +2308,7 @@ meter::-webkit-meter-even-less-good-value {
2268
2308
  }
2269
2309
 
2270
2310
  .lexcard span a:hover {
2271
- color: var(--global-selected-light);
2311
+ color: var(--global-selected);
2272
2312
  }
2273
2313
 
2274
2314
  /* Layers Widget */
@@ -2914,7 +2954,7 @@ ul.lexassetscontent {
2914
2954
  }
2915
2955
 
2916
2956
  .lexcodeeditor .codetabsarea {
2917
- height: calc( 100% - 60px ) !important;
2957
+ height: calc( 100% - 72px ) !important;
2918
2958
  background-color: var(--global-branch-darker);
2919
2959
  overflow: scroll;
2920
2960
  }
@@ -3366,7 +3406,7 @@ pre .line-gutter {
3366
3406
  }
3367
3407
 
3368
3408
  .lexgraphnode.variables {
3369
- background: linear-gradient(15deg, #f1e643da 10%, #e78b8bda);
3409
+ background: linear-gradient(15deg, #f14343da 10%, #e7b88bda);
3370
3410
  background-color: unset; background-origin: border-box;
3371
3411
  }
3372
3412
 
@@ -3375,6 +3415,10 @@ pre .line-gutter {
3375
3415
  background-color: unset; background-origin: border-box;
3376
3416
  }
3377
3417
 
3418
+ .lexgraphnode.function {
3419
+ background: linear-gradient(15deg, #d19b06da 10%, #ff7b00da);
3420
+ background-color: unset; background-origin: border-box;
3421
+ }
3378
3422
 
3379
3423
  .lexgraphnode.selected {
3380
3424
  border: 3px solid var(--global-selected-dark);
@@ -3590,19 +3634,9 @@ pre .line-gutter {
3590
3634
  border-right: 2px solid #4b4b4ba8;
3591
3635
  }
3592
3636
 
3593
- /* .lexgraphnodeproperties .lexwidget .numberbox, .lexgraphnodeproperties .lexwidget .lextext {
3594
- margin: unset;
3595
- background-color: unset;
3596
- }
3597
-
3598
- .lexgraphnodeproperties .lexwidget.nobranch {
3599
- padding: 0px;
3600
- }
3601
-
3602
- .lexgraphnodeproperties .lexwidget input {
3603
- font-size: 14px;
3604
- font-weight: 800;
3605
- color: var(--global-color-primary);
3637
+ .grapharea .graph-title button {
3638
+ font-size: 16px;
3606
3639
  font-family: var(--global-title-font);
3607
- max-width: 64px;
3608
- } */
3640
+ font-weight: 600;
3641
+ color: var(--global-text);
3642
+ }
package/build/lexgui.js CHANGED
@@ -12,7 +12,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
12
12
  */
13
13
 
14
14
  var LX = global.LX = {
15
- version: "0.1.29",
15
+ version: "0.1.31",
16
16
  ready: false,
17
17
  components: [], // specific pre-build components
18
18
  signals: {} // events and triggers
@@ -421,33 +421,38 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
421
421
 
422
422
  /**
423
423
  * @method init
424
- * @param {*} options
424
+ * @param {Object} options
425
425
  * container: Root location for the gui (default is the document body)
426
+ * id: Id of the main area
426
427
  * skip_default_area: Skip creation of main area
427
428
  */
428
429
 
429
- function init(options = {})
430
+ function init( options = { } )
430
431
  {
431
- if(this.ready)
432
+ if( this.ready )
432
433
  return this.main_area;
433
434
 
434
- // LexGUI root
435
- var root = document.createElement("div");
436
- root.id = "lexroot";
435
+ // LexGUI root
436
+
437
+ var root = document.createElement( 'div' );
438
+ root.id = "lexroot";
437
439
  root.tabIndex = -1;
438
440
 
439
- var modal = document.createElement("div");
441
+ var modal = document.createElement( 'div' );
440
442
  modal.id = "modal";
441
443
 
442
444
  this.modal = modal;
443
445
  this.root = root;
444
446
  this.container = document.body;
445
447
 
446
- this.modal.toggleAttribute('hidden', true);
447
- this.modal.toggle = function(force) { this.toggleAttribute('hidden', force); };
448
+ // this.modal.toggleAttribute( 'hidden', true );
449
+ // this.modal.toggle = function( force ) { this.toggleAttribute( 'hidden', force ); };
448
450
 
449
- if(options.container)
450
- this.container = document.getElementById(options.container);
451
+ this.modal.classList.add( 'hiddenOpacity' );
452
+ this.modal.toggle = function( force ) { this.classList.toggle( 'hiddenOpacity', force ); };
453
+
454
+ if( options.container )
455
+ this.container = document.getElementById( options.container );
451
456
 
452
457
  this.global_search = create_global_searchbar( this.container );
453
458
 
@@ -455,17 +460,17 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
455
460
  this.container.appendChild( root );
456
461
 
457
462
  // Disable drag icon
458
- root.addEventListener("dragover", function(e) {
463
+ root.addEventListener( 'dragover', function( e ) {
459
464
  e.preventDefault();
460
465
  }, false );
461
466
 
462
467
  // CSS fontawesome
463
- var head = document.getElementsByTagName('HEAD')[0];
464
- var link = document.createElement('link');
468
+ var head = document.getElementsByTagName( 'HEAD' )[ 0 ];
469
+ var link = document.createElement( 'link' );
465
470
  link.rel = 'stylesheet';
466
471
  link.type = 'text/css';
467
- link.href = 'https://use.fontawesome.com/releases/v6.4.2/css/all.css';
468
- head.appendChild(link);
472
+ link.href = 'https://use.fontawesome.com/releases/v6.5.1/css/all.css';
473
+ head.appendChild( link );
469
474
 
470
475
  // Global vars
471
476
  this.DEFAULT_NAME_WIDTH = "30%";
@@ -473,10 +478,10 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
473
478
  this.OPEN_CONTEXTMENU_ENTRY = 'click';
474
479
 
475
480
  this.ready = true;
476
- this.menubars = [];
481
+ this.menubars = [ ];
477
482
 
478
- if(!options.skip_default_area)
479
- this.main_area = new Area( {id: options.id ?? "mainarea"} );
483
+ if( !options.skip_default_area )
484
+ this.main_area = new Area( { id: options.id ?? 'mainarea' } );
480
485
 
481
486
  return this.main_area;
482
487
  }
@@ -1307,7 +1312,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1307
1312
  selectable: b.selectable,
1308
1313
  selected: b.selected,
1309
1314
  icon: b.icon,
1310
- img: b.img
1315
+ img: b.img,
1316
+ className: b.class
1311
1317
  };
1312
1318
 
1313
1319
  if( group )
@@ -1517,7 +1523,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1517
1523
 
1518
1524
  let container = document.createElement('div');
1519
1525
  container.className = "lexareatabs " + (options.fit ? "fit" : "row");
1520
-
1526
+
1521
1527
  const folding = options.folding ?? false;
1522
1528
  if(folding) container.classList.add("folding");
1523
1529
 
@@ -1552,7 +1558,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1552
1558
 
1553
1559
  // Show on drop
1554
1560
  el.click();
1555
-
1561
+
1556
1562
  // Store info
1557
1563
  that.tabs[ el.dataset["name"] ] = content;
1558
1564
  });
@@ -1569,6 +1575,29 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1569
1575
  this.tabs = {};
1570
1576
  this.tabDOMs = {};
1571
1577
 
1578
+ if( options.fit )
1579
+ {
1580
+ // Create movable element
1581
+ let mEl = document.createElement('span');
1582
+ mEl.className = "lexareatab thumb";
1583
+ this.thumb = mEl;
1584
+ this.root.appendChild( mEl );
1585
+
1586
+ const resizeObserver = new ResizeObserver((entries) => {
1587
+ const tabEl = this.thumb.item;
1588
+ if( !tabEl ) return;
1589
+ var transition = this.thumb.style.transition;
1590
+ this.thumb.style.transition = "none";
1591
+ this.thumb.style.transform = "translate( " + ( tabEl.childIndex * tabEl.offsetWidth ) + "px )";
1592
+ this.thumb.style.width = ( tabEl.offsetWidth - 5 ) + "px";
1593
+ this.thumb.style.height = ( tabEl.offsetHeight - 6 ) + "px";
1594
+ flushCss( this.thumb );
1595
+ this.thumb.style.transition = transition;
1596
+ });
1597
+
1598
+ resizeObserver.observe( this.area.root );
1599
+ }
1600
+
1572
1601
  // debug
1573
1602
  if(folding)
1574
1603
  {
@@ -1666,6 +1695,14 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1666
1695
 
1667
1696
  if(options.onSelect)
1668
1697
  options.onSelect(e, tabEl.dataset.name);
1698
+
1699
+ if( this.thumb )
1700
+ {
1701
+ this.thumb.style.transform = "translate( " + ( tabEl.childIndex * tabEl.offsetWidth ) + "px )";
1702
+ this.thumb.style.width = ( tabEl.offsetWidth - 5 ) + "px";
1703
+ this.thumb.style.height = ( tabEl.offsetHeight - 6 ) + "px";
1704
+ this.thumb.item = tabEl;
1705
+ }
1669
1706
  });
1670
1707
 
1671
1708
  tabEl.addEventListener("contextmenu", e => {
@@ -1694,13 +1731,26 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1694
1731
  });
1695
1732
 
1696
1733
  // Attach content
1734
+ tabEl.childIndex = ( this.root.childElementCount - 1 );
1697
1735
  this.root.appendChild( tabEl );
1698
1736
  this.area.attach( contentEl );
1699
1737
  this.tabDOMs[ name ] = tabEl;
1700
1738
  this.tabs[ name ] = content;
1701
1739
 
1702
1740
  setTimeout( () => {
1703
- if( options.onCreate ) options.onCreate.call(this, this.area.root.getBoundingClientRect());
1741
+
1742
+ if( options.onCreate ) {
1743
+ options.onCreate.call(this, this.area.root.getBoundingClientRect());
1744
+ }
1745
+
1746
+ if( isSelected && this.thumb )
1747
+ {
1748
+ this.thumb.style.transform = "translate( " + ( tabEl.childIndex * tabEl.offsetWidth ) + "px )";
1749
+ this.thumb.style.width = ( tabEl.offsetWidth - 5 ) + "px";
1750
+ this.thumb.style.height = ( tabEl.offsetHeight - 6 ) + "px";
1751
+ this.thumb.item = tabEl;
1752
+ }
1753
+
1704
1754
  }, 10 );
1705
1755
  }
1706
1756
 
@@ -2195,6 +2245,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2195
2245
  * @param {*} options:
2196
2246
  * callback: Function to call on each item
2197
2247
  * bottom: Bool to set item at the bottom as helper button (not selectable)
2248
+ * className: Add class to the entry DOM element
2198
2249
  */
2199
2250
 
2200
2251
  add( key, options = {} ) {
@@ -2211,14 +2262,14 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2211
2262
  }
2212
2263
 
2213
2264
  let entry = document.createElement( 'div' );
2214
- entry.className = "lexsidebarentry";
2265
+ entry.className = "lexsidebarentry " + ( options.className ?? "" );
2215
2266
  entry.id = pKey;
2216
- entry.title = key;
2217
2267
 
2218
2268
  if( options.bottom )
2219
2269
  {
2220
2270
  this.footer.appendChild( entry );
2221
- }else
2271
+ }
2272
+ else
2222
2273
  {
2223
2274
  this.root.appendChild( entry );
2224
2275
  }
@@ -2230,6 +2281,11 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2230
2281
  button.innerHTML = "<i class='"+ (options.icon ?? "") + "'></i>";
2231
2282
  entry.appendChild( button );
2232
2283
 
2284
+ let desc = document.createElement( 'span' );
2285
+ desc.className = 'lexsidebarentrydesc';
2286
+ desc.innerHTML = key;
2287
+ entry.appendChild( desc );
2288
+
2233
2289
  entry.addEventListener("click", () => {
2234
2290
 
2235
2291
  const f = options.callback;
@@ -2245,6 +2301,23 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2245
2301
 
2246
2302
  this.items.push( { name: pKey, domEl: entry, callback: options.callback } );
2247
2303
  }
2304
+
2305
+ /**
2306
+ * @method select
2307
+ * @param {String} name Element name to select
2308
+ */
2309
+
2310
+ select( name ) {
2311
+
2312
+ let pKey = name.replace( /\s/g, '' ).replaceAll( '.', '' );
2313
+
2314
+ const entry = this.items.find( v => v.name === pKey );
2315
+
2316
+ if( !entry )
2317
+ return;
2318
+
2319
+ entry.domEl.click();
2320
+ }
2248
2321
  };
2249
2322
 
2250
2323
  LX.SideBar = SideBar;
@@ -3137,7 +3210,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
3137
3210
 
3138
3211
  if( type != Widget.TITLE )
3139
3212
  {
3140
- element.style.width = "calc(100% - " + (this.current_branch || type == Widget.FILE ? 10 : 20) + "px)";
3213
+ element.style.width = "calc(100% - " + (this.current_branch || type == Widget.FILE || ( type == Widget.BUTTON && !name ) ? 10 : 20) + "px)";
3141
3214
  if( options.width ) {
3142
3215
  element.style.width = element.style.minWidth = options.width;
3143
3216
  }
@@ -4397,7 +4470,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
4397
4470
  buttonName = "Add item";
4398
4471
  buttonName += "<a class='fa-solid fa-plus' style='float:right; margin-right: 3px; margin-top: 2px;'></a>";
4399
4472
  this.addButton(null, buttonName, (v, event) => {
4400
- values.push( "" );
4473
+ values.push( options.innerValues ? options.innerValues[ 0 ] : "" );
4401
4474
  updateItems();
4402
4475
  this._trigger( new IEvent(name, values, event), callback );
4403
4476
  }, { buttonClass: 'array' });
@@ -4843,6 +4916,13 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
4843
4916
  vecinput.step = options.step ?? "any";
4844
4917
  vecinput.type = "number";
4845
4918
  vecinput.id = "number_"+simple_guidGenerator();
4919
+
4920
+ if( value.constructor == Number )
4921
+ {
4922
+ value = clamp(value, +vecinput.min, +vecinput.max);
4923
+ value = options.precision ? round(value, options.precision) : value;
4924
+ }
4925
+
4846
4926
  vecinput.value = vecinput.iValue = value;
4847
4927
  box.appendChild(vecinput);
4848
4928
 
@@ -4969,6 +5049,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
4969
5049
  }
4970
5050
 
4971
5051
  let widget = this.create_widget(name, Widget.VECTOR, options);
5052
+
4972
5053
  widget.onGetValue = () => {
4973
5054
  let inputs = element.querySelectorAll("input");
4974
5055
  let value = [];
@@ -5021,6 +5102,13 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5021
5102
  vecinput.type = "number";
5022
5103
  vecinput.id = "vec"+num_components+"_"+simple_guidGenerator();
5023
5104
  vecinput.idx = i;
5105
+
5106
+ if( value[i].constructor == Number )
5107
+ {
5108
+ value[i] = clamp(value[i], +vecinput.min, +vecinput.max);
5109
+ value[i] = options.precision ? round(value[i], options.precision) : value[i];
5110
+ }
5111
+
5024
5112
  vecinput.value = vecinput.iValue = value[i];
5025
5113
 
5026
5114
  let drag_icon = document.createElement('a');
@@ -5054,13 +5142,18 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5054
5142
  }, {passive:false});
5055
5143
 
5056
5144
  vecinput.addEventListener("change", e => {
5057
- if(isNaN(e.target.value))
5145
+
5146
+ if( isNaN( e.target.value ) )
5058
5147
  return;
5059
- let val = e.target.value = clamp(e.target.value, vecinput.min, vecinput.max);
5060
-
5148
+
5149
+ console.log(e.target.value);
5150
+ let val = e.target.value = clamp(e.target.value, +vecinput.min, +vecinput.max);
5151
+ val = options.precision ? round(val, options.precision) : val;
5152
+ console.log(val);
5153
+
5061
5154
  // Reset button (default value)
5062
- let btn = element.querySelector(".lexwidgetname .lexicon");
5063
- if(btn) btn.style.display = val != vecinput.iValue ? "block": "none";
5155
+ let btn = element.querySelector( ".lexwidgetname .lexicon" );
5156
+ if( btn ) btn.style.display = val != vecinput.iValue ? "block": "none";
5064
5157
 
5065
5158
  if( lock_icon.locked )
5066
5159
  {
@@ -5069,6 +5162,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5069
5162
  value[v.idx] = val;
5070
5163
  }
5071
5164
  } else {
5165
+ vecinput.value = val;
5072
5166
  value[e.target.idx] = val;
5073
5167
  }
5074
5168
 
@@ -5271,6 +5365,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5271
5365
  * @param {Function} callback Callback function on change
5272
5366
  * @param {*} options:
5273
5367
  * local: Ask for local file
5368
+ * read: Return the file itself (False) or the contents (True)
5274
5369
  * type: type to read as [text (Default), buffer, bin, url]
5275
5370
  */
5276
5371
 
@@ -7553,6 +7648,13 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
7553
7648
  compareThresholdRange( v0, v1, t0, t1 ) { return v0 >= t0 && v0 <= t1 || v1 >= t0 && v1 <= t1 || v0 <= t0 && v1 >= t1},
7554
7649
  clamp (num, min, max) { return Math.min(Math.max(num, min), max) },
7555
7650
  uidGenerator: simple_guidGenerator,
7651
+ deleteElement( el ) { if( el ) el.remove(); },
7652
+ flushCss(element) {
7653
+ // By reading the offsetHeight property, we are forcing
7654
+ // the browser to flush the pending CSS changes (which it
7655
+ // does to ensure the value obtained is accurate).
7656
+ element.offsetHeight;
7657
+ },
7556
7658
  getControlPoints( x0, y0, x1, y1, x2, y2 ,t ) {
7557
7659
 
7558
7660
  // x0,y0,x1,y1 are the coordinates of the end (knot) pts of this segment