lexgui 0.5.7 → 0.5.8
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/audio.js +2 -2
- package/build/components/timeline.js +475 -420
- package/build/components/videoeditor.js +97 -148
- package/build/lexgui.css +13 -0
- package/build/lexgui.js +255 -169
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +255 -169
- package/build/lexgui.module.min.js +1 -1
- package/build/utilities.css +11 -0
- package/changelog.md +23 -1
- package/demo.js +1 -1
- package/package.json +1 -1
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 = {
|
|
15
|
-
version: "0.5.
|
|
15
|
+
version: "0.5.8",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // Specific pre-build components
|
|
18
18
|
signals: {}, // Events and triggers
|
|
@@ -134,6 +134,56 @@ function stripHTML( html )
|
|
|
134
134
|
|
|
135
135
|
LX.stripHTML = stripHTML;
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @method parsePixelSize
|
|
139
|
+
* @description Parses any css size and returns a number of pixels
|
|
140
|
+
* @param {Number|String} size
|
|
141
|
+
* @param {Number} total
|
|
142
|
+
*/
|
|
143
|
+
const parsePixelSize = ( size, total ) => {
|
|
144
|
+
|
|
145
|
+
if( size.constructor === Number ) { return size; } // Assuming pixels..
|
|
146
|
+
|
|
147
|
+
if( size.constructor === String )
|
|
148
|
+
{
|
|
149
|
+
const value = parseFloat( size );
|
|
150
|
+
|
|
151
|
+
if( size.endsWith( "px" ) ) { return value; } // String pixels
|
|
152
|
+
if( size.endsWith( '%' ) ) { return ( value / 100 ) * total; } // Percentage
|
|
153
|
+
if( size.endsWith( "rem" ) || size.endsWith( "em" ) ) { const rootFontSize = 16; /*parseFloat(getComputedStyle(document.documentElement).fontSize);*/ return value * rootFontSize; } // rem unit: assume 16px = 1rem
|
|
154
|
+
if( size.endsWith( "vw" ) ) { return ( value / 100 ) * window.innerWidth; } // wViewport units
|
|
155
|
+
if( size.endsWith( "vh" ) ) { return ( value / 100 ) * window.innerHeight; } // hViewport units
|
|
156
|
+
|
|
157
|
+
// Any CSS calc expression (e.g., "calc(30% - 4px)")
|
|
158
|
+
if( size.startsWith( "calc(" ) )
|
|
159
|
+
{
|
|
160
|
+
const expr = size.slice( 5, -1 );
|
|
161
|
+
const parts = expr.split( /([+\-])/ ); // ["30% ", "-", "4px"]
|
|
162
|
+
let result = 0;
|
|
163
|
+
let op = "+";
|
|
164
|
+
for( let part of parts )
|
|
165
|
+
{
|
|
166
|
+
part = part.trim();
|
|
167
|
+
if( part === "+" || part === "-" )
|
|
168
|
+
{
|
|
169
|
+
op = part;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
{
|
|
173
|
+
let value = parsePixelSize( part, total );
|
|
174
|
+
result = ( op === "+" ) ? result + value : result - value;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
throw( "Bad size format!" );
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
LX.parsePixelSize = parsePixelSize;
|
|
186
|
+
|
|
137
187
|
/**
|
|
138
188
|
* @method deepCopy
|
|
139
189
|
* @description Create a deep copy with no references from an object
|
|
@@ -2257,6 +2307,8 @@ class ColorPicker {
|
|
|
2257
2307
|
|
|
2258
2308
|
doAsync( this._svToPosition.bind( this, this.currentColor.hsv.s, this.currentColor.hsv.v ) );
|
|
2259
2309
|
|
|
2310
|
+
let pickerRect = null;
|
|
2311
|
+
|
|
2260
2312
|
let innerMouseDown = e => {
|
|
2261
2313
|
var doc = this.root.ownerDocument;
|
|
2262
2314
|
doc.addEventListener( 'mousemove', innerMouseMove );
|
|
@@ -2271,15 +2323,15 @@ class ColorPicker {
|
|
|
2271
2323
|
this.intSatMarker.style.top = currentTop + "px";
|
|
2272
2324
|
this._positionToSv( currentLeft, currentTop );
|
|
2273
2325
|
this._updateColorValue();
|
|
2326
|
+
|
|
2327
|
+
pickerRect = this.colorPickerBackground.getBoundingClientRect();
|
|
2274
2328
|
}
|
|
2275
2329
|
|
|
2276
2330
|
let innerMouseMove = e => {
|
|
2277
2331
|
const dX = e.movementX;
|
|
2278
2332
|
const dY = e.movementY;
|
|
2279
|
-
|
|
2280
|
-
const
|
|
2281
|
-
const mouseX = e.offsetX - rect.x;
|
|
2282
|
-
const mouseY = e.offsetY - rect.y;
|
|
2333
|
+
const mouseX = e.x - pickerRect.x;
|
|
2334
|
+
const mouseY = e.y - pickerRect.y;
|
|
2283
2335
|
|
|
2284
2336
|
if ( dX != 0 && ( mouseX >= 0 || dX < 0 ) && ( mouseX < this.colorPickerBackground.offsetWidth || dX > 0 ) )
|
|
2285
2337
|
{
|
|
@@ -2349,6 +2401,8 @@ class ColorPicker {
|
|
|
2349
2401
|
this._updateColorValue();
|
|
2350
2402
|
};
|
|
2351
2403
|
|
|
2404
|
+
let hueTrackerRect = null;
|
|
2405
|
+
|
|
2352
2406
|
let innerMouseDownHue = e => {
|
|
2353
2407
|
const doc = this.root.ownerDocument;
|
|
2354
2408
|
doc.addEventListener( 'mousemove', innerMouseMoveHue );
|
|
@@ -2359,15 +2413,15 @@ class ColorPicker {
|
|
|
2359
2413
|
|
|
2360
2414
|
const hueX = clamp( e.offsetX - this.markerHalfSize, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2361
2415
|
_fromHueX( hueX );
|
|
2416
|
+
|
|
2417
|
+
hueTrackerRect = this.colorPickerTracker.getBoundingClientRect();
|
|
2362
2418
|
}
|
|
2363
2419
|
|
|
2364
2420
|
let innerMouseMoveHue = e => {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
const rect = this.colorPickerTracker.getBoundingClientRect();
|
|
2368
|
-
const mouseX = e.offsetX - rect.x;
|
|
2421
|
+
const dX = e.movementX;
|
|
2422
|
+
const mouseX = e.x - hueTrackerRect.x;
|
|
2369
2423
|
|
|
2370
|
-
if ( dX != 0 && ( mouseX >=
|
|
2424
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.colorPickerTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2371
2425
|
{
|
|
2372
2426
|
const hueX = LX.clamp( parseInt( this.hueMarker.style.left ) + dX, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2373
2427
|
_fromHueX( hueX )
|
|
@@ -2412,6 +2466,8 @@ class ColorPicker {
|
|
|
2412
2466
|
this.alphaMarker.style.backgroundColor = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b },${ this.currentColor.css.a })`;
|
|
2413
2467
|
};
|
|
2414
2468
|
|
|
2469
|
+
let alphaTrackerRect = null;
|
|
2470
|
+
|
|
2415
2471
|
let innerMouseDownAlpha = e => {
|
|
2416
2472
|
const doc = this.root.ownerDocument;
|
|
2417
2473
|
doc.addEventListener( 'mousemove', innerMouseMoveAlpha );
|
|
@@ -2421,15 +2477,14 @@ class ColorPicker {
|
|
|
2421
2477
|
e.stopPropagation();
|
|
2422
2478
|
const alphaX = clamp( e.offsetX - this.markerHalfSize, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2423
2479
|
_fromAlphaX( alphaX );
|
|
2480
|
+
alphaTrackerRect = this.alphaTracker.getBoundingClientRect();
|
|
2424
2481
|
}
|
|
2425
2482
|
|
|
2426
2483
|
let innerMouseMoveAlpha = e => {
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
const rect = this.alphaTracker.getBoundingClientRect();
|
|
2430
|
-
const mouseX = e.offsetX - rect.x;
|
|
2484
|
+
const dX = e.movementX;
|
|
2485
|
+
const mouseX = e.x - alphaTrackerRect.x;
|
|
2431
2486
|
|
|
2432
|
-
if ( dX != 0 && ( mouseX >=
|
|
2487
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.alphaTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2433
2488
|
{
|
|
2434
2489
|
const alphaX = LX.clamp( parseInt( this.alphaMarker.style.left ) + dX, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2435
2490
|
_fromAlphaX( alphaX );
|
|
@@ -2867,7 +2922,7 @@ class Area {
|
|
|
2867
2922
|
* @method split
|
|
2868
2923
|
* @param {Object} options
|
|
2869
2924
|
* type: Split mode (horizontal, vertical) ["horizontal"]
|
|
2870
|
-
* sizes: Size of each new area (Array) ["50%", "50%"]
|
|
2925
|
+
* sizes: CSS Size of each new area (Array) ["50%", "50%"]
|
|
2871
2926
|
* resize: Allow area manual resizing [true]
|
|
2872
2927
|
* sizes: "Allow the area to be minimized [false]
|
|
2873
2928
|
*/
|
|
@@ -2882,11 +2937,12 @@ class Area {
|
|
|
2882
2937
|
this.root = this.sections[ 1 ].root;
|
|
2883
2938
|
}
|
|
2884
2939
|
|
|
2885
|
-
const type = options.type
|
|
2940
|
+
const type = options.type ?? "horizontal";
|
|
2886
2941
|
const sizes = options.sizes || [ "50%", "50%" ];
|
|
2887
2942
|
const auto = (options.sizes === 'auto') || ( options.sizes && options.sizes[ 0 ] == "auto" && options.sizes[ 1 ] == "auto" );
|
|
2888
2943
|
|
|
2889
|
-
|
|
2944
|
+
// Secondary area fills space
|
|
2945
|
+
if( !sizes[ 1 ] || ( sizes[ 0 ] != "auto" && sizes[ 1 ] == "auto" ) )
|
|
2890
2946
|
{
|
|
2891
2947
|
let size = sizes[ 0 ];
|
|
2892
2948
|
let margin = options.top ? options.top : 0;
|
|
@@ -2899,17 +2955,13 @@ class Area {
|
|
|
2899
2955
|
sizes[ 1 ] = "calc( 100% - " + size + " )";
|
|
2900
2956
|
}
|
|
2901
2957
|
|
|
2902
|
-
// Create areas
|
|
2903
|
-
let area1 = new Area( { skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
2904
|
-
let area2 = new Area( { skipAppend: true, className: "split" } );
|
|
2905
|
-
|
|
2906
|
-
area1.parentArea = this;
|
|
2907
|
-
area2.parentArea = this;
|
|
2908
|
-
|
|
2909
2958
|
let minimizable = options.minimizable ?? false;
|
|
2910
2959
|
let resize = ( options.resize ?? true ) || minimizable;
|
|
2960
|
+
let fixedSize = options.fixedSize ?? !resize;
|
|
2961
|
+
let splitbarOffset = 0;
|
|
2962
|
+
let primarySize = [];
|
|
2963
|
+
let secondarySize = [];
|
|
2911
2964
|
|
|
2912
|
-
let data = "0px";
|
|
2913
2965
|
this.offset = 0;
|
|
2914
2966
|
|
|
2915
2967
|
if( resize )
|
|
@@ -2929,93 +2981,104 @@ class Area {
|
|
|
2929
2981
|
|
|
2930
2982
|
this.splitBar.addEventListener( 'mousedown', innerMouseDown );
|
|
2931
2983
|
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
// Being minimizable means it's also resizeable!
|
|
2935
|
-
if( minimizable )
|
|
2936
|
-
{
|
|
2937
|
-
this.splitExtended = false;
|
|
2938
|
-
|
|
2939
|
-
// Keep state of the animation when ends...
|
|
2940
|
-
area2.root.addEventListener('animationend', e => {
|
|
2941
|
-
const opacity = getComputedStyle( area2.root ).opacity;
|
|
2942
|
-
area2.root.classList.remove( e.animationName + "-" + type );
|
|
2943
|
-
area2.root.style.opacity = opacity;
|
|
2944
|
-
flushCss(area2.root);
|
|
2945
|
-
});
|
|
2946
|
-
|
|
2947
|
-
this.splitBar.addEventListener("contextmenu", e => {
|
|
2948
|
-
e.preventDefault();
|
|
2949
|
-
addContextMenu(null, e, c => {
|
|
2950
|
-
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
2951
|
-
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
2952
|
-
});
|
|
2953
|
-
});
|
|
2954
|
-
}
|
|
2984
|
+
splitbarOffset = ( LX.DEFAULT_SPLITBAR_SIZE / 2 ); // updates
|
|
2955
2985
|
}
|
|
2956
2986
|
|
|
2957
2987
|
if( type == "horizontal" )
|
|
2958
2988
|
{
|
|
2959
|
-
|
|
2960
|
-
width2 = sizes[ 1 ];
|
|
2989
|
+
this.root.style.display = "flex";
|
|
2961
2990
|
|
|
2962
|
-
if(
|
|
2991
|
+
if( !fixedSize )
|
|
2963
2992
|
{
|
|
2964
|
-
|
|
2965
|
-
|
|
2993
|
+
const parentWidth = this.root.offsetWidth;
|
|
2994
|
+
const leftPx = parsePixelSize( sizes[ 0 ], parentWidth );
|
|
2995
|
+
const rightPx = parsePixelSize( sizes[ 1 ], parentWidth );
|
|
2996
|
+
const leftPercent = ( leftPx / parentWidth ) * 100;
|
|
2997
|
+
const rightPercent = ( rightPx / parentWidth ) * 100;
|
|
2966
2998
|
|
|
2967
|
-
|
|
2999
|
+
// Style using percentages
|
|
3000
|
+
primarySize[ 0 ] = `calc(${ leftPercent }% - ${ splitbarOffset }px)`;
|
|
3001
|
+
secondarySize[ 0 ] = `calc(${ rightPercent }% - ${ splitbarOffset }px)`;
|
|
3002
|
+
}
|
|
3003
|
+
else
|
|
2968
3004
|
{
|
|
2969
|
-
|
|
3005
|
+
primarySize[ 0 ] = `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`;
|
|
3006
|
+
secondarySize[ 0 ] = `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`;
|
|
2970
3007
|
}
|
|
2971
3008
|
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
area2.root.style.width = "calc( " + width2 + " - " + data + " )";
|
|
2975
|
-
area2.root.style.height = "calc(100% - 0px)";
|
|
2976
|
-
this.root.style.display = "flex";
|
|
3009
|
+
primarySize[ 1 ] = "100%";
|
|
3010
|
+
secondarySize[ 1 ] = "100%";
|
|
2977
3011
|
}
|
|
2978
3012
|
else // vertical
|
|
2979
3013
|
{
|
|
2980
|
-
area1.root.style.width = "100%";
|
|
2981
|
-
area2.root.style.width = "100%";
|
|
2982
|
-
|
|
2983
3014
|
if( auto )
|
|
2984
3015
|
{
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
});
|
|
3016
|
+
primarySize[ 1 ] = "auto";
|
|
3017
|
+
}
|
|
3018
|
+
else if( !fixedSize )
|
|
3019
|
+
{
|
|
3020
|
+
const parentHeight = this.root.offsetHeight;
|
|
3021
|
+
const topPx = parsePixelSize( sizes[ 0 ], parentHeight );
|
|
3022
|
+
const bottomPx = parsePixelSize( sizes[ 1 ], parentHeight );
|
|
3023
|
+
const topPercent = ( topPx / parentHeight ) * 100;
|
|
3024
|
+
const bottomPercent = ( bottomPx / parentHeight ) * 100;
|
|
2995
3025
|
|
|
2996
|
-
|
|
3026
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ topPercent }% - ${ splitbarOffset }px)`);
|
|
3027
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ bottomPercent }% - ${ splitbarOffset }px)`);
|
|
2997
3028
|
}
|
|
2998
3029
|
else
|
|
2999
3030
|
{
|
|
3000
|
-
|
|
3001
|
-
|
|
3031
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`);
|
|
3032
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`);
|
|
3033
|
+
}
|
|
3002
3034
|
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3035
|
+
primarySize[ 0 ] = "100%";
|
|
3036
|
+
secondarySize[ 0 ] = "100%";
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
// Create areas
|
|
3040
|
+
let area1 = new Area( { width: primarySize[ 0 ], height: primarySize[ 1 ], skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
3041
|
+
let area2 = new Area( { width: secondarySize[ 0 ], height: secondarySize[ 1 ], skipAppend: true, className: "split" } );
|
|
3007
3042
|
|
|
3008
|
-
|
|
3043
|
+
if( auto && type == "vertical" )
|
|
3044
|
+
{
|
|
3045
|
+
// Listen resize event on first area
|
|
3046
|
+
const resizeObserver = new ResizeObserver( entries => {
|
|
3047
|
+
for ( const entry of entries )
|
|
3009
3048
|
{
|
|
3010
|
-
|
|
3049
|
+
const size = entry.target.getComputedSize();
|
|
3050
|
+
area2.root.style.height = "calc(100% - " + ( size.height ) + "px )";
|
|
3011
3051
|
}
|
|
3052
|
+
});
|
|
3012
3053
|
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3054
|
+
resizeObserver.observe( area1.root );
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
// Being minimizable means it's also resizeable!
|
|
3058
|
+
if( resize && minimizable )
|
|
3059
|
+
{
|
|
3060
|
+
this.splitExtended = false;
|
|
3061
|
+
|
|
3062
|
+
// Keep state of the animation when ends...
|
|
3063
|
+
area2.root.addEventListener('animationend', e => {
|
|
3064
|
+
const opacity = getComputedStyle( area2.root ).opacity;
|
|
3065
|
+
area2.root.classList.remove( e.animationName + "-" + type );
|
|
3066
|
+
area2.root.style.opacity = opacity;
|
|
3067
|
+
flushCss( area2.root );
|
|
3068
|
+
});
|
|
3069
|
+
|
|
3070
|
+
this.splitBar.addEventListener("contextmenu", e => {
|
|
3071
|
+
e.preventDefault();
|
|
3072
|
+
addContextMenu(null, e, c => {
|
|
3073
|
+
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
3074
|
+
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
3075
|
+
});
|
|
3076
|
+
});
|
|
3017
3077
|
}
|
|
3018
3078
|
|
|
3079
|
+
area1.parentArea = this;
|
|
3080
|
+
area2.parentArea = this;
|
|
3081
|
+
|
|
3019
3082
|
this.root.appendChild( area1.root );
|
|
3020
3083
|
|
|
3021
3084
|
if( resize )
|
|
@@ -3024,6 +3087,7 @@ class Area {
|
|
|
3024
3087
|
}
|
|
3025
3088
|
|
|
3026
3089
|
this.root.appendChild( area2.root );
|
|
3090
|
+
|
|
3027
3091
|
this.sections = [ area1, area2 ];
|
|
3028
3092
|
this.type = type;
|
|
3029
3093
|
|
|
@@ -3137,10 +3201,10 @@ class Area {
|
|
|
3137
3201
|
return;
|
|
3138
3202
|
}
|
|
3139
3203
|
|
|
3140
|
-
let [area1, area2] = this.sections;
|
|
3204
|
+
let [ area1, area2 ] = this.sections;
|
|
3141
3205
|
this.splitExtended = true;
|
|
3142
3206
|
|
|
3143
|
-
if( this.type == "vertical")
|
|
3207
|
+
if( this.type == "vertical" )
|
|
3144
3208
|
{
|
|
3145
3209
|
this.offset = area2.root.offsetHeight;
|
|
3146
3210
|
area2.root.classList.add("fadeout-vertical");
|
|
@@ -3151,7 +3215,7 @@ class Area {
|
|
|
3151
3215
|
{
|
|
3152
3216
|
this.offset = area2.root.offsetWidth - 8; // Force some height here...
|
|
3153
3217
|
area2.root.classList.add("fadeout-horizontal");
|
|
3154
|
-
this._moveSplit(-Infinity, true, 8);
|
|
3218
|
+
this._moveSplit( -Infinity, true, 8 );
|
|
3155
3219
|
}
|
|
3156
3220
|
|
|
3157
3221
|
doAsync( () => this.propagateEvent('onresize'), 150 );
|
|
@@ -3258,8 +3322,7 @@ class Area {
|
|
|
3258
3322
|
|
|
3259
3323
|
LX.menubars.push( menubar );
|
|
3260
3324
|
|
|
3261
|
-
const
|
|
3262
|
-
const [ bar, content ] = this.split({ type: 'vertical', sizes: [height, null], resize: false, menubar: true });
|
|
3325
|
+
const [ bar, content ] = this.split({ type: 'vertical', sizes: ["48px", null], resize: false, menubar: true });
|
|
3263
3326
|
menubar.siblingArea = content;
|
|
3264
3327
|
|
|
3265
3328
|
bar.attach( menubar );
|
|
@@ -3376,7 +3439,8 @@ class Area {
|
|
|
3376
3439
|
img: b.img,
|
|
3377
3440
|
className: b.class ?? "",
|
|
3378
3441
|
title: b.name,
|
|
3379
|
-
overflowContainerX: overlayPanel.root
|
|
3442
|
+
overflowContainerX: overlayPanel.root,
|
|
3443
|
+
swap: b.swap
|
|
3380
3444
|
};
|
|
3381
3445
|
|
|
3382
3446
|
if( group )
|
|
@@ -3513,7 +3577,7 @@ class Area {
|
|
|
3513
3577
|
|
|
3514
3578
|
const a2 = this.sections[ 1 ];
|
|
3515
3579
|
const a2Root = a2.root;
|
|
3516
|
-
const splitData = "
|
|
3580
|
+
const splitData = "- "+ LX.DEFAULT_SPLITBAR_SIZE + "px";
|
|
3517
3581
|
|
|
3518
3582
|
let transition = null;
|
|
3519
3583
|
if( !forceAnimation )
|
|
@@ -3521,30 +3585,47 @@ class Area {
|
|
|
3521
3585
|
// Remove transitions for this change..
|
|
3522
3586
|
transition = a1Root.style.transition;
|
|
3523
3587
|
a1Root.style.transition = a2Root.style.transition = "none";
|
|
3524
|
-
flushCss( a1Root );
|
|
3525
|
-
flushCss( a2Root );
|
|
3588
|
+
// flushCss( a1Root );
|
|
3526
3589
|
}
|
|
3527
3590
|
|
|
3528
3591
|
if( this.type == "horizontal" )
|
|
3529
3592
|
{
|
|
3530
3593
|
var size = Math.max( a2Root.offsetWidth + dt, parseInt( a2.minWidth ) );
|
|
3531
3594
|
if( forceWidth ) size = forceWidth;
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3595
|
+
|
|
3596
|
+
const parentWidth = this.size[ 0 ];
|
|
3597
|
+
const rightPercent = ( size / parentWidth ) * 100;
|
|
3598
|
+
const leftPercent = Math.max( 0, 100 - rightPercent );
|
|
3599
|
+
|
|
3600
|
+
a1Root.style.width = `-moz-calc(${ leftPercent }% ${ splitData })`;
|
|
3601
|
+
a1Root.style.width = `-webkit-calc( ${ leftPercent }% ${ splitData })`;
|
|
3602
|
+
a1Root.style.width = `calc( ${ leftPercent }% ${ splitData })`;
|
|
3603
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3604
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3605
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3606
|
+
|
|
3607
|
+
if( a1.maxWidth != Infinity )
|
|
3608
|
+
{
|
|
3609
|
+
a2Root.style.minWidth = "calc( 100% - " + parseInt( a1.maxWidth ) + "px" + " )";
|
|
3610
|
+
}
|
|
3538
3611
|
}
|
|
3539
3612
|
else
|
|
3540
3613
|
{
|
|
3541
|
-
var size = Math.max((a2Root.offsetHeight + dt) + a2.offset, parseInt(a2.minHeight));
|
|
3614
|
+
var size = Math.max( ( a2Root.offsetHeight + dt ) + a2.offset, parseInt(a2.minHeight) );
|
|
3542
3615
|
if( forceWidth ) size = forceWidth;
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3616
|
+
|
|
3617
|
+
const parentHeight = this.size[ 1 ];
|
|
3618
|
+
const bottomPercent = ( size / parentHeight ) * 100;
|
|
3619
|
+
const topPercent = Math.max( 0, 100 - bottomPercent );
|
|
3620
|
+
|
|
3621
|
+
a1Root.style.height = `-moz-calc(${ topPercent }% ${ splitData })`;
|
|
3622
|
+
a1Root.style.height = `-webkit-calc( ${ topPercent }% ${ splitData })`;
|
|
3623
|
+
a1Root.style.height = `calc( ${ topPercent }% ${ splitData })`;
|
|
3624
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3625
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3626
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3627
|
+
|
|
3546
3628
|
a1Root.style.minHeight = a1.minHeight + "px";
|
|
3547
|
-
a2Root.style.height = ( size - a2.offset ) + "px";
|
|
3548
3629
|
}
|
|
3549
3630
|
|
|
3550
3631
|
if( !forceAnimation )
|
|
@@ -3553,10 +3634,10 @@ class Area {
|
|
|
3553
3634
|
a1Root.style.transition = a2Root.style.transition = transition;
|
|
3554
3635
|
}
|
|
3555
3636
|
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3637
|
+
doAsync( () => {
|
|
3638
|
+
this._update();
|
|
3639
|
+
this.propagateEvent( 'onresize' );
|
|
3640
|
+
}, 10 );
|
|
3560
3641
|
}
|
|
3561
3642
|
|
|
3562
3643
|
_disableSplitResize() {
|
|
@@ -6122,7 +6203,17 @@ class NodeTree {
|
|
|
6122
6203
|
|
|
6123
6204
|
this.data = newData ?? this.data;
|
|
6124
6205
|
this.domEl.querySelector( "ul" ).innerHTML = "";
|
|
6125
|
-
|
|
6206
|
+
if( this.data.constructor === Object )
|
|
6207
|
+
{
|
|
6208
|
+
this._createItem( null, this.data, 0, selectedId );
|
|
6209
|
+
}
|
|
6210
|
+
else
|
|
6211
|
+
{
|
|
6212
|
+
for( let d of this.data )
|
|
6213
|
+
{
|
|
6214
|
+
this._createItem( null, d, 0, selectedId );
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6126
6217
|
}
|
|
6127
6218
|
|
|
6128
6219
|
/* Refreshes the tree and focuses current element */
|
|
@@ -6249,8 +6340,8 @@ class TextInput extends Widget {
|
|
|
6249
6340
|
};
|
|
6250
6341
|
|
|
6251
6342
|
this.onResize = ( rect ) => {
|
|
6252
|
-
const realNameWidth = ( this.root.domName?.
|
|
6253
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6343
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6344
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6254
6345
|
};
|
|
6255
6346
|
|
|
6256
6347
|
this.valid = ( v ) => {
|
|
@@ -6388,8 +6479,8 @@ class TextArea extends Widget {
|
|
|
6388
6479
|
};
|
|
6389
6480
|
|
|
6390
6481
|
this.onResize = ( rect ) => {
|
|
6391
|
-
const realNameWidth = ( this.root.domName?.
|
|
6392
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6482
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6483
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6393
6484
|
};
|
|
6394
6485
|
|
|
6395
6486
|
let container = document.createElement( "div" );
|
|
@@ -6482,8 +6573,8 @@ class Button extends Widget {
|
|
|
6482
6573
|
};
|
|
6483
6574
|
|
|
6484
6575
|
this.onResize = ( rect ) => {
|
|
6485
|
-
const realNameWidth = ( this.root.domName?.
|
|
6486
|
-
wValue.style.width = `calc( 100% - ${ realNameWidth }
|
|
6576
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6577
|
+
wValue.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6487
6578
|
};
|
|
6488
6579
|
|
|
6489
6580
|
var wValue = document.createElement( 'button' );
|
|
@@ -6745,8 +6836,8 @@ class ComboButtons extends Widget {
|
|
|
6745
6836
|
};
|
|
6746
6837
|
|
|
6747
6838
|
this.onResize = ( rect ) => {
|
|
6748
|
-
const realNameWidth = ( this.root.domName?.
|
|
6749
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
6839
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6840
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6750
6841
|
};
|
|
6751
6842
|
|
|
6752
6843
|
this.root.appendChild( container );
|
|
@@ -6962,8 +7053,8 @@ class Select extends Widget {
|
|
|
6962
7053
|
};
|
|
6963
7054
|
|
|
6964
7055
|
this.onResize = ( rect ) => {
|
|
6965
|
-
const realNameWidth = ( this.root.domName?.
|
|
6966
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7056
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7057
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6967
7058
|
};
|
|
6968
7059
|
|
|
6969
7060
|
let container = document.createElement( "div" );
|
|
@@ -7310,11 +7401,8 @@ class Curve extends Widget {
|
|
|
7310
7401
|
};
|
|
7311
7402
|
|
|
7312
7403
|
this.onResize = ( rect ) => {
|
|
7313
|
-
const realNameWidth = ( this.root.domName?.
|
|
7314
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7315
|
-
flushCss( container );
|
|
7316
|
-
curveInstance.canvas.width = container.offsetWidth;
|
|
7317
|
-
curveInstance.redraw();
|
|
7404
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7405
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7318
7406
|
};
|
|
7319
7407
|
|
|
7320
7408
|
var container = document.createElement( "div" );
|
|
@@ -7331,6 +7419,16 @@ class Curve extends Widget {
|
|
|
7331
7419
|
container.appendChild( curveInstance.element );
|
|
7332
7420
|
this.curveInstance = curveInstance;
|
|
7333
7421
|
|
|
7422
|
+
const observer = new ResizeObserver( entries => {
|
|
7423
|
+
for ( const entry of entries )
|
|
7424
|
+
{
|
|
7425
|
+
curveInstance.canvas.width = entry.contentRect.width;
|
|
7426
|
+
curveInstance.redraw();
|
|
7427
|
+
}
|
|
7428
|
+
});
|
|
7429
|
+
|
|
7430
|
+
observer.observe( container );
|
|
7431
|
+
|
|
7334
7432
|
doAsync( this.onResize.bind( this ) );
|
|
7335
7433
|
}
|
|
7336
7434
|
}
|
|
@@ -7364,8 +7462,8 @@ class Dial extends Widget {
|
|
|
7364
7462
|
};
|
|
7365
7463
|
|
|
7366
7464
|
this.onResize = ( rect ) => {
|
|
7367
|
-
const realNameWidth = ( this.root.domName?.
|
|
7368
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7465
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7466
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7369
7467
|
flushCss( container );
|
|
7370
7468
|
dialInstance.element.style.height = dialInstance.element.offsetWidth + "px";
|
|
7371
7469
|
dialInstance.canvas.width = dialInstance.element.offsetWidth;
|
|
@@ -7419,8 +7517,8 @@ class Layers extends Widget {
|
|
|
7419
7517
|
};
|
|
7420
7518
|
|
|
7421
7519
|
this.onResize = ( rect ) => {
|
|
7422
|
-
const realNameWidth = ( this.root.domName?.
|
|
7423
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7520
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7521
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7424
7522
|
};
|
|
7425
7523
|
|
|
7426
7524
|
var container = document.createElement( "div" );
|
|
@@ -7644,8 +7742,8 @@ class List extends Widget {
|
|
|
7644
7742
|
};
|
|
7645
7743
|
|
|
7646
7744
|
this.onResize = ( rect ) => {
|
|
7647
|
-
const realNameWidth = ( this.root.domName?.
|
|
7648
|
-
listContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7745
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7746
|
+
listContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7649
7747
|
};
|
|
7650
7748
|
|
|
7651
7749
|
this._updateValues = ( newValues ) => {
|
|
@@ -7721,8 +7819,8 @@ class Tags extends Widget {
|
|
|
7721
7819
|
};
|
|
7722
7820
|
|
|
7723
7821
|
this.onResize = ( rect ) => {
|
|
7724
|
-
const realNameWidth = ( this.root.domName?.
|
|
7725
|
-
tagsContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7822
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7823
|
+
tagsContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7726
7824
|
};
|
|
7727
7825
|
|
|
7728
7826
|
// Show tags
|
|
@@ -7822,8 +7920,8 @@ class Checkbox extends Widget {
|
|
|
7822
7920
|
};
|
|
7823
7921
|
|
|
7824
7922
|
this.onResize = ( rect ) => {
|
|
7825
|
-
const realNameWidth = ( this.root.domName?.
|
|
7826
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7923
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7924
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7827
7925
|
};
|
|
7828
7926
|
|
|
7829
7927
|
var container = document.createElement( "div" );
|
|
@@ -7905,8 +8003,8 @@ class Toggle extends Widget {
|
|
|
7905
8003
|
};
|
|
7906
8004
|
|
|
7907
8005
|
this.onResize = ( rect ) => {
|
|
7908
|
-
const realNameWidth = ( this.root.domName?.
|
|
7909
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8006
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8007
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7910
8008
|
};
|
|
7911
8009
|
|
|
7912
8010
|
var container = document.createElement('div');
|
|
@@ -8088,8 +8186,8 @@ class ColorInput extends Widget {
|
|
|
8088
8186
|
};
|
|
8089
8187
|
|
|
8090
8188
|
this.onResize = ( rect ) => {
|
|
8091
|
-
const realNameWidth = ( this.root.domName?.
|
|
8092
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8189
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8190
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8093
8191
|
};
|
|
8094
8192
|
|
|
8095
8193
|
var container = document.createElement( 'span' );
|
|
@@ -8179,8 +8277,8 @@ class RangeInput extends Widget {
|
|
|
8179
8277
|
};
|
|
8180
8278
|
|
|
8181
8279
|
this.onResize = ( rect ) => {
|
|
8182
|
-
const realNameWidth = ( this.root.domName?.
|
|
8183
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8280
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8281
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8184
8282
|
};
|
|
8185
8283
|
|
|
8186
8284
|
const container = document.createElement( 'div' );
|
|
@@ -8293,8 +8391,8 @@ class NumberInput extends Widget {
|
|
|
8293
8391
|
};
|
|
8294
8392
|
|
|
8295
8393
|
this.onResize = ( rect ) => {
|
|
8296
|
-
const realNameWidth = ( this.root.domName?.
|
|
8297
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8394
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8395
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8298
8396
|
};
|
|
8299
8397
|
|
|
8300
8398
|
var container = document.createElement( 'div' );
|
|
@@ -8529,8 +8627,8 @@ class Vector extends Widget {
|
|
|
8529
8627
|
};
|
|
8530
8628
|
|
|
8531
8629
|
this.onResize = ( rect ) => {
|
|
8532
|
-
const realNameWidth = ( this.root.domName?.
|
|
8533
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8630
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8631
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8534
8632
|
};
|
|
8535
8633
|
|
|
8536
8634
|
const vectorInputs = [];
|
|
@@ -8883,8 +8981,8 @@ class OTPInput extends Widget {
|
|
|
8883
8981
|
};
|
|
8884
8982
|
|
|
8885
8983
|
this.onResize = ( rect ) => {
|
|
8886
|
-
const realNameWidth = ( this.root.domName?.
|
|
8887
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8984
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8985
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8888
8986
|
};
|
|
8889
8987
|
|
|
8890
8988
|
this.disabled = options.disabled ?? false;
|
|
@@ -9029,8 +9127,8 @@ class Pad extends Widget {
|
|
|
9029
9127
|
};
|
|
9030
9128
|
|
|
9031
9129
|
this.onResize = ( rect ) => {
|
|
9032
|
-
const realNameWidth = ( this.root.domName?.
|
|
9033
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9130
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9131
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9034
9132
|
};
|
|
9035
9133
|
|
|
9036
9134
|
var container = document.createElement( 'div' );
|
|
@@ -9149,8 +9247,8 @@ class Progress extends Widget {
|
|
|
9149
9247
|
};
|
|
9150
9248
|
|
|
9151
9249
|
this.onResize = ( rect ) => {
|
|
9152
|
-
const realNameWidth = ( this.root.domName?.
|
|
9153
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9250
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9251
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9154
9252
|
};
|
|
9155
9253
|
|
|
9156
9254
|
const container = document.createElement('div');
|
|
@@ -9276,8 +9374,8 @@ class FileInput extends Widget {
|
|
|
9276
9374
|
let read = options.read ?? true;
|
|
9277
9375
|
|
|
9278
9376
|
this.onResize = ( rect ) => {
|
|
9279
|
-
const realNameWidth = ( this.root.domName?.
|
|
9280
|
-
input.style.width = `calc( 100% - ${ realNameWidth }
|
|
9377
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9378
|
+
input.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9281
9379
|
};
|
|
9282
9380
|
|
|
9283
9381
|
// Create hidden input
|
|
@@ -9603,8 +9701,8 @@ class Table extends Widget {
|
|
|
9603
9701
|
super( Widget.TABLE, name, null, options );
|
|
9604
9702
|
|
|
9605
9703
|
this.onResize = ( rect ) => {
|
|
9606
|
-
const realNameWidth = ( this.root.domName?.
|
|
9607
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9704
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9705
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9608
9706
|
};
|
|
9609
9707
|
|
|
9610
9708
|
const container = document.createElement('div');
|
|
@@ -12355,12 +12453,6 @@ class CanvasCurve {
|
|
|
12355
12453
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12356
12454
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12357
12455
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12358
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12359
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12360
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12361
|
-
{
|
|
12362
|
-
canvas.width = rect.width;
|
|
12363
|
-
}
|
|
12364
12456
|
|
|
12365
12457
|
var ctx = canvas.getContext( "2d" );
|
|
12366
12458
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|
|
@@ -12695,12 +12787,6 @@ class CanvasDial {
|
|
|
12695
12787
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12696
12788
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12697
12789
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12698
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12699
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12700
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12701
|
-
{
|
|
12702
|
-
canvas.width = rect.width;
|
|
12703
|
-
}
|
|
12704
12790
|
|
|
12705
12791
|
var ctx = canvas.getContext( "2d" );
|
|
12706
12792
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|