lexgui 0.1.31 → 0.1.32
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/components/timeline.js +768 -442
- package/build/components/videoeditor.js +539 -0
- package/build/lexgui.css +87 -3
- package/build/lexgui.js +272 -254
- package/build/lexgui.module.js +247 -229
- package/changelog.md +11 -0
- package/examples/index.html +2 -1
- package/examples/timeline.html +279 -0
- package/examples/video_editor.html +35 -0
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
var LX = {
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.32",
|
|
12
12
|
ready: false,
|
|
13
13
|
components: [], // specific pre-build components
|
|
14
14
|
signals: {} // events and triggers
|
|
@@ -2369,10 +2369,10 @@ class Widget {
|
|
|
2369
2369
|
console.warn("Can't get value of " + this.typeName());
|
|
2370
2370
|
}
|
|
2371
2371
|
|
|
2372
|
-
set( value ) {
|
|
2372
|
+
set( value, skipCallback = false ) {
|
|
2373
2373
|
|
|
2374
2374
|
if( this.onSetValue )
|
|
2375
|
-
return this.onSetValue( value );
|
|
2375
|
+
return this.onSetValue( value, skipCallback );
|
|
2376
2376
|
|
|
2377
2377
|
console.warn("Can't set value of " + this.typeName());
|
|
2378
2378
|
}
|
|
@@ -2450,11 +2450,11 @@ function ADD_CUSTOM_WIDGET( custom_widget_name, options = {} )
|
|
|
2450
2450
|
widget.onGetValue = () => {
|
|
2451
2451
|
return instance;
|
|
2452
2452
|
};
|
|
2453
|
-
widget.onSetValue = (
|
|
2454
|
-
instance =
|
|
2453
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
2454
|
+
instance = newValue;
|
|
2455
2455
|
refresh_widget();
|
|
2456
|
-
element.querySelector(".lexcustomitems").toggleAttribute('hidden', false);
|
|
2457
|
-
this._trigger( new IEvent(name, instance, null), callback );
|
|
2456
|
+
element.querySelector( ".lexcustomitems" ).toggleAttribute( 'hidden', false );
|
|
2457
|
+
if( !skipCallback ) this._trigger( new IEvent( name, instance, null ), callback );
|
|
2458
2458
|
};
|
|
2459
2459
|
|
|
2460
2460
|
let element = widget.domEl;
|
|
@@ -2607,7 +2607,7 @@ class NodeTree {
|
|
|
2607
2607
|
node.visible = node.visible ?? true;
|
|
2608
2608
|
node.parent = parent;
|
|
2609
2609
|
let is_parent = node.children.length > 0;
|
|
2610
|
-
let is_selected = this.selected.indexOf( node ) > -1;
|
|
2610
|
+
let is_selected = this.selected.indexOf( node ) > -1 || node.selected;
|
|
2611
2611
|
|
|
2612
2612
|
if( this.options.only_folders ) {
|
|
2613
2613
|
let has_folders = false;
|
|
@@ -3172,8 +3172,8 @@ class Panel {
|
|
|
3172
3172
|
return (typeof arg == 'undefined' ? def : arg);
|
|
3173
3173
|
}
|
|
3174
3174
|
|
|
3175
|
-
static _dispatch_event( element, type, bubbles, cancelable ) {
|
|
3176
|
-
let event = new
|
|
3175
|
+
static _dispatch_event( element, type, data, bubbles, cancelable ) {
|
|
3176
|
+
let event = new CustomEvent(type, { 'detail': data, 'bubbles': bubbles, 'cancelable': cancelable });
|
|
3177
3177
|
element.dispatchEvent(event);
|
|
3178
3178
|
}
|
|
3179
3179
|
|
|
@@ -3406,11 +3406,12 @@ class Panel {
|
|
|
3406
3406
|
}
|
|
3407
3407
|
|
|
3408
3408
|
_trigger( event, callback ) {
|
|
3409
|
-
if(callback)
|
|
3410
|
-
callback.call(this, event.value, event.domEvent, event.name);
|
|
3411
3409
|
|
|
3412
|
-
if(
|
|
3413
|
-
|
|
3410
|
+
if( callback )
|
|
3411
|
+
callback.call( this, event.value, event.domEvent, event.name );
|
|
3412
|
+
|
|
3413
|
+
if( this.onevent )
|
|
3414
|
+
this.onevent.call( this, event );
|
|
3414
3415
|
}
|
|
3415
3416
|
|
|
3416
3417
|
/**
|
|
@@ -3538,12 +3539,13 @@ class Panel {
|
|
|
3538
3539
|
addText( name, value, callback, options = {} ) {
|
|
3539
3540
|
|
|
3540
3541
|
let widget = this.create_widget( name, Widget.TEXT, options );
|
|
3542
|
+
|
|
3541
3543
|
widget.onGetValue = () => {
|
|
3542
3544
|
return wValue.value;
|
|
3543
3545
|
};
|
|
3544
|
-
widget.onSetValue = newValue => {
|
|
3546
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
3545
3547
|
this.disabled ? wValue.innerText = newValue : wValue.value = newValue;
|
|
3546
|
-
Panel._dispatch_event( wValue, "focusout" );
|
|
3548
|
+
Panel._dispatch_event( wValue, "focusout", skipCallback );
|
|
3547
3549
|
};
|
|
3548
3550
|
|
|
3549
3551
|
let element = widget.domEl;
|
|
@@ -3579,9 +3581,10 @@ class Panel {
|
|
|
3579
3581
|
wValue.setAttribute( "placeholder", options.placeholder );
|
|
3580
3582
|
|
|
3581
3583
|
var resolve = ( function( val, event ) {
|
|
3584
|
+
const skipCallback = event.detail;
|
|
3582
3585
|
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
3583
3586
|
if( btn ) btn.style.display = ( val != wValue.iValue ? "block" : "none" );
|
|
3584
|
-
this._trigger( new IEvent( name, val, event ), callback );
|
|
3587
|
+
if( !skipCallback ) this._trigger( new IEvent( name, val, event ), callback );
|
|
3585
3588
|
}).bind( this );
|
|
3586
3589
|
|
|
3587
3590
|
const trigger = options.trigger ?? 'default';
|
|
@@ -3658,45 +3661,48 @@ class Panel {
|
|
|
3658
3661
|
|
|
3659
3662
|
addTextArea( name, value, callback, options = {} ) {
|
|
3660
3663
|
|
|
3661
|
-
let widget = this.create_widget(name, Widget.TEXTAREA, options);
|
|
3664
|
+
let widget = this.create_widget( name, Widget.TEXTAREA, options );
|
|
3665
|
+
|
|
3662
3666
|
widget.onGetValue = () => {
|
|
3663
3667
|
return wValue.value;
|
|
3664
3668
|
};
|
|
3665
|
-
widget.onSetValue = (
|
|
3666
|
-
wValue.value =
|
|
3667
|
-
Panel._dispatch_event(wValue, "focusout");
|
|
3669
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
3670
|
+
wValue.value = newValue;
|
|
3671
|
+
Panel._dispatch_event( wValue, "focusout", skipCallback );
|
|
3668
3672
|
};
|
|
3673
|
+
|
|
3669
3674
|
let element = widget.domEl;
|
|
3670
3675
|
|
|
3671
3676
|
// Add reset functionality
|
|
3672
|
-
if(widget.name && !(options.skipReset ?? false)) {
|
|
3673
|
-
Panel._add_reset_property(element.domName, function() {
|
|
3677
|
+
if( widget.name && !( options.skipReset ?? false ) ) {
|
|
3678
|
+
Panel._add_reset_property( element.domName, function() {
|
|
3674
3679
|
wValue.value = wValue.iValue;
|
|
3675
3680
|
this.style.display = "none";
|
|
3676
|
-
Panel._dispatch_event(wValue, "focusout");
|
|
3681
|
+
Panel._dispatch_event( wValue, "focusout" );
|
|
3677
3682
|
});
|
|
3678
3683
|
}
|
|
3679
3684
|
|
|
3680
3685
|
// Add widget value
|
|
3681
3686
|
|
|
3682
|
-
let container = document.createElement('div');
|
|
3687
|
+
let container = document.createElement( 'div' );
|
|
3683
3688
|
container.className = "lextextarea";
|
|
3684
3689
|
container.style.width = options.inputWidth || "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + " )";
|
|
3685
3690
|
container.style.height = options.height;
|
|
3686
3691
|
container.style.display = "flex";
|
|
3687
3692
|
|
|
3688
|
-
let wValue = document.createElement('textarea');
|
|
3693
|
+
let wValue = document.createElement( 'textarea' );
|
|
3689
3694
|
wValue.value = wValue.iValue = value || "";
|
|
3690
3695
|
wValue.style.width = "100%";
|
|
3691
|
-
Object.assign(wValue.style, options.style ?? {});
|
|
3696
|
+
Object.assign( wValue.style, options.style ?? {} );
|
|
3692
3697
|
|
|
3693
|
-
if(options.disabled ?? false) wValue.setAttribute("disabled", true);
|
|
3694
|
-
if(options.placeholder) wValue.setAttribute("placeholder", options.placeholder);
|
|
3698
|
+
if( options.disabled ?? false ) wValue.setAttribute("disabled", true);
|
|
3699
|
+
if( options.placeholder ) wValue.setAttribute("placeholder", options.placeholder);
|
|
3695
3700
|
|
|
3696
|
-
var resolve = (function(val, event) {
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3701
|
+
var resolve = (function( val, event ) {
|
|
3702
|
+
const skipCallback = event.detail;
|
|
3703
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
3704
|
+
if( btn ) btn.style.display = ( val != wValue.iValue ? "block" : "none" );
|
|
3705
|
+
if( !skipCallback ) this._trigger( new IEvent( name, val, event ), callback );
|
|
3700
3706
|
}).bind(this);
|
|
3701
3707
|
|
|
3702
3708
|
const trigger = options.trigger ?? 'default';
|
|
@@ -3773,10 +3779,10 @@ class Panel {
|
|
|
3773
3779
|
widget.onGetValue = () => {
|
|
3774
3780
|
return wValue.innerText;
|
|
3775
3781
|
};
|
|
3776
|
-
widget.onSetValue = (
|
|
3782
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
3777
3783
|
wValue.innerHTML =
|
|
3778
3784
|
(options.icon ? "<a class='" + options.icon + "'></a>" :
|
|
3779
|
-
( options.img ? "<img src='" + options.img + "'>" : "<span>" + (
|
|
3785
|
+
( options.img ? "<img src='" + options.img + "'>" : "<span>" + (newValue || "") + "</span>" ));
|
|
3780
3786
|
};
|
|
3781
3787
|
|
|
3782
3788
|
let element = widget.domEl;
|
|
@@ -3794,10 +3800,10 @@ class Panel {
|
|
|
3794
3800
|
( options.img ? "<img src='" + options.img + "'>" : "<span>" + (value || "") + "</span>" ));
|
|
3795
3801
|
|
|
3796
3802
|
wValue.style.width = "calc( 100% - " + (options.nameWidth ?? LX.DEFAULT_NAME_WIDTH) + ")";
|
|
3797
|
-
|
|
3803
|
+
|
|
3798
3804
|
if(options.disabled)
|
|
3799
3805
|
wValue.setAttribute("disabled", true);
|
|
3800
|
-
|
|
3806
|
+
|
|
3801
3807
|
wValue.addEventListener("click", e => {
|
|
3802
3808
|
if( options.selectable ) {
|
|
3803
3809
|
if( options.parent )
|
|
@@ -3808,7 +3814,7 @@ class Panel {
|
|
|
3808
3814
|
});
|
|
3809
3815
|
|
|
3810
3816
|
element.appendChild(wValue);
|
|
3811
|
-
|
|
3817
|
+
|
|
3812
3818
|
// Remove branch padding and margins
|
|
3813
3819
|
if(!widget.name) {
|
|
3814
3820
|
wValue.className += " noname";
|
|
@@ -4015,12 +4021,12 @@ class Panel {
|
|
|
4015
4021
|
widget.onGetValue = () => {
|
|
4016
4022
|
return element.querySelector("li.selected").getAttribute('value');
|
|
4017
4023
|
};
|
|
4018
|
-
widget.onSetValue = (
|
|
4024
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4019
4025
|
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4020
|
-
if(btn) btn.style.display = (
|
|
4021
|
-
value =
|
|
4026
|
+
if(btn) btn.style.display = (newValue != wValue.iValue ? "block" : "none");
|
|
4027
|
+
value = newValue;
|
|
4022
4028
|
list.querySelectorAll('li').forEach( e => { if( e.getAttribute('value') == value ) e.click() } );
|
|
4023
|
-
this._trigger( new IEvent(name, value, null), callback );
|
|
4029
|
+
if( !skipCallback ) this._trigger( new IEvent(name, value, null), callback );
|
|
4024
4030
|
};
|
|
4025
4031
|
|
|
4026
4032
|
let element = widget.domEl;
|
|
@@ -4216,12 +4222,12 @@ class Panel {
|
|
|
4216
4222
|
widget.onGetValue = () => {
|
|
4217
4223
|
return JSON.parse(JSON.stringify(curve_instance.element.value));
|
|
4218
4224
|
};
|
|
4219
|
-
widget.onSetValue = (
|
|
4225
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4220
4226
|
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4221
|
-
if(btn) btn.style.display = (
|
|
4222
|
-
curve_instance.element.value = JSON.parse(JSON.stringify(
|
|
4227
|
+
if(btn) btn.style.display = (newValue != curve_instance.element.value ? "block" : "none");
|
|
4228
|
+
curve_instance.element.value = JSON.parse(JSON.stringify(newValue));
|
|
4223
4229
|
curve_instance.redraw();
|
|
4224
|
-
that._trigger( new IEvent(name, curve_instance.element.value, null), callback );
|
|
4230
|
+
if( !skipCallback ) that._trigger( new IEvent(name, curve_instance.element.value, null), callback );
|
|
4225
4231
|
};
|
|
4226
4232
|
|
|
4227
4233
|
let element = widget.domEl;
|
|
@@ -4281,12 +4287,12 @@ class Panel {
|
|
|
4281
4287
|
widget.onGetValue = () => {
|
|
4282
4288
|
return element.value;
|
|
4283
4289
|
};
|
|
4284
|
-
widget.onSetValue = (
|
|
4290
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4285
4291
|
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4286
|
-
if(btn) btn.style.display = (
|
|
4287
|
-
value = element.value =
|
|
4292
|
+
if(btn) btn.style.display = (newValue != defaultValue ? "block" : "none");
|
|
4293
|
+
value = element.value = newValue;
|
|
4288
4294
|
setLayers();
|
|
4289
|
-
that._trigger( new IEvent(name, value), callback );
|
|
4295
|
+
if( !skipCallback ) that._trigger( new IEvent(name, value), callback );
|
|
4290
4296
|
};
|
|
4291
4297
|
|
|
4292
4298
|
let element = widget.domEl;
|
|
@@ -4378,11 +4384,12 @@ class Panel {
|
|
|
4378
4384
|
values.push( v.value );
|
|
4379
4385
|
return values;
|
|
4380
4386
|
};
|
|
4381
|
-
widget.onSetValue = (
|
|
4382
|
-
values =
|
|
4387
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4388
|
+
values = newValue;
|
|
4383
4389
|
updateItems();
|
|
4384
|
-
this._trigger( new IEvent(name, values, null), callback );
|
|
4390
|
+
if( !skipCallback ) this._trigger( new IEvent(name, values, null), callback );
|
|
4385
4391
|
};
|
|
4392
|
+
|
|
4386
4393
|
let element = widget.domEl;
|
|
4387
4394
|
element.style.flexWrap = "wrap";
|
|
4388
4395
|
|
|
@@ -4496,14 +4503,13 @@ class Panel {
|
|
|
4496
4503
|
widget.onGetValue = () => {
|
|
4497
4504
|
return value;
|
|
4498
4505
|
};
|
|
4499
|
-
|
|
4500
|
-
widget.onSetValue = ( newValue ) => {
|
|
4506
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4501
4507
|
listContainer.querySelectorAll( '.lexlistitem' ).forEach( e => e.classList.remove( 'selected' ) );
|
|
4502
4508
|
const idx = values.indexOf( newValue );
|
|
4503
4509
|
if( idx == -1 ) return;
|
|
4504
4510
|
listContainer.children[ idx ].classList.toggle( 'selected' );
|
|
4505
4511
|
value = newValue;
|
|
4506
|
-
this._trigger( new IEvent( name, newValue ), callback );
|
|
4512
|
+
if( !skipCallback ) this._trigger( new IEvent( name, newValue ), callback );
|
|
4507
4513
|
};
|
|
4508
4514
|
|
|
4509
4515
|
widget.updateValues = ( newValues ) => {
|
|
@@ -4568,18 +4574,19 @@ class Panel {
|
|
|
4568
4574
|
|
|
4569
4575
|
addTags( name, value, callback, options = {} ) {
|
|
4570
4576
|
|
|
4571
|
-
value = value.replace(/\s/g, '').split(',');
|
|
4572
|
-
let defaultValue = [].concat(value);
|
|
4573
|
-
let widget = this.create_widget(name, Widget.TAGS, options);
|
|
4577
|
+
value = value.replace( /\s/g, '' ).split( ',' );
|
|
4578
|
+
let defaultValue = [].concat( value );
|
|
4579
|
+
let widget = this.create_widget( name, Widget.TAGS, options );
|
|
4580
|
+
|
|
4574
4581
|
widget.onGetValue = () => {
|
|
4575
|
-
return [].concat(value);
|
|
4582
|
+
return [].concat( value );
|
|
4576
4583
|
};
|
|
4577
|
-
widget.onSetValue = (
|
|
4578
|
-
value = [].concat(
|
|
4584
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4585
|
+
value = [].concat( newValue );
|
|
4579
4586
|
create_tags();
|
|
4580
|
-
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4581
|
-
if(btn) btn.style.display = (
|
|
4582
|
-
that._trigger( new IEvent(name, value), callback );
|
|
4587
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4588
|
+
if( btn ) btn.style.display = ( newValue != defaultValue ? "block" : "none" );
|
|
4589
|
+
if( !skipCallback ) that._trigger( new IEvent( name, value ), callback );
|
|
4583
4590
|
};
|
|
4584
4591
|
|
|
4585
4592
|
let element = widget.domEl;
|
|
@@ -4613,33 +4620,33 @@ class Panel {
|
|
|
4613
4620
|
tag.className = "lextag";
|
|
4614
4621
|
tag.innerHTML = tag_name;
|
|
4615
4622
|
|
|
4616
|
-
tag.addEventListener('click', function(e) {
|
|
4623
|
+
tag.addEventListener('click', function( e ) {
|
|
4617
4624
|
this.remove();
|
|
4618
4625
|
value.splice( value.indexOf( tag_name ), 1 );
|
|
4619
|
-
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4620
|
-
if(btn) btn.style.display = (value != defaultValue ? "block" : "none");
|
|
4621
|
-
that._trigger( new IEvent(name, value, e), callback );
|
|
4626
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4627
|
+
if( btn ) btn.style.display = ( value != defaultValue ? "block" : "none" );
|
|
4628
|
+
that._trigger( new IEvent( name, value, e ), callback );
|
|
4622
4629
|
});
|
|
4623
4630
|
|
|
4624
|
-
tags_container.appendChild(tag);
|
|
4631
|
+
tags_container.appendChild( tag );
|
|
4625
4632
|
}
|
|
4626
4633
|
|
|
4627
|
-
let tag_input = document.createElement('input');
|
|
4634
|
+
let tag_input = document.createElement( 'input' );
|
|
4628
4635
|
tag_input.value = "";
|
|
4629
4636
|
tag_input.placeholder = "Tag...";
|
|
4630
|
-
tags_container.insertChildAtIndex(tag_input, 0);
|
|
4637
|
+
tags_container.insertChildAtIndex( tag_input, 0 );
|
|
4631
4638
|
|
|
4632
|
-
tag_input.onkeydown = function(e) {
|
|
4639
|
+
tag_input.onkeydown = function( e ) {
|
|
4633
4640
|
const val = this.value.replace(/\s/g, '');
|
|
4634
4641
|
if( e.key == ' ') {
|
|
4635
4642
|
e.preventDefault();
|
|
4636
4643
|
if( !val.length || value.indexOf( val ) > -1 )
|
|
4637
4644
|
return;
|
|
4638
|
-
value.push(val);
|
|
4645
|
+
value.push( val );
|
|
4639
4646
|
create_tags();
|
|
4640
|
-
let btn = element.querySelector(".lexwidgetname .lexicon");
|
|
4647
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4641
4648
|
if(btn) btn.style.display = "block";
|
|
4642
|
-
that._trigger( new IEvent(name, value, e), callback );
|
|
4649
|
+
that._trigger( new IEvent( name, value, e ), callback );
|
|
4643
4650
|
}
|
|
4644
4651
|
};
|
|
4645
4652
|
|
|
@@ -4671,24 +4678,25 @@ class Panel {
|
|
|
4671
4678
|
|
|
4672
4679
|
addCheckbox( name, value, callback, options = {} ) {
|
|
4673
4680
|
|
|
4674
|
-
if(!name) {
|
|
4675
|
-
throw("Set Widget Name!");
|
|
4681
|
+
if( !name ) {
|
|
4682
|
+
throw( "Set Widget Name!" );
|
|
4676
4683
|
}
|
|
4677
4684
|
|
|
4678
|
-
let widget = this.create_widget(name, Widget.CHECKBOX, options);
|
|
4685
|
+
let widget = this.create_widget( name, Widget.CHECKBOX, options );
|
|
4686
|
+
|
|
4679
4687
|
widget.onGetValue = () => {
|
|
4680
4688
|
return flag.value;
|
|
4681
4689
|
};
|
|
4682
|
-
widget.onSetValue = (
|
|
4683
|
-
if(flag.value !==
|
|
4684
|
-
Panel._dispatch_event(toggle, "click");
|
|
4690
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4691
|
+
if( flag.value !== newValue )
|
|
4692
|
+
Panel._dispatch_event( toggle, "click", skipCallback );
|
|
4685
4693
|
};
|
|
4686
4694
|
|
|
4687
4695
|
let element = widget.domEl;
|
|
4688
4696
|
|
|
4689
4697
|
// Add reset functionality
|
|
4690
|
-
Panel._add_reset_property(element.domName, function() {
|
|
4691
|
-
Panel._dispatch_event(toggle, "click");
|
|
4698
|
+
Panel._add_reset_property( element.domName, function() {
|
|
4699
|
+
Panel._dispatch_event( toggle, "click" );
|
|
4692
4700
|
});
|
|
4693
4701
|
|
|
4694
4702
|
// Add widget value
|
|
@@ -4719,30 +4727,35 @@ class Panel {
|
|
|
4719
4727
|
container.appendChild(toggle);
|
|
4720
4728
|
container.appendChild(value_name);
|
|
4721
4729
|
|
|
4722
|
-
toggle.addEventListener("click",
|
|
4730
|
+
toggle.addEventListener( "click" , e => {
|
|
4723
4731
|
|
|
4724
|
-
let flag = toggle.querySelector(".checkbox");
|
|
4725
|
-
if(flag.disabled)
|
|
4726
|
-
|
|
4732
|
+
let flag = toggle.querySelector( ".checkbox" );
|
|
4733
|
+
if( flag.disabled )
|
|
4734
|
+
return;
|
|
4735
|
+
|
|
4736
|
+
const skipCallback = e.detail;
|
|
4727
4737
|
|
|
4728
|
-
let check = toggle.querySelector(".checkbox a");
|
|
4738
|
+
let check = toggle.querySelector( ".checkbox a" );
|
|
4729
4739
|
|
|
4730
4740
|
flag.value = !flag.value;
|
|
4731
|
-
flag.className = "checkbox " + (flag.value ? "on" : "");
|
|
4741
|
+
flag.className = "checkbox " + ( flag.value ? "on" : "" );
|
|
4732
4742
|
check.style.display = flag.value ? "block" : "none";
|
|
4733
4743
|
|
|
4734
4744
|
// Reset button (default value)
|
|
4735
|
-
|
|
4736
|
-
|
|
4745
|
+
if( !skipCallback )
|
|
4746
|
+
{
|
|
4747
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4748
|
+
if( btn ) btn.style.display = flag.value != flag.iValue ? "block": "none";
|
|
4749
|
+
}
|
|
4737
4750
|
|
|
4738
4751
|
// Open suboptions
|
|
4739
|
-
let submenu = element.querySelector(".lexcheckboxsubmenu");
|
|
4740
|
-
if(submenu) submenu.toggleAttribute('hidden', !flag.value);
|
|
4752
|
+
let submenu = element.querySelector( ".lexcheckboxsubmenu" );
|
|
4753
|
+
if( submenu ) submenu.toggleAttribute( 'hidden', !flag.value );
|
|
4741
4754
|
|
|
4742
|
-
this._trigger( new IEvent(name, flag.value, e), callback );
|
|
4755
|
+
if( !skipCallback ) this._trigger( new IEvent( name, flag.value, e ), callback );
|
|
4743
4756
|
});
|
|
4744
4757
|
|
|
4745
|
-
element.appendChild(container);
|
|
4758
|
+
element.appendChild( container );
|
|
4746
4759
|
|
|
4747
4760
|
if( options.suboptions )
|
|
4748
4761
|
{
|
|
@@ -4773,70 +4786,75 @@ class Panel {
|
|
|
4773
4786
|
|
|
4774
4787
|
addColor( name, value, callback, options = {} ) {
|
|
4775
4788
|
|
|
4776
|
-
if(!name) {
|
|
4777
|
-
throw("Set Widget Name!");
|
|
4789
|
+
if( !name ) {
|
|
4790
|
+
throw( "Set Widget Name!" );
|
|
4778
4791
|
}
|
|
4779
4792
|
|
|
4780
|
-
let widget = this.create_widget(name, Widget.COLOR, options);
|
|
4793
|
+
let widget = this.create_widget( name, Widget.COLOR, options );
|
|
4794
|
+
|
|
4781
4795
|
widget.onGetValue = () => {
|
|
4782
4796
|
return color.value;
|
|
4783
4797
|
};
|
|
4784
|
-
widget.onSetValue = (
|
|
4785
|
-
color.value =
|
|
4786
|
-
Panel._dispatch_event(color, "input");
|
|
4798
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4799
|
+
color.value = newValue;
|
|
4800
|
+
Panel._dispatch_event( color, "input", skipCallback );
|
|
4787
4801
|
};
|
|
4802
|
+
|
|
4788
4803
|
let element = widget.domEl;
|
|
4789
4804
|
let change_from_input = false;
|
|
4790
4805
|
|
|
4791
4806
|
// Add reset functionality
|
|
4792
|
-
Panel._add_reset_property(element.domName, function() {
|
|
4807
|
+
Panel._add_reset_property( element.domName, function() {
|
|
4793
4808
|
this.style.display = "none";
|
|
4794
4809
|
color.value = color.iValue;
|
|
4795
|
-
Panel._dispatch_event(color, "input");
|
|
4810
|
+
Panel._dispatch_event( color, "input" );
|
|
4796
4811
|
});
|
|
4797
4812
|
|
|
4798
4813
|
// Add widget value
|
|
4799
4814
|
|
|
4800
|
-
var container = document.createElement('span');
|
|
4815
|
+
var container = document.createElement( 'span' );
|
|
4801
4816
|
container.className = "lexcolor";
|
|
4802
4817
|
container.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
|
|
4803
4818
|
|
|
4804
|
-
let color = document.createElement('input');
|
|
4819
|
+
let color = document.createElement( 'input' );
|
|
4805
4820
|
color.style.width = "calc(30% - 6px)";
|
|
4806
4821
|
color.type = 'color';
|
|
4807
4822
|
color.className = "colorinput";
|
|
4808
4823
|
color.id = "color" + simple_guidGenerator();
|
|
4809
4824
|
color.useRGB = options.useRGB ?? false;
|
|
4810
|
-
color.value = color.iValue = value.constructor === Array ? rgbToHex(value) : value;
|
|
4825
|
+
color.value = color.iValue = value.constructor === Array ? rgbToHex( value ) : value;
|
|
4811
4826
|
|
|
4812
|
-
if(options.disabled) {
|
|
4827
|
+
if( options.disabled ) {
|
|
4813
4828
|
color.disabled = true;
|
|
4814
4829
|
}
|
|
4815
4830
|
|
|
4816
|
-
color.addEventListener("input", e => {
|
|
4831
|
+
color.addEventListener( "input", e => {
|
|
4817
4832
|
let val = e.target.value;
|
|
4818
4833
|
|
|
4834
|
+
const skipCallback = e.detail;
|
|
4835
|
+
|
|
4819
4836
|
// Change value (always hex)
|
|
4820
4837
|
if( !change_from_input )
|
|
4821
|
-
text_widget.set(val);
|
|
4838
|
+
text_widget.set( val );
|
|
4822
4839
|
|
|
4823
4840
|
// Reset button (default value)
|
|
4824
|
-
if(
|
|
4825
|
-
|
|
4826
|
-
btn
|
|
4841
|
+
if( !skipCallback )
|
|
4842
|
+
{
|
|
4843
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4844
|
+
if( btn ) btn.style.display = val != color.iValue ? "block": "none";
|
|
4827
4845
|
}
|
|
4828
4846
|
|
|
4829
|
-
if(color.useRGB)
|
|
4830
|
-
val = hexToRgb(val);
|
|
4847
|
+
if( color.useRGB )
|
|
4848
|
+
val = hexToRgb( val );
|
|
4831
4849
|
|
|
4832
|
-
this._trigger( new IEvent(name, val, e), callback );
|
|
4833
|
-
}, false);
|
|
4850
|
+
if( !skipCallback ) this._trigger( new IEvent( name, val, e ), callback );
|
|
4851
|
+
}, false );
|
|
4834
4852
|
|
|
4835
|
-
container.appendChild(color);
|
|
4853
|
+
container.appendChild( color );
|
|
4836
4854
|
|
|
4837
4855
|
this.queue( container );
|
|
4838
4856
|
|
|
4839
|
-
const text_widget = this.addText(null, color.value,
|
|
4857
|
+
const text_widget = this.addText( null, color.value, v => {
|
|
4840
4858
|
change_from_input = true;
|
|
4841
4859
|
widget.set( v );
|
|
4842
4860
|
change_from_input = false;
|
|
@@ -4846,18 +4864,7 @@ class Panel {
|
|
|
4846
4864
|
|
|
4847
4865
|
this.clearQueue();
|
|
4848
4866
|
|
|
4849
|
-
|
|
4850
|
-
// valueName.className = "colorinfo";
|
|
4851
|
-
// valueName.innerText = color.value;
|
|
4852
|
-
|
|
4853
|
-
// valueName.addEventListener("click", e => {
|
|
4854
|
-
// color.focus();
|
|
4855
|
-
// color.click();
|
|
4856
|
-
// });
|
|
4857
|
-
|
|
4858
|
-
// container.appendChild(valueName);
|
|
4859
|
-
|
|
4860
|
-
element.appendChild(container);
|
|
4867
|
+
element.appendChild( container );
|
|
4861
4868
|
|
|
4862
4869
|
return widget;
|
|
4863
4870
|
}
|
|
@@ -4877,109 +4884,120 @@ class Panel {
|
|
|
4877
4884
|
|
|
4878
4885
|
addNumber( name, value, callback, options = {} ) {
|
|
4879
4886
|
|
|
4880
|
-
let widget = this.create_widget(name, Widget.NUMBER, options);
|
|
4887
|
+
let widget = this.create_widget( name, Widget.NUMBER, options );
|
|
4888
|
+
|
|
4881
4889
|
widget.onGetValue = () => {
|
|
4882
4890
|
return +vecinput.value;
|
|
4883
4891
|
};
|
|
4884
|
-
widget.onSetValue = (
|
|
4885
|
-
vecinput.value =
|
|
4886
|
-
Panel._dispatch_event(vecinput, "change");
|
|
4892
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
4893
|
+
vecinput.value = newValue;
|
|
4894
|
+
Panel._dispatch_event( vecinput, "change", skipCallback );
|
|
4887
4895
|
};
|
|
4896
|
+
|
|
4888
4897
|
let element = widget.domEl;
|
|
4889
4898
|
|
|
4890
4899
|
// add reset functionality
|
|
4891
|
-
if(widget.name) {
|
|
4892
|
-
Panel._add_reset_property(element.domName, function() {
|
|
4900
|
+
if( widget.name ) {
|
|
4901
|
+
Panel._add_reset_property( element.domName, function() {
|
|
4893
4902
|
this.style.display = "none";
|
|
4894
4903
|
vecinput.value = vecinput.iValue;
|
|
4895
|
-
Panel._dispatch_event(vecinput, "change");
|
|
4904
|
+
Panel._dispatch_event( vecinput, "change" );
|
|
4896
4905
|
});
|
|
4897
4906
|
}
|
|
4898
4907
|
|
|
4899
4908
|
// add widget value
|
|
4900
4909
|
|
|
4901
|
-
var container = document.createElement('div');
|
|
4910
|
+
var container = document.createElement( 'div' );
|
|
4902
4911
|
container.className = "lexnumber";
|
|
4903
4912
|
container.style.width = options.inputWidth || "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
|
|
4904
4913
|
|
|
4905
|
-
let box = document.createElement('div');
|
|
4914
|
+
let box = document.createElement( 'div' );
|
|
4906
4915
|
box.className = "numberbox";
|
|
4907
4916
|
|
|
4908
|
-
let vecinput = document.createElement('input');
|
|
4917
|
+
let vecinput = document.createElement( 'input' );
|
|
4909
4918
|
vecinput.className = "vecinput";
|
|
4910
4919
|
vecinput.min = options.min ?? -1e24;
|
|
4911
4920
|
vecinput.max = options.max ?? 1e24;
|
|
4912
4921
|
vecinput.step = options.step ?? "any";
|
|
4913
4922
|
vecinput.type = "number";
|
|
4914
|
-
vecinput.id = "number_"+simple_guidGenerator();
|
|
4923
|
+
vecinput.id = "number_" + simple_guidGenerator();
|
|
4915
4924
|
|
|
4916
4925
|
if( value.constructor == Number )
|
|
4917
4926
|
{
|
|
4918
|
-
value = clamp(value, +vecinput.min, +vecinput.max);
|
|
4919
|
-
value = options.precision ? round(value, options.precision) : value;
|
|
4927
|
+
value = clamp( value, +vecinput.min, +vecinput.max );
|
|
4928
|
+
value = options.precision ? round( value, options.precision ) : value;
|
|
4920
4929
|
}
|
|
4921
4930
|
|
|
4922
4931
|
vecinput.value = vecinput.iValue = value;
|
|
4923
|
-
box.appendChild(vecinput);
|
|
4932
|
+
box.appendChild( vecinput );
|
|
4924
4933
|
|
|
4925
|
-
let drag_icon = document.createElement('a');
|
|
4934
|
+
let drag_icon = document.createElement( 'a' );
|
|
4926
4935
|
drag_icon.className = "fa-solid fa-arrows-up-down drag-icon hidden";
|
|
4927
|
-
box.appendChild(drag_icon);
|
|
4936
|
+
box.appendChild( drag_icon );
|
|
4928
4937
|
|
|
4929
|
-
if(options.disabled) {
|
|
4938
|
+
if( options.disabled ) {
|
|
4930
4939
|
vecinput.disabled = true;
|
|
4931
4940
|
}
|
|
4932
4941
|
|
|
4933
4942
|
// add slider below
|
|
4934
|
-
if(!options.skipSlider && options.min !== undefined && options.max !== undefined) {
|
|
4935
|
-
let slider = document.createElement('input');
|
|
4943
|
+
if( !options.skipSlider && options.min !== undefined && options.max !== undefined ) {
|
|
4944
|
+
let slider = document.createElement( 'input' );
|
|
4936
4945
|
slider.className = "lexinputslider";
|
|
4937
4946
|
slider.step = options.step ?? 1;
|
|
4938
4947
|
slider.min = options.min;
|
|
4939
4948
|
slider.max = options.max;
|
|
4940
4949
|
slider.type = "range";
|
|
4941
4950
|
slider.value = value;
|
|
4942
|
-
slider.addEventListener("input", function(e) {
|
|
4951
|
+
slider.addEventListener( "input", function( e ) {
|
|
4943
4952
|
let new_value = +this.valueAsNumber;
|
|
4944
|
-
vecinput.value = (+new_value).toFixed(4).replace(/([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/,'$1');
|
|
4945
|
-
Panel._dispatch_event(vecinput, "change");
|
|
4946
|
-
}, false);
|
|
4947
|
-
box.appendChild(slider);
|
|
4953
|
+
vecinput.value = ( +new_value ).toFixed( 4 ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' );
|
|
4954
|
+
Panel._dispatch_event( vecinput, "change" );
|
|
4955
|
+
}, false );
|
|
4956
|
+
box.appendChild( slider );
|
|
4948
4957
|
}
|
|
4949
4958
|
|
|
4950
4959
|
// Add wheel input
|
|
4951
4960
|
|
|
4952
|
-
vecinput.addEventListener("wheel", function(e) {
|
|
4961
|
+
vecinput.addEventListener( "wheel", function( e ) {
|
|
4953
4962
|
e.preventDefault();
|
|
4954
|
-
if(this !== document.activeElement)
|
|
4963
|
+
if( this !== document.activeElement )
|
|
4955
4964
|
return;
|
|
4956
4965
|
let mult = options.step ?? 1;
|
|
4957
|
-
if(e.shiftKey) mult *= 10;
|
|
4958
|
-
else if(e.altKey) mult *= 0.1;
|
|
4959
|
-
let new_value = (+this.valueAsNumber - mult * (e.deltaY > 0 ? 1 : -1));
|
|
4960
|
-
this.value = (+new_value).toFixed(4).replace(/([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/,'$1');
|
|
4966
|
+
if( e.shiftKey ) mult *= 10;
|
|
4967
|
+
else if( e.altKey ) mult *= 0.1;
|
|
4968
|
+
let new_value = ( +this.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ) );
|
|
4969
|
+
this.value = ( +new_value ).toFixed( 4 ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' );
|
|
4961
4970
|
Panel._dispatch_event(vecinput, "change");
|
|
4962
|
-
}, {passive:false});
|
|
4971
|
+
}, { passive: false });
|
|
4963
4972
|
|
|
4964
|
-
vecinput.addEventListener("change", e => {
|
|
4965
|
-
|
|
4973
|
+
vecinput.addEventListener( "change", e => {
|
|
4974
|
+
|
|
4975
|
+
if( isNaN( e.target.valueAsNumber ) )
|
|
4966
4976
|
return;
|
|
4967
|
-
|
|
4968
|
-
|
|
4977
|
+
|
|
4978
|
+
const skipCallback = e.detail;
|
|
4979
|
+
|
|
4980
|
+
let val = e.target.value = clamp( +e.target.valueAsNumber, +vecinput.min, +vecinput.max );
|
|
4981
|
+
val = options.precision ? round( val, options.precision ) : val;
|
|
4969
4982
|
// update slider!
|
|
4970
|
-
if( box.querySelector(".lexinputslider"))
|
|
4971
|
-
box.querySelector(".lexinputslider").value = val;
|
|
4983
|
+
if( box.querySelector( ".lexinputslider" ) )
|
|
4984
|
+
box.querySelector( ".lexinputslider" ).value = val;
|
|
4972
4985
|
|
|
4973
4986
|
vecinput.value = val;
|
|
4987
|
+
|
|
4974
4988
|
// Reset button (default value)
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4989
|
+
if( !skipCallback )
|
|
4990
|
+
{
|
|
4991
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
4992
|
+
if( btn ) btn.style.display = val != vecinput.iValue ? "block": "none";
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
if( !skipCallback ) this._trigger( new IEvent( name, val, e ), callback );
|
|
4996
|
+
}, { passive: false });
|
|
4979
4997
|
|
|
4980
4998
|
// Add drag input
|
|
4981
4999
|
|
|
4982
|
-
vecinput.addEventListener("mousedown", inner_mousedown);
|
|
5000
|
+
vecinput.addEventListener( "mousedown", inner_mousedown );
|
|
4983
5001
|
|
|
4984
5002
|
var that = this;
|
|
4985
5003
|
var lastY = 0;
|
|
@@ -5037,44 +5055,39 @@ class Panel {
|
|
|
5037
5055
|
|
|
5038
5056
|
_add_vector( num_components, name, value, callback, options = {} ) {
|
|
5039
5057
|
|
|
5040
|
-
num_components = clamp(num_components, 2, 4);
|
|
5041
|
-
value = value ?? new Array(num_components).fill(0);
|
|
5058
|
+
num_components = clamp( num_components, 2, 4 );
|
|
5059
|
+
value = value ?? new Array( num_components ).fill( 0 );
|
|
5042
5060
|
|
|
5043
|
-
if(!name) {
|
|
5044
|
-
throw("Set Widget Name!");
|
|
5061
|
+
if( !name ) {
|
|
5062
|
+
throw( "Set Widget Name!" );
|
|
5045
5063
|
}
|
|
5046
5064
|
|
|
5047
|
-
let widget = this.create_widget(name, Widget.VECTOR, options);
|
|
5065
|
+
let widget = this.create_widget( name, Widget.VECTOR, options );
|
|
5048
5066
|
|
|
5049
5067
|
widget.onGetValue = () => {
|
|
5050
|
-
let inputs = element.querySelectorAll("input");
|
|
5068
|
+
let inputs = element.querySelectorAll( "input" );
|
|
5051
5069
|
let value = [];
|
|
5052
5070
|
for( var v of inputs )
|
|
5053
5071
|
value.push( +v.value );
|
|
5054
5072
|
return value;
|
|
5055
5073
|
};
|
|
5056
|
-
widget.onSetValue = (
|
|
5057
|
-
const inputs = element.querySelectorAll(".vecinput");
|
|
5074
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
5075
|
+
const inputs = element.querySelectorAll( ".vecinput" );
|
|
5058
5076
|
for( var i = 0; i < inputs.length; ++i ) {
|
|
5059
|
-
|
|
5060
|
-
|
|
5077
|
+
let value = newValue[ i ];
|
|
5078
|
+
inputs[ i ].value = value ?? 0;
|
|
5079
|
+
Panel._dispatch_event( inputs[ i ], "change", skipCallback );
|
|
5061
5080
|
}
|
|
5062
5081
|
};
|
|
5063
|
-
widget.setValue = (new_value) => {
|
|
5064
|
-
const inputs = element.querySelectorAll(".vecinput");
|
|
5065
|
-
for( var i = 0; i < inputs.length; ++i ) {
|
|
5066
|
-
inputs[i].value = new_value[i] ?? 0;
|
|
5067
|
-
}
|
|
5068
|
-
}
|
|
5069
5082
|
|
|
5070
5083
|
let element = widget.domEl;
|
|
5071
5084
|
|
|
5072
5085
|
// Add reset functionality
|
|
5073
|
-
Panel._add_reset_property(element.domName, function() {
|
|
5086
|
+
Panel._add_reset_property( element.domName, function() {
|
|
5074
5087
|
this.style.display = "none";
|
|
5075
|
-
for( let v of element.querySelectorAll(".vecinput") ) {
|
|
5088
|
+
for( let v of element.querySelectorAll( ".vecinput" ) ) {
|
|
5076
5089
|
v.value = v.iValue;
|
|
5077
|
-
Panel._dispatch_event(v, "change");
|
|
5090
|
+
Panel._dispatch_event( v, "change" );
|
|
5078
5091
|
}
|
|
5079
5092
|
});
|
|
5080
5093
|
|
|
@@ -5086,88 +5099,91 @@ class Panel {
|
|
|
5086
5099
|
|
|
5087
5100
|
for( let i = 0; i < num_components; ++i ) {
|
|
5088
5101
|
|
|
5089
|
-
let box = document.createElement('div');
|
|
5102
|
+
let box = document.createElement( 'div' );
|
|
5090
5103
|
box.className = "vecbox";
|
|
5091
|
-
box.innerHTML = "<span class='" + Panel.VECTOR_COMPONENTS[i] + "'></span>";
|
|
5104
|
+
box.innerHTML = "<span class='" + Panel.VECTOR_COMPONENTS[ i ] + "'></span>";
|
|
5092
5105
|
|
|
5093
|
-
let vecinput = document.createElement('input');
|
|
5106
|
+
let vecinput = document.createElement( 'input' );
|
|
5094
5107
|
vecinput.className = "vecinput v" + num_components;
|
|
5095
5108
|
vecinput.min = options.min ?? -1e24;
|
|
5096
5109
|
vecinput.max = options.max ?? 1e24;
|
|
5097
5110
|
vecinput.step = options.step ?? "any";
|
|
5098
5111
|
vecinput.type = "number";
|
|
5099
|
-
vecinput.id = "vec"+num_components+"_"+simple_guidGenerator();
|
|
5112
|
+
vecinput.id = "vec" + num_components + "_" + simple_guidGenerator();
|
|
5100
5113
|
vecinput.idx = i;
|
|
5101
5114
|
|
|
5102
|
-
if( value[i].constructor == Number )
|
|
5115
|
+
if( value[ i ].constructor == Number )
|
|
5103
5116
|
{
|
|
5104
|
-
value[i] = clamp(value[i], +vecinput.min, +vecinput.max);
|
|
5105
|
-
value[i] = options.precision ? round(value[i], options.precision) : value[i];
|
|
5117
|
+
value[ i ] = clamp(value[ i ], +vecinput.min, +vecinput.max);
|
|
5118
|
+
value[ i ] = options.precision ? round(value[ i ], options.precision) : value[ i ];
|
|
5106
5119
|
}
|
|
5107
5120
|
|
|
5108
|
-
vecinput.value = vecinput.iValue = value[i];
|
|
5121
|
+
vecinput.value = vecinput.iValue = value[ i ];
|
|
5109
5122
|
|
|
5110
|
-
let drag_icon = document.createElement('a');
|
|
5123
|
+
let drag_icon = document.createElement( 'a' );
|
|
5111
5124
|
drag_icon.className = "fa-solid fa-arrows-up-down drag-icon hidden";
|
|
5112
|
-
box.appendChild(drag_icon);
|
|
5125
|
+
box.appendChild( drag_icon );
|
|
5113
5126
|
|
|
5114
|
-
if(options.disabled) {
|
|
5127
|
+
if( options.disabled ) {
|
|
5115
5128
|
vecinput.disabled = true;
|
|
5116
5129
|
}
|
|
5117
5130
|
|
|
5118
5131
|
// Add wheel input
|
|
5119
5132
|
|
|
5120
|
-
vecinput.addEventListener("wheel", function(e) {
|
|
5133
|
+
vecinput.addEventListener( "wheel", function( e ) {
|
|
5121
5134
|
e.preventDefault();
|
|
5122
|
-
if(this !== document.activeElement)
|
|
5135
|
+
if( this !== document.activeElement )
|
|
5123
5136
|
return;
|
|
5124
5137
|
let mult = options.step ?? 1;
|
|
5125
|
-
if(e.shiftKey) mult = 10;
|
|
5126
|
-
else if(e.altKey) mult = 0.1;
|
|
5138
|
+
if( e.shiftKey ) mult = 10;
|
|
5139
|
+
else if( e.altKey ) mult = 0.1;
|
|
5127
5140
|
|
|
5128
5141
|
if( lock_icon.locked )
|
|
5129
5142
|
{
|
|
5130
5143
|
for( let v of element.querySelectorAll(".vecinput") ) {
|
|
5131
|
-
v.value = (+v.valueAsNumber - mult * (e.deltaY > 0 ? 1 : -1)).toPrecision(5);
|
|
5144
|
+
v.value = ( +v.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ) ).toPrecision( 5 );
|
|
5132
5145
|
Panel._dispatch_event(v, "change");
|
|
5133
5146
|
}
|
|
5134
5147
|
} else {
|
|
5135
|
-
this.value = (+this.valueAsNumber - mult * (e.deltaY > 0 ? 1 : -1)).toPrecision(5);
|
|
5136
|
-
Panel._dispatch_event(vecinput, "change");
|
|
5148
|
+
this.value = ( +this.valueAsNumber - mult * ( e.deltaY > 0 ? 1 : -1 ) ).toPrecision( 5 );
|
|
5149
|
+
Panel._dispatch_event( vecinput, "change" );
|
|
5137
5150
|
}
|
|
5138
|
-
}, {passive:false});
|
|
5151
|
+
}, { passive: false } );
|
|
5139
5152
|
|
|
5140
|
-
vecinput.addEventListener("change", e => {
|
|
5153
|
+
vecinput.addEventListener( "change", e => {
|
|
5141
5154
|
|
|
5142
5155
|
if( isNaN( e.target.value ) )
|
|
5143
5156
|
return;
|
|
5144
5157
|
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
val =
|
|
5148
|
-
|
|
5158
|
+
const skipCallback = e.detail;
|
|
5159
|
+
|
|
5160
|
+
let val = e.target.value = clamp( e.target.value, +vecinput.min, +vecinput.max );
|
|
5161
|
+
val = options.precision ? round( val, options.precision ) : val;
|
|
5149
5162
|
|
|
5150
5163
|
// Reset button (default value)
|
|
5151
|
-
|
|
5152
|
-
|
|
5164
|
+
if( !skipCallback )
|
|
5165
|
+
{
|
|
5166
|
+
let btn = element.querySelector( ".lexwidgetname .lexicon" );
|
|
5167
|
+
if( btn ) btn.style.display = val != vecinput.iValue ? "block": "none";
|
|
5168
|
+
}
|
|
5153
5169
|
|
|
5154
5170
|
if( lock_icon.locked )
|
|
5155
5171
|
{
|
|
5156
|
-
for( let v of element.querySelectorAll(".vecinput") ) {
|
|
5172
|
+
for( let v of element.querySelectorAll( ".vecinput" ) ) {
|
|
5157
5173
|
v.value = val;
|
|
5158
|
-
value[v.idx] = val;
|
|
5174
|
+
value[ v.idx ] = val;
|
|
5159
5175
|
}
|
|
5160
5176
|
} else {
|
|
5161
5177
|
vecinput.value = val;
|
|
5162
|
-
value[e.target.idx] = val;
|
|
5178
|
+
value[ e.target.idx ] = val;
|
|
5163
5179
|
}
|
|
5164
5180
|
|
|
5165
|
-
this._trigger( new IEvent(name, value, e), callback );
|
|
5166
|
-
}, false);
|
|
5181
|
+
if( !skipCallback ) this._trigger( new IEvent( name, value, e ), callback );
|
|
5182
|
+
}, false );
|
|
5167
5183
|
|
|
5168
5184
|
// Add drag input
|
|
5169
5185
|
|
|
5170
|
-
vecinput.addEventListener("mousedown", inner_mousedown);
|
|
5186
|
+
vecinput.addEventListener( "mousedown", inner_mousedown );
|
|
5171
5187
|
|
|
5172
5188
|
var that = this;
|
|
5173
5189
|
var lastY = 0;
|
|
@@ -5284,15 +5300,17 @@ class Panel {
|
|
|
5284
5300
|
throw("Set Widget Name!");
|
|
5285
5301
|
}
|
|
5286
5302
|
|
|
5287
|
-
let widget = this.create_widget(name, Widget.PROGRESS, options);
|
|
5303
|
+
let widget = this.create_widget( name, Widget.PROGRESS, options );
|
|
5304
|
+
|
|
5288
5305
|
widget.onGetValue = () => {
|
|
5289
5306
|
return progress.value;
|
|
5290
5307
|
};
|
|
5291
|
-
widget.onSetValue = (
|
|
5292
|
-
element.querySelector("meter").value =
|
|
5308
|
+
widget.onSetValue = ( newValue, skipCallback ) => {
|
|
5309
|
+
element.querySelector("meter").value = newValue;
|
|
5293
5310
|
if( element.querySelector("span") )
|
|
5294
|
-
element.querySelector("span").innerText =
|
|
5311
|
+
element.querySelector("span").innerText = newValue;
|
|
5295
5312
|
};
|
|
5313
|
+
|
|
5296
5314
|
let element = widget.domEl;
|
|
5297
5315
|
|
|
5298
5316
|
var container = document.createElement('div');
|
|
@@ -7089,7 +7107,7 @@ class AssetView {
|
|
|
7089
7107
|
let textEl = document.createElement('text');
|
|
7090
7108
|
preview.appendChild(textEl);
|
|
7091
7109
|
// If no extension, e.g. Clip, use the type...
|
|
7092
|
-
textEl.innerText = extension == item.id ? item.type.toUpperCase() : ("." + extension.toUpperCase());
|
|
7110
|
+
textEl.innerText = (!extension || extension == item.id) ? item.type.toUpperCase() : ("." + extension.toUpperCase());
|
|
7093
7111
|
|
|
7094
7112
|
var newLength = textEl.innerText.length;
|
|
7095
7113
|
var charsPerLine = 2.5;
|