lexgui 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -15
- package/build/components/audio.js +179 -0
- package/build/components/timeline.js +2761 -3119
- package/build/components/videoeditor.js +10 -2
- package/build/lexgui.css +83 -2
- package/build/lexgui.js +111 -55
- package/build/lexgui.module.js +112 -53
- package/changelog.md +11 -1
- package/demo.js +3 -1
- package/examples/timeline.html +33 -21
- package/package.json +1 -1
|
@@ -491,6 +491,7 @@ class VideoEditor {
|
|
|
491
491
|
await new Promise(r => setTimeout(r, 1000));
|
|
492
492
|
this.video.currentTime = 10000000 * Math.random();
|
|
493
493
|
}
|
|
494
|
+
this.video.currentTime = -1; // BUG: some videos will not play unless this line is present
|
|
494
495
|
this.video.currentTime = 0;
|
|
495
496
|
this.endTime = this.video.duration;
|
|
496
497
|
this.timebar.currentX = this._timeToX(0);
|
|
@@ -498,7 +499,10 @@ class VideoEditor {
|
|
|
498
499
|
this._setStartValue(this.timebar.startX);
|
|
499
500
|
this._setCurrentValue(this.timebar.currentX);
|
|
500
501
|
this.timebar.update(this.timebar.currentX);
|
|
501
|
-
|
|
502
|
+
|
|
503
|
+
if ( !this.requestId ){ // only have one update on flight
|
|
504
|
+
this._update();
|
|
505
|
+
}
|
|
502
506
|
this.controls = options.controls ?? true;
|
|
503
507
|
if(!this.controls) {
|
|
504
508
|
this.hideControls();
|
|
@@ -615,12 +619,16 @@ class VideoEditor {
|
|
|
615
619
|
this.controlsArea.hide();
|
|
616
620
|
}
|
|
617
621
|
|
|
618
|
-
|
|
622
|
+
stopUpdates(){
|
|
623
|
+
|
|
619
624
|
if(this.requestId) {
|
|
620
625
|
cancelAnimationFrame(this.requestId);
|
|
621
626
|
this.requestId = null;
|
|
622
627
|
}
|
|
628
|
+
}
|
|
623
629
|
|
|
630
|
+
delete ( ) {
|
|
631
|
+
this.stopUpdates();
|
|
624
632
|
delete this;
|
|
625
633
|
}
|
|
626
634
|
}
|
package/build/lexgui.css
CHANGED
|
@@ -776,6 +776,7 @@ body.noevents * {
|
|
|
776
776
|
margin-top: 0.3em;
|
|
777
777
|
margin-right: 0.7em;
|
|
778
778
|
color: var(--global-selected-light);
|
|
779
|
+
font-size: 11px;
|
|
779
780
|
}
|
|
780
781
|
|
|
781
782
|
.lextitle.link {
|
|
@@ -1282,6 +1283,17 @@ input[type=number] {
|
|
|
1282
1283
|
border: 2px solid var(--global-selected);
|
|
1283
1284
|
}
|
|
1284
1285
|
|
|
1286
|
+
.lexwidget .numberbox span {
|
|
1287
|
+
position: absolute;
|
|
1288
|
+
top: -2px;
|
|
1289
|
+
pointer-events: none;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
.lexinputmeasure {
|
|
1293
|
+
font-family: var(--global-font);
|
|
1294
|
+
font-size: var(--global-font-size);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1285
1297
|
.lexinputslider {
|
|
1286
1298
|
appearance: none;
|
|
1287
1299
|
-moz-appearance: none;
|
|
@@ -2090,7 +2102,7 @@ meter::-webkit-meter-even-less-good-value {
|
|
|
2090
2102
|
}
|
|
2091
2103
|
|
|
2092
2104
|
.lexoverlaybuttons .lexbutton {
|
|
2093
|
-
padding:
|
|
2105
|
+
padding: 16px 12px;
|
|
2094
2106
|
font-size: var(--global-font-size-big);
|
|
2095
2107
|
border-radius: 10px;
|
|
2096
2108
|
justify-content: center;
|
|
@@ -2146,7 +2158,6 @@ meter::-webkit-meter-even-less-good-value {
|
|
|
2146
2158
|
background: none;
|
|
2147
2159
|
-webkit-backdrop-filter: none;
|
|
2148
2160
|
backdrop-filter: none;
|
|
2149
|
-
aspect-ratio: 1;
|
|
2150
2161
|
}
|
|
2151
2162
|
|
|
2152
2163
|
.lexoverlaybuttons.vertical .lexoverlaygroup {
|
|
@@ -2502,6 +2513,76 @@ meter::-webkit-meter-even-less-good-value {
|
|
|
2502
2513
|
width: 95%;
|
|
2503
2514
|
}
|
|
2504
2515
|
|
|
2516
|
+
/* Knob Widget */
|
|
2517
|
+
|
|
2518
|
+
.lexknob {
|
|
2519
|
+
padding: 8px;
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
.lexknob .knobcircle {
|
|
2523
|
+
background: rgb(62,62,62);
|
|
2524
|
+
background: linear-gradient(180deg, rgba(82,82,82,1) 0%, rgba(40,40,40,1) 100%);
|
|
2525
|
+
width: 64px;
|
|
2526
|
+
height: 64px;
|
|
2527
|
+
margin: 0 auto;
|
|
2528
|
+
border-radius: 50%;
|
|
2529
|
+
position: relative;
|
|
2530
|
+
box-shadow: 0px 3px 9px 2px #121212a9;
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
.lexknob.sm .knobcircle {
|
|
2534
|
+
width: 48px;
|
|
2535
|
+
height: 48px;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
.lexknob.bg .knobcircle {
|
|
2539
|
+
width: 81px;
|
|
2540
|
+
height: 81px;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
.lexknob .innerknobcircle {
|
|
2544
|
+
background-color:rgba(62,62,62,1);
|
|
2545
|
+
width: 56px;
|
|
2546
|
+
height: 56px;
|
|
2547
|
+
border-radius: 50%;
|
|
2548
|
+
margin: 0;
|
|
2549
|
+
position: absolute;
|
|
2550
|
+
top: 50%;
|
|
2551
|
+
left: 50%;
|
|
2552
|
+
translate: -50% -50%;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
.lexknob.sm .innerknobcircle {
|
|
2556
|
+
width: 39px;
|
|
2557
|
+
height: 39px;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
.lexknob.bg .innerknobcircle {
|
|
2561
|
+
width: 73px;
|
|
2562
|
+
height: 73px;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
.lexknob .knobmarker {
|
|
2566
|
+
background-color: var(--global-selected);
|
|
2567
|
+
filter: brightness(1.5);
|
|
2568
|
+
width: 6px;
|
|
2569
|
+
height: 6px;
|
|
2570
|
+
border-radius: 50%;
|
|
2571
|
+
margin: 0 auto;
|
|
2572
|
+
margin-top: 6px;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
.lexknob.sm .knobmarker {
|
|
2576
|
+
width: 5px;
|
|
2577
|
+
height: 5px;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
.lexknob.bg .knobmarker {
|
|
2581
|
+
width: 7px;
|
|
2582
|
+
height: 7px;
|
|
2583
|
+
margin-top: 8px;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2505
2586
|
/** Timeline */
|
|
2506
2587
|
|
|
2507
2588
|
.lextimeline {
|
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.
|
|
15
|
+
version: "0.1.37",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // specific pre-build components
|
|
18
18
|
signals: {} // events and triggers
|
|
@@ -29,7 +29,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
29
29
|
LX.CURVE_MOVEOUT_DELETE = 1;
|
|
30
30
|
|
|
31
31
|
function clamp( num, min, max ) { return Math.min( Math.max( num, min ), max ); }
|
|
32
|
-
function round(
|
|
32
|
+
function round( number, precision ) { return +(( number ).toFixed( precision ?? 2 ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' )); }
|
|
33
33
|
|
|
34
34
|
function getSupportedDOMName( string )
|
|
35
35
|
{
|
|
@@ -113,6 +113,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
113
113
|
return (S4()+"-"+S4()+"-"+S4());
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
LX.guidGenerator = simple_guidGenerator;
|
|
117
|
+
|
|
116
118
|
// Timer that works everywhere (from litegraph.js)
|
|
117
119
|
if (typeof performance != "undefined") {
|
|
118
120
|
LX.getTime = performance.now.bind(performance);
|
|
@@ -304,11 +306,18 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
304
306
|
else
|
|
305
307
|
{
|
|
306
308
|
for( let c of LX.components )
|
|
307
|
-
|
|
309
|
+
{
|
|
310
|
+
if( !LX[c] || !LX[c].prototype.onKeyPressed )
|
|
311
|
+
{
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const instances = LX.CodeEditor.getInstances();
|
|
316
|
+
for( let i of instances )
|
|
308
317
|
{
|
|
309
|
-
|
|
310
|
-
for( let i of instances ) i.onKeyPressed( e );
|
|
318
|
+
i.onKeyPressed( e );
|
|
311
319
|
}
|
|
320
|
+
}
|
|
312
321
|
}
|
|
313
322
|
});
|
|
314
323
|
|
|
@@ -634,6 +643,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
634
643
|
}
|
|
635
644
|
};
|
|
636
645
|
|
|
646
|
+
LX.IEvent = IEvent;
|
|
647
|
+
|
|
637
648
|
class TreeEvent {
|
|
638
649
|
|
|
639
650
|
static NONE = 0;
|
|
@@ -2451,6 +2462,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
2451
2462
|
static CONTENT = 20;
|
|
2452
2463
|
static CUSTOM = 21;
|
|
2453
2464
|
static SEPARATOR = 22;
|
|
2465
|
+
static KNOB = 23;
|
|
2454
2466
|
|
|
2455
2467
|
static NO_CONTEXT_TYPES = [
|
|
2456
2468
|
Widget.BUTTON,
|
|
@@ -2459,7 +2471,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
2459
2471
|
Widget.PROGRESS
|
|
2460
2472
|
];
|
|
2461
2473
|
|
|
2462
|
-
constructor(name, type, options) {
|
|
2474
|
+
constructor( name, type, options ) {
|
|
2463
2475
|
this.name = name;
|
|
2464
2476
|
this.type = type;
|
|
2465
2477
|
this.options = options;
|
|
@@ -2467,10 +2479,12 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
2467
2479
|
|
|
2468
2480
|
value() {
|
|
2469
2481
|
|
|
2470
|
-
if(this.onGetValue)
|
|
2482
|
+
if( this.onGetValue )
|
|
2483
|
+
{
|
|
2471
2484
|
return this.onGetValue();
|
|
2485
|
+
}
|
|
2472
2486
|
|
|
2473
|
-
console.warn("Can't get value of " + this.typeName());
|
|
2487
|
+
console.warn( "Can't get value of " + this.typeName() );
|
|
2474
2488
|
}
|
|
2475
2489
|
|
|
2476
2490
|
set( value, skipCallback = false ) {
|
|
@@ -2530,6 +2544,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
2530
2544
|
case Widget.LIST: return "List";
|
|
2531
2545
|
case Widget.TAGS: return "Tags";
|
|
2532
2546
|
case Widget.CURVE: return "Curve";
|
|
2547
|
+
case Widget.KNOB: return "Knob";
|
|
2533
2548
|
case Widget.CUSTOM: return this.customName;
|
|
2534
2549
|
}
|
|
2535
2550
|
}
|
|
@@ -4843,7 +4858,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
4843
4858
|
flag.className = "checkbox " + (flag.value ? "on" : "");
|
|
4844
4859
|
flag.id = "checkbox"+simple_guidGenerator();
|
|
4845
4860
|
flag.innerHTML = "<a class='fa-solid fa-check' style='display: " + (flag.value ? "block" : "none") + "'></a>";
|
|
4846
|
-
|
|
4861
|
+
|
|
4847
4862
|
if( options.disabled ) {
|
|
4848
4863
|
flag.disabled = true;
|
|
4849
4864
|
toggle.className += " disabled";
|
|
@@ -5011,6 +5026,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5011
5026
|
* precision: The number of digits to appear after the decimal point
|
|
5012
5027
|
* min, max: Min and Max values for the input
|
|
5013
5028
|
* skipSlider: If there are min and max values, skip the slider
|
|
5029
|
+
* units: Unit as string added to the end of the value
|
|
5014
5030
|
*/
|
|
5015
5031
|
|
|
5016
5032
|
addNumber( name, value, callback, options = {} ) {
|
|
@@ -5021,7 +5037,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5021
5037
|
return +vecinput.value;
|
|
5022
5038
|
};
|
|
5023
5039
|
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
5024
|
-
vecinput.value = newValue;
|
|
5040
|
+
vecinput.value = round( newValue, options.precision );
|
|
5025
5041
|
Panel._dispatch_event( vecinput, "change", skipCallback );
|
|
5026
5042
|
};
|
|
5027
5043
|
|
|
@@ -5046,27 +5062,48 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5046
5062
|
box.className = "numberbox";
|
|
5047
5063
|
|
|
5048
5064
|
let vecinput = document.createElement( 'input' );
|
|
5065
|
+
vecinput.id = "number_" + simple_guidGenerator();
|
|
5049
5066
|
vecinput.className = "vecinput";
|
|
5050
5067
|
vecinput.min = options.min ?? -1e24;
|
|
5051
5068
|
vecinput.max = options.max ?? 1e24;
|
|
5052
5069
|
vecinput.step = options.step ?? "any";
|
|
5053
5070
|
vecinput.type = "number";
|
|
5054
|
-
vecinput.id = "number_" + simple_guidGenerator();
|
|
5055
5071
|
|
|
5056
5072
|
if( value.constructor == Number )
|
|
5057
5073
|
{
|
|
5058
5074
|
value = clamp( value, +vecinput.min, +vecinput.max );
|
|
5059
|
-
value =
|
|
5075
|
+
value = round( value, options.precision );
|
|
5060
5076
|
}
|
|
5061
5077
|
|
|
5062
5078
|
vecinput.value = vecinput.iValue = value;
|
|
5063
5079
|
box.appendChild( vecinput );
|
|
5064
5080
|
|
|
5065
|
-
let
|
|
5066
|
-
|
|
5067
|
-
|
|
5081
|
+
let measureRealWidth = function( value, paddingPlusMargin = 8 ) {
|
|
5082
|
+
var i = document.createElement( "span" );
|
|
5083
|
+
i.className = "lexinputmeasure";
|
|
5084
|
+
i.innerHTML = value;
|
|
5085
|
+
document.body.appendChild( i );
|
|
5086
|
+
var rect = i.getBoundingClientRect();
|
|
5087
|
+
LX.UTILS.deleteElement( i );
|
|
5088
|
+
return rect.width + paddingPlusMargin;
|
|
5089
|
+
}
|
|
5068
5090
|
|
|
5069
|
-
if( options.
|
|
5091
|
+
if( options.units )
|
|
5092
|
+
{
|
|
5093
|
+
let unitSpan = document.createElement( 'span' );
|
|
5094
|
+
unitSpan.className = "lexunit";
|
|
5095
|
+
unitSpan.innerText = options.units;
|
|
5096
|
+
unitSpan.style.left = measureRealWidth( vecinput.value ) + "px";
|
|
5097
|
+
vecinput.unitSpan = unitSpan;
|
|
5098
|
+
box.appendChild( unitSpan );
|
|
5099
|
+
}
|
|
5100
|
+
|
|
5101
|
+
let dragIcon = document.createElement( 'a' );
|
|
5102
|
+
dragIcon.className = "fa-solid fa-arrows-up-down drag-icon hidden";
|
|
5103
|
+
box.appendChild( dragIcon );
|
|
5104
|
+
|
|
5105
|
+
if( options.disabled )
|
|
5106
|
+
{
|
|
5070
5107
|
vecinput.disabled = true;
|
|
5071
5108
|
}
|
|
5072
5109
|
|
|
@@ -5081,7 +5118,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5081
5118
|
slider.value = value;
|
|
5082
5119
|
slider.addEventListener( "input", function( e ) {
|
|
5083
5120
|
let new_value = +this.valueAsNumber;
|
|
5084
|
-
vecinput.value = (
|
|
5121
|
+
vecinput.value = round( new_value, options.precision );
|
|
5085
5122
|
Panel._dispatch_event( vecinput, "change" );
|
|
5086
5123
|
}, false );
|
|
5087
5124
|
box.appendChild( slider );
|
|
@@ -5097,7 +5134,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5097
5134
|
if( e.shiftKey ) mult *= 10;
|
|
5098
5135
|
else if( e.altKey ) mult *= 0.1;
|
|
5099
5136
|
let new_value = ( +this.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ) );
|
|
5100
|
-
this.value = (
|
|
5137
|
+
this.value = round( new_value, options.precision );
|
|
5101
5138
|
Panel._dispatch_event(vecinput, "change");
|
|
5102
5139
|
}, { passive: false });
|
|
5103
5140
|
|
|
@@ -5110,12 +5147,20 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5110
5147
|
|
|
5111
5148
|
let val = e.target.value = clamp( +e.target.valueAsNumber, +vecinput.min, +vecinput.max );
|
|
5112
5149
|
val = options.precision ? round( val, options.precision ) : val;
|
|
5113
|
-
|
|
5150
|
+
|
|
5151
|
+
// Update slider!
|
|
5114
5152
|
if( box.querySelector( ".lexinputslider" ) )
|
|
5153
|
+
{
|
|
5115
5154
|
box.querySelector( ".lexinputslider" ).value = val;
|
|
5155
|
+
}
|
|
5116
5156
|
|
|
5117
5157
|
vecinput.value = val;
|
|
5118
5158
|
|
|
5159
|
+
if( options.units )
|
|
5160
|
+
{
|
|
5161
|
+
vecinput.unitSpan.style.left = measureRealWidth( vecinput.value ) + "px";
|
|
5162
|
+
}
|
|
5163
|
+
|
|
5119
5164
|
// Reset button (default value)
|
|
5120
5165
|
if( !skipCallback )
|
|
5121
5166
|
{
|
|
@@ -5140,7 +5185,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5140
5185
|
lastY = e.pageY;
|
|
5141
5186
|
document.body.classList.add('nocursor');
|
|
5142
5187
|
document.body.classList.add('noevents');
|
|
5143
|
-
|
|
5188
|
+
dragIcon.classList.remove('hidden');
|
|
5144
5189
|
e.stopImmediatePropagation();
|
|
5145
5190
|
e.stopPropagation();
|
|
5146
5191
|
}
|
|
@@ -5152,8 +5197,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5152
5197
|
if(e.shiftKey) mult *= 10;
|
|
5153
5198
|
else if(e.altKey) mult *= 0.1;
|
|
5154
5199
|
let new_value = (+vecinput.valueAsNumber + mult * dt);
|
|
5155
|
-
vecinput.value = (+new_value).toFixed(4).replace(/([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/,'$1');
|
|
5156
|
-
Panel._dispatch_event(vecinput, "change");
|
|
5200
|
+
vecinput.value = (+new_value).toFixed( 4 ).replace(/([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/,'$1');
|
|
5201
|
+
Panel._dispatch_event( vecinput, "change" );
|
|
5157
5202
|
}
|
|
5158
5203
|
|
|
5159
5204
|
lastY = e.pageY;
|
|
@@ -5167,7 +5212,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5167
5212
|
doc.removeEventListener("mouseup",inner_mouseup);
|
|
5168
5213
|
document.body.classList.remove('nocursor');
|
|
5169
5214
|
document.body.classList.remove('noevents');
|
|
5170
|
-
|
|
5215
|
+
dragIcon.classList.add('hidden');
|
|
5171
5216
|
}
|
|
5172
5217
|
|
|
5173
5218
|
container.appendChild(box);
|
|
@@ -5204,9 +5249,15 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5204
5249
|
};
|
|
5205
5250
|
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
5206
5251
|
const inputs = element.querySelectorAll( ".vecinput" );
|
|
5252
|
+
if( inputs.length == newValue.length )
|
|
5253
|
+
{
|
|
5254
|
+
console.error( "Input length does not match vector length." );
|
|
5255
|
+
return;
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5207
5258
|
for( var i = 0; i < inputs.length; ++i ) {
|
|
5208
5259
|
let value = newValue[ i ];
|
|
5209
|
-
inputs[ i ].value = value ?? 0;
|
|
5260
|
+
inputs[ i ].value = round( value, options.precision ) ?? 0;
|
|
5210
5261
|
Panel._dispatch_event( inputs[ i ], "change", skipCallback );
|
|
5211
5262
|
}
|
|
5212
5263
|
};
|
|
@@ -5246,14 +5297,14 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5246
5297
|
if( value[ i ].constructor == Number )
|
|
5247
5298
|
{
|
|
5248
5299
|
value[ i ] = clamp(value[ i ], +vecinput.min, +vecinput.max);
|
|
5249
|
-
value[ i ] =
|
|
5300
|
+
value[ i ] = round( value[ i ], options.precision );
|
|
5250
5301
|
}
|
|
5251
5302
|
|
|
5252
5303
|
vecinput.value = vecinput.iValue = value[ i ];
|
|
5253
5304
|
|
|
5254
|
-
let
|
|
5255
|
-
|
|
5256
|
-
box.appendChild(
|
|
5305
|
+
let dragIcon = document.createElement( 'a' );
|
|
5306
|
+
dragIcon.className = "fa-solid fa-arrows-up-down drag-icon hidden";
|
|
5307
|
+
box.appendChild( dragIcon );
|
|
5257
5308
|
|
|
5258
5309
|
if( options.disabled ) {
|
|
5259
5310
|
vecinput.disabled = true;
|
|
@@ -5269,14 +5320,17 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5269
5320
|
if( e.shiftKey ) mult = 10;
|
|
5270
5321
|
else if( e.altKey ) mult = 0.1;
|
|
5271
5322
|
|
|
5272
|
-
if(
|
|
5323
|
+
if( locker.locked )
|
|
5273
5324
|
{
|
|
5274
|
-
for( let v of element.querySelectorAll(".vecinput") )
|
|
5275
|
-
|
|
5325
|
+
for( let v of element.querySelectorAll(".vecinput") )
|
|
5326
|
+
{
|
|
5327
|
+
v.value = round( +v.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ), options.precision );
|
|
5276
5328
|
Panel._dispatch_event(v, "change");
|
|
5277
5329
|
}
|
|
5278
|
-
}
|
|
5279
|
-
|
|
5330
|
+
}
|
|
5331
|
+
else
|
|
5332
|
+
{
|
|
5333
|
+
this.value = round( +this.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ), options.precision );
|
|
5280
5334
|
Panel._dispatch_event( vecinput, "change" );
|
|
5281
5335
|
}
|
|
5282
5336
|
}, { passive: false } );
|
|
@@ -5289,7 +5343,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5289
5343
|
const skipCallback = e.detail;
|
|
5290
5344
|
|
|
5291
5345
|
let val = e.target.value = clamp( e.target.value, +vecinput.min, +vecinput.max );
|
|
5292
|
-
val =
|
|
5346
|
+
val = round( val, options.precision );
|
|
5293
5347
|
|
|
5294
5348
|
// Reset button (default value)
|
|
5295
5349
|
if( !skipCallback )
|
|
@@ -5298,7 +5352,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5298
5352
|
if( btn ) btn.style.display = val != vecinput.iValue ? "block": "none";
|
|
5299
5353
|
}
|
|
5300
5354
|
|
|
5301
|
-
if(
|
|
5355
|
+
if( locker.locked )
|
|
5302
5356
|
{
|
|
5303
5357
|
for( let v of element.querySelectorAll( ".vecinput" ) ) {
|
|
5304
5358
|
v.value = val;
|
|
@@ -5326,7 +5380,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5326
5380
|
lastY = e.pageY;
|
|
5327
5381
|
document.body.classList.add('nocursor');
|
|
5328
5382
|
document.body.classList.add('noevents');
|
|
5329
|
-
|
|
5383
|
+
dragIcon.classList.remove('hidden');
|
|
5330
5384
|
e.stopImmediatePropagation();
|
|
5331
5385
|
e.stopPropagation();
|
|
5332
5386
|
}
|
|
@@ -5338,14 +5392,14 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5338
5392
|
if(e.shiftKey) mult = 10;
|
|
5339
5393
|
else if(e.altKey) mult = 0.1;
|
|
5340
5394
|
|
|
5341
|
-
if(
|
|
5395
|
+
if( locker.locked )
|
|
5342
5396
|
{
|
|
5343
5397
|
for( let v of element.querySelectorAll(".vecinput") ) {
|
|
5344
|
-
v.value = (+v.valueAsNumber + mult * dt
|
|
5398
|
+
v.value = round( +v.valueAsNumber + mult * dt, options.precision );
|
|
5345
5399
|
Panel._dispatch_event(v, "change");
|
|
5346
5400
|
}
|
|
5347
5401
|
} else {
|
|
5348
|
-
vecinput.value = (+vecinput.valueAsNumber + mult * dt
|
|
5402
|
+
vecinput.value = round( +vecinput.valueAsNumber + mult * dt, options.precision );
|
|
5349
5403
|
Panel._dispatch_event(vecinput, "change");
|
|
5350
5404
|
}
|
|
5351
5405
|
}
|
|
@@ -5355,23 +5409,23 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5355
5409
|
e.preventDefault();
|
|
5356
5410
|
}
|
|
5357
5411
|
|
|
5358
|
-
function inner_mouseup(e) {
|
|
5412
|
+
function inner_mouseup( e ) {
|
|
5359
5413
|
var doc = that.root.ownerDocument;
|
|
5360
5414
|
doc.removeEventListener("mousemove",inner_mousemove);
|
|
5361
5415
|
doc.removeEventListener("mouseup",inner_mouseup);
|
|
5362
5416
|
document.body.classList.remove('nocursor');
|
|
5363
5417
|
document.body.classList.remove('noevents');
|
|
5364
|
-
|
|
5418
|
+
dragIcon.classList.add('hidden');
|
|
5365
5419
|
}
|
|
5366
|
-
|
|
5367
|
-
box.appendChild(vecinput);
|
|
5368
|
-
container.appendChild(box);
|
|
5420
|
+
|
|
5421
|
+
box.appendChild( vecinput );
|
|
5422
|
+
container.appendChild( box );
|
|
5369
5423
|
}
|
|
5370
5424
|
|
|
5371
|
-
let
|
|
5372
|
-
|
|
5373
|
-
container.appendChild(
|
|
5374
|
-
|
|
5425
|
+
let locker = document.createElement('a');
|
|
5426
|
+
locker.className = "fa-solid fa-lock-open lexicon";
|
|
5427
|
+
container.appendChild(locker);
|
|
5428
|
+
locker.addEventListener("click", function(e) {
|
|
5375
5429
|
this.locked = !this.locked;
|
|
5376
5430
|
if(this.locked){
|
|
5377
5431
|
this.classList.add("fa-lock");
|
|
@@ -5382,7 +5436,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
5382
5436
|
}
|
|
5383
5437
|
}, false);
|
|
5384
5438
|
|
|
5385
|
-
element.appendChild(container);
|
|
5439
|
+
element.appendChild( container );
|
|
5386
5440
|
|
|
5387
5441
|
return widget;
|
|
5388
5442
|
}
|
|
@@ -6302,7 +6356,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
6302
6356
|
this.items = [];
|
|
6303
6357
|
this.colors = {};
|
|
6304
6358
|
|
|
6305
|
-
if(title)
|
|
6359
|
+
if( title )
|
|
6360
|
+
{
|
|
6306
6361
|
const item = {};
|
|
6307
6362
|
item[ title ] = [];
|
|
6308
6363
|
item[ 'className' ] = "cmtitle";
|
|
@@ -6317,7 +6372,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
6317
6372
|
|
|
6318
6373
|
if(!useAbsolute)
|
|
6319
6374
|
{
|
|
6320
|
-
let width = rect.width
|
|
6375
|
+
let width = rect.width;
|
|
6321
6376
|
if(window.innerWidth - rect.right < 0)
|
|
6322
6377
|
div.style.left = (window.innerWidth - width - margin) + "px";
|
|
6323
6378
|
|
|
@@ -6358,7 +6413,6 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
6358
6413
|
contextmenu.style.marginTop = 3.5 - c.offsetHeight + "px";
|
|
6359
6414
|
|
|
6360
6415
|
// Set final width
|
|
6361
|
-
// contextmenu.style.width = contextmenu.offsetWidth + "px";
|
|
6362
6416
|
this._adjust_position( contextmenu, 6, true );
|
|
6363
6417
|
}
|
|
6364
6418
|
|
|
@@ -6432,7 +6486,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
6432
6486
|
}
|
|
6433
6487
|
|
|
6434
6488
|
onCreate() {
|
|
6435
|
-
this._adjust_position( this.root, 6 );
|
|
6489
|
+
doAsync( () => this._adjust_position( this.root, 6 ) );
|
|
6436
6490
|
}
|
|
6437
6491
|
|
|
6438
6492
|
add( path, options = {} ) {
|
|
@@ -6537,10 +6591,12 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
6537
6591
|
function addContextMenu( title, event, callback, options )
|
|
6538
6592
|
{
|
|
6539
6593
|
var menu = new ContextMenu( event, title, options );
|
|
6540
|
-
LX.root.appendChild(menu.root);
|
|
6594
|
+
LX.root.appendChild( menu.root );
|
|
6541
6595
|
|
|
6542
|
-
if(callback)
|
|
6596
|
+
if( callback )
|
|
6597
|
+
{
|
|
6543
6598
|
callback( menu );
|
|
6599
|
+
}
|
|
6544
6600
|
|
|
6545
6601
|
menu.onCreate();
|
|
6546
6602
|
|