lexgui 0.1.12 → 0.1.14
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/codeeditor.js +412 -224
- package/build/components/timeline.js +105 -73
- package/build/lexgui.css +38 -10
- package/build/lexgui.js +43 -33
- package/build/lexgui.module.js +43 -32
- package/demo.js +3 -0
- package/examples/code_editor.html +3 -1
- package/package.json +1 -1
|
@@ -69,7 +69,7 @@ class Timeline {
|
|
|
69
69
|
this.currentScroll = 0; //in percentage
|
|
70
70
|
this.currentScrollInPixels = 0; //in pixels
|
|
71
71
|
this.scrollableHeight = this.size[1]; //true height of the timeline content
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
this.secondsToPixels = this.canvas.width/this.duration;
|
|
74
74
|
this.pixelsToSeconds = 1 / this.secondsToPixels;
|
|
75
75
|
this.selectedItems = options.selectedItems ?? null;
|
|
@@ -145,7 +145,7 @@ class Timeline {
|
|
|
145
145
|
LX.DEFAULT_NAME_WIDTH = "50%";
|
|
146
146
|
header.sameLine();
|
|
147
147
|
header.addTitle(this.name);
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
header.addNumber("Current Time", this.currentTime, (value, event) => {
|
|
150
150
|
if(value > this.duration) {
|
|
151
151
|
value = this.duration;
|
|
@@ -236,7 +236,7 @@ class Timeline {
|
|
|
236
236
|
'callback': (el, node) => {
|
|
237
237
|
// TO DO (apply functionality)
|
|
238
238
|
let value = el.classList.contains('fa-lock');
|
|
239
|
-
|
|
239
|
+
|
|
240
240
|
if(value) {
|
|
241
241
|
el.title = 'Lock edition';
|
|
242
242
|
el.classList.remove('fa-lock');
|
|
@@ -260,7 +260,7 @@ class Timeline {
|
|
|
260
260
|
this.onLockTrack(el, track, node)
|
|
261
261
|
this.draw();
|
|
262
262
|
}
|
|
263
|
-
|
|
263
|
+
|
|
264
264
|
}]})
|
|
265
265
|
// panel.addTitle(track.name + (track.type? '(' + track.type + ')' : ''));
|
|
266
266
|
}
|
|
@@ -284,9 +284,9 @@ class Timeline {
|
|
|
284
284
|
panel.attach(p.root)
|
|
285
285
|
p.root.style.overflowY = "scroll";
|
|
286
286
|
p.root.addEventListener("scroll", (e) => {
|
|
287
|
-
|
|
287
|
+
|
|
288
288
|
this.currentScroll = e.currentTarget.scrollTop/(e.currentTarget.scrollHeight - e.currentTarget.clientHeight);
|
|
289
|
-
|
|
289
|
+
})
|
|
290
290
|
// for(let i = 0; i < this.animationClip.tracks.length; i++) {
|
|
291
291
|
// let track = this.animationClip.tracks[i];
|
|
292
292
|
// panel.addTitle(track.name + (track.type? '(' + track.type + ')' : ''));
|
|
@@ -751,7 +751,7 @@ class Timeline {
|
|
|
751
751
|
// if(!this.grabbing_timeline && !this.movingKeys)
|
|
752
752
|
// this.canvas.style.cursor = "default";
|
|
753
753
|
|
|
754
|
-
|
|
754
|
+
|
|
755
755
|
let timeX = this.timeToX( this.currentTime );
|
|
756
756
|
let current_grabbing_timeline = localY < this.topMargin && localX > this.session.left_margin &&
|
|
757
757
|
localX > (timeX - 6) && localX < (timeX + 6);
|
|
@@ -761,7 +761,7 @@ class Timeline {
|
|
|
761
761
|
else if(this.movingKeys) {
|
|
762
762
|
this.canvas.style.cursor = "grabbing";
|
|
763
763
|
}
|
|
764
|
-
|
|
764
|
+
else
|
|
765
765
|
this.canvas.style.cursor = "default";
|
|
766
766
|
|
|
767
767
|
if( e.type == "wheel" ) {
|
|
@@ -787,7 +787,7 @@ class Timeline {
|
|
|
787
787
|
for(var i = this.tracksDrawn.length - 1; i >= 0; --i)
|
|
788
788
|
{
|
|
789
789
|
var t = this.tracksDrawn[i];
|
|
790
|
-
if( localY >= t[1] && localY < (t[1] + t[2]) )
|
|
790
|
+
if( t[1] >= this.topMargin && localY >= t[1] && localY < (t[1] + t[2]) )
|
|
791
791
|
{
|
|
792
792
|
track = t[0];
|
|
793
793
|
break;
|
|
@@ -798,7 +798,7 @@ class Timeline {
|
|
|
798
798
|
e.localX = localX;
|
|
799
799
|
e.localY = localY;
|
|
800
800
|
|
|
801
|
-
|
|
801
|
+
|
|
802
802
|
|
|
803
803
|
const innerSetTime = (t) => {
|
|
804
804
|
LX.emit( "@on_current_time_" + this.constructor.name, t);
|
|
@@ -820,10 +820,6 @@ class Timeline {
|
|
|
820
820
|
const discard = this.movingKeys || (LX.UTILS.getTime() - this.clickTime) > 420; // ms
|
|
821
821
|
this.movingKeys ? innerSetTime( this.currentTime ) : 0;
|
|
822
822
|
|
|
823
|
-
if(e.button == 0 && this.grabbing && this.onClipMoved && this.lastClipsSelected.length){
|
|
824
|
-
this.onClipMoved(this.lastClipsSelected);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
823
|
this.grabbing_timeline = false;
|
|
828
824
|
this.grabbing = false;
|
|
829
825
|
this.grabbingScroll = false;
|
|
@@ -1055,7 +1051,7 @@ class Timeline {
|
|
|
1055
1051
|
let trackAlpha = 1;
|
|
1056
1052
|
|
|
1057
1053
|
if(clips) {
|
|
1058
|
-
|
|
1054
|
+
|
|
1059
1055
|
for(var j = 0; j < clips.length; ++j)
|
|
1060
1056
|
{
|
|
1061
1057
|
selectedClipArea = null;
|
|
@@ -1073,10 +1069,10 @@ class Timeline {
|
|
|
1073
1069
|
ctx.fillStyle = clip.clipColor || "#5e9fdd"//#333";
|
|
1074
1070
|
//ctx.fillRect(x,y,w,trackHeight);
|
|
1075
1071
|
ctx.roundRect( x, y + offset, w, trackHeight , 5, true);
|
|
1076
|
-
|
|
1072
|
+
|
|
1077
1073
|
let fadeinX = this.secondsToPixels * ((clip.fadein || 0) - clip.start);
|
|
1078
1074
|
let fadeoutX = this.secondsToPixels * (clip.start + clip.duration - (clip.fadeout || (clip.start + clip.duration)));
|
|
1079
|
-
|
|
1075
|
+
|
|
1080
1076
|
let color = LX.UTILS.HexToRgb(ctx.fillStyle);
|
|
1081
1077
|
color = color.map(x => x*=0.8);
|
|
1082
1078
|
ctx.fillStyle = 'rgba(' + color.join(',') + ', 0.8)';
|
|
@@ -1085,7 +1081,7 @@ class Timeline {
|
|
|
1085
1081
|
ctx.roundRect(x, y + offset, fadeinX, trackHeight, {tl: 5, bl: 5, tr:0, br:0}, true);
|
|
1086
1082
|
if(fadeoutX)
|
|
1087
1083
|
ctx.roundRect( x + w - fadeoutX, y + offset, fadeoutX, trackHeight, {tl: 0, bl: 0, tr:5, br:5}, true);
|
|
1088
|
-
|
|
1084
|
+
|
|
1089
1085
|
//draw clip outline
|
|
1090
1086
|
if(clip.hidden)
|
|
1091
1087
|
ctx.globalAlpha = trackAlpha * 0.5;
|
|
@@ -1214,7 +1210,7 @@ class Timeline {
|
|
|
1214
1210
|
if(tracks[i].type != type && tracks.length > 1)
|
|
1215
1211
|
continue;
|
|
1216
1212
|
this.tracksPerItem[name][i].hide = hide;
|
|
1217
|
-
|
|
1213
|
+
// trackInfo = this.tracksPerItem[name][i];
|
|
1218
1214
|
}
|
|
1219
1215
|
}
|
|
1220
1216
|
|
|
@@ -1242,7 +1238,7 @@ class Timeline {
|
|
|
1242
1238
|
this.resizeCanvas([w , size[1]]);
|
|
1243
1239
|
|
|
1244
1240
|
// this.session.start_time = 0;
|
|
1245
|
-
|
|
1241
|
+
|
|
1246
1242
|
|
|
1247
1243
|
}
|
|
1248
1244
|
|
|
@@ -1541,7 +1537,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1541
1537
|
title: "Copy",// + " <i class='bi bi-clipboard-fill float-right'></i>",
|
|
1542
1538
|
callback: () => {
|
|
1543
1539
|
this.copyContent();
|
|
1544
|
-
|
|
1540
|
+
|
|
1545
1541
|
}
|
|
1546
1542
|
}
|
|
1547
1543
|
)
|
|
@@ -1613,7 +1609,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1613
1609
|
}
|
|
1614
1610
|
offset += offsetI * height + height;
|
|
1615
1611
|
}
|
|
1616
|
-
|
|
1612
|
+
|
|
1617
1613
|
ctx.restore();
|
|
1618
1614
|
};
|
|
1619
1615
|
|
|
@@ -1704,7 +1700,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1704
1700
|
|
|
1705
1701
|
track.optimize( this.optimizeThreshold );
|
|
1706
1702
|
if(this.onOptimizeTracks)
|
|
1707
|
-
|
|
1703
|
+
this.onOptimizeTracks(trackIdx);
|
|
1708
1704
|
}
|
|
1709
1705
|
}
|
|
1710
1706
|
|
|
@@ -1905,7 +1901,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1905
1901
|
return this.clipboard != null;
|
|
1906
1902
|
}
|
|
1907
1903
|
|
|
1908
|
-
|
|
1904
|
+
#paste( track, index ) {
|
|
1909
1905
|
|
|
1910
1906
|
let clipboardInfo = this.clipboard.value;
|
|
1911
1907
|
|
|
@@ -1931,7 +1927,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1931
1927
|
this.saveState(track.clipIdx);
|
|
1932
1928
|
|
|
1933
1929
|
// Copy to current key
|
|
1934
|
-
this
|
|
1930
|
+
this.#paste( track, index );
|
|
1935
1931
|
|
|
1936
1932
|
if(!e.multipleSelection)
|
|
1937
1933
|
return;
|
|
@@ -1941,7 +1937,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1941
1937
|
|
|
1942
1938
|
// Copy to every selected key
|
|
1943
1939
|
for(let [name, idx, keyIndex] of this.lastKeyFramesSelected) {
|
|
1944
|
-
this
|
|
1940
|
+
this.#paste( this.tracksPerItem[name][idx], keyIndex );
|
|
1945
1941
|
}
|
|
1946
1942
|
}
|
|
1947
1943
|
|
|
@@ -1970,7 +1966,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
1970
1966
|
|
|
1971
1967
|
// Copy to every selected key
|
|
1972
1968
|
for(let [name, idx, keyIndex] of this.lastKeyFramesSelected) {
|
|
1973
|
-
this
|
|
1969
|
+
this.#paste( this.tracksPerItem[name][idx], keyIndex );
|
|
1974
1970
|
}
|
|
1975
1971
|
}
|
|
1976
1972
|
|
|
@@ -2023,7 +2019,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2023
2019
|
}
|
|
2024
2020
|
|
|
2025
2021
|
this.animationClip.tracks[clipIdx].times = new Float32Array( timesArray );
|
|
2026
|
-
|
|
2022
|
+
|
|
2027
2023
|
// Add values
|
|
2028
2024
|
let valuesArray = [];
|
|
2029
2025
|
let dim = value.length;
|
|
@@ -2074,7 +2070,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2074
2070
|
* @track: track that keyframe belongs to
|
|
2075
2071
|
* @index: index of the keyframe on the track
|
|
2076
2072
|
*/
|
|
2077
|
-
|
|
2073
|
+
#delete( track, index ) {
|
|
2078
2074
|
|
|
2079
2075
|
// Don't remove by now the first key
|
|
2080
2076
|
if(index == 0) {
|
|
@@ -2142,7 +2138,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2142
2138
|
// Delete every selected key
|
|
2143
2139
|
for(let [name, idx, keyIndex] of pts) {
|
|
2144
2140
|
this.saveState(this.tracksPerItem[name][idx].clipIdx);
|
|
2145
|
-
deletedIndices += this
|
|
2141
|
+
deletedIndices += this.#delete( this.tracksPerItem[name][idx], keyIndex - deletedIndices );
|
|
2146
2142
|
}
|
|
2147
2143
|
}
|
|
2148
2144
|
}
|
|
@@ -2157,7 +2153,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2157
2153
|
|
|
2158
2154
|
if ( track ){
|
|
2159
2155
|
this.saveState(track.clipIdx);
|
|
2160
|
-
this
|
|
2156
|
+
this.#delete( track, index );
|
|
2161
2157
|
}
|
|
2162
2158
|
}
|
|
2163
2159
|
|
|
@@ -2362,7 +2358,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2362
2358
|
for(let i = count - 1; i >= 0; i--)
|
|
2363
2359
|
{
|
|
2364
2360
|
this.saveState(track.clipIdx);
|
|
2365
|
-
this
|
|
2361
|
+
this.#delete(track, i );
|
|
2366
2362
|
}
|
|
2367
2363
|
if(defaultValue != undefined) {
|
|
2368
2364
|
if(typeof(defaultValue) == 'number') {
|
|
@@ -2428,7 +2424,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2428
2424
|
}
|
|
2429
2425
|
|
|
2430
2426
|
this.draw(this.currentTime);
|
|
2431
|
-
|
|
2427
|
+
|
|
2432
2428
|
}
|
|
2433
2429
|
|
|
2434
2430
|
onMouseUp( e ) {
|
|
@@ -2539,10 +2535,12 @@ class ClipsTimeline extends Timeline {
|
|
|
2539
2535
|
//this.addUndoStep( "clip_modified", clip );
|
|
2540
2536
|
if( (e.ctrlKey && distToStart < 5) || (clip.fadein && Math.abs( this.timeToX( clip.start + clip.fadein ) - e.offsetX ) < 5) )
|
|
2541
2537
|
this.dragClipMode = "fadein";
|
|
2542
|
-
else if(
|
|
2543
|
-
this.dragClipMode = "fadeout";
|
|
2544
|
-
else if( Math.abs( endingX - x ) < 10 )
|
|
2538
|
+
else if(e.ctrlKey && Math.abs( endingX - x ) < 5 ) {
|
|
2545
2539
|
this.dragClipMode = "duration";
|
|
2540
|
+
this.canvas.style.cursor = "column-resize";
|
|
2541
|
+
}
|
|
2542
|
+
else if( (e.ctrlKey && distToEnd < 10) || (clip.fadeout && Math.abs( this.timeToX( clip.start + clip.duration - clip.fadeout ) - e.offsetX ) < 5) )
|
|
2543
|
+
this.dragClipMode = "fadeout";
|
|
2546
2544
|
else
|
|
2547
2545
|
this.dragClipMode = "move";
|
|
2548
2546
|
}
|
|
@@ -2588,7 +2586,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2588
2586
|
var curr = time - this.currentTime;
|
|
2589
2587
|
var delta = curr - this.grabTime;
|
|
2590
2588
|
this.grabTime = curr;
|
|
2591
|
-
|
|
2589
|
+
|
|
2592
2590
|
var ct = Math.max(0,this.currentTime - delta);
|
|
2593
2591
|
if( this.timelineClickedClips != undefined) {
|
|
2594
2592
|
this.movingKeys = true;
|
|
@@ -2615,7 +2613,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2615
2613
|
// for(let i = 0; i < tracks.length; i++) {
|
|
2616
2614
|
let clips = this.getClipsInRange(e.track, clip.start, clip.start + clip.duration, 0.01)
|
|
2617
2615
|
if(clips == undefined || !clips.length) {
|
|
2618
|
-
|
|
2616
|
+
// let newClip = Object.assign({}, clip);
|
|
2619
2617
|
let clipIndex = this.addClipInTrack(clip, e.track.idx);
|
|
2620
2618
|
this.deleteClip(clip);
|
|
2621
2619
|
e.track.selected[clipIndex] = true;
|
|
@@ -2630,11 +2628,16 @@ class ClipsTimeline extends Timeline {
|
|
|
2630
2628
|
}
|
|
2631
2629
|
}
|
|
2632
2630
|
else if( this.dragClipMode == "fadein" )
|
|
2633
|
-
clip.fadein = Math.min(Math.max((clip.fadein || 0) +
|
|
2631
|
+
clip.fadein = Math.min(Math.max((clip.fadein || 0) + delta, clip.start), clip.start+clip.duration);
|
|
2634
2632
|
else if( this.dragClipMode == "fadeout" )
|
|
2635
|
-
clip.fadeout = Math.max(Math.min((clip.fadeout || clip.start+clip.duration) +
|
|
2636
|
-
else if( this.dragClipMode == "duration" )
|
|
2637
|
-
clip.duration +=
|
|
2633
|
+
clip.fadeout = Math.max(Math.min((clip.fadeout || clip.start+clip.duration) + delta, clip.start+clip.duration), clip.start);
|
|
2634
|
+
else if( this.dragClipMode == "duration" ) {
|
|
2635
|
+
clip.duration += delta;
|
|
2636
|
+
clip.fadeout += delta;
|
|
2637
|
+
if(this.onContentMoved) {
|
|
2638
|
+
this.onContentMoved(clip, 0);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2638
2641
|
|
|
2639
2642
|
if(this.duration < clip.start + clip.duration )
|
|
2640
2643
|
{
|
|
@@ -2646,6 +2649,14 @@ class ClipsTimeline extends Timeline {
|
|
|
2646
2649
|
else{
|
|
2647
2650
|
innerSetTime( this.currentTime );
|
|
2648
2651
|
}
|
|
2652
|
+
}
|
|
2653
|
+
else if(e.track && e.ctrlKey) {
|
|
2654
|
+
for(let i = 0; i < e.track.clips.length; i++) {
|
|
2655
|
+
let clip = e.track.clips[i];
|
|
2656
|
+
const x = this.timeToX(clip.start+clip.duration);
|
|
2657
|
+
if(Math.abs(e.localX - x) < 5)
|
|
2658
|
+
this.canvas.style.cursor = "col-resize";
|
|
2659
|
+
}
|
|
2649
2660
|
}
|
|
2650
2661
|
}
|
|
2651
2662
|
|
|
@@ -2716,7 +2727,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2716
2727
|
let tracks = this.animationClip.tracks|| [{name: "NMF", clips: []}];
|
|
2717
2728
|
if(!tracks)
|
|
2718
2729
|
return;
|
|
2719
|
-
|
|
2730
|
+
|
|
2720
2731
|
const height = this.trackHeight;
|
|
2721
2732
|
|
|
2722
2733
|
this.scrollableHeight = (tracks.length)*height + this.topMargin;
|
|
@@ -2729,7 +2740,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2729
2740
|
}
|
|
2730
2741
|
|
|
2731
2742
|
ctx.restore();
|
|
2732
|
-
|
|
2743
|
+
|
|
2733
2744
|
}
|
|
2734
2745
|
|
|
2735
2746
|
// Creates a map for each item -> tracks
|
|
@@ -2907,8 +2918,8 @@ class ClipsTimeline extends Timeline {
|
|
|
2907
2918
|
this.setDuration(end);
|
|
2908
2919
|
}
|
|
2909
2920
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2921
|
+
// // Update animation action interpolation info
|
|
2922
|
+
if(this.onUpdateTrack)
|
|
2912
2923
|
this.onUpdateTrack( trackIdx );
|
|
2913
2924
|
|
|
2914
2925
|
LX.emit( "@on_current_time_" + this.constructor.name, this.currentTime);
|
|
@@ -2925,13 +2936,13 @@ class ClipsTimeline extends Timeline {
|
|
|
2925
2936
|
return newIdx;
|
|
2926
2937
|
}
|
|
2927
2938
|
|
|
2928
|
-
|
|
2939
|
+
/** Add a clip to the timeline in a free track slot at the current time
|
|
2929
2940
|
* @clip: clip to be added
|
|
2930
2941
|
* @trackIdx: track index where to add the track
|
|
2931
2942
|
* @offsetTime: (optional) offset time of current time
|
|
2932
2943
|
* @callback: (optional) function to call after adding the clip
|
|
2933
2944
|
*/
|
|
2934
|
-
|
|
2945
|
+
addClipInTrack( clip, trackIdx, offsetTime = 0, callback = null ) {
|
|
2935
2946
|
|
|
2936
2947
|
// Time slot with other clip?
|
|
2937
2948
|
if(!this.animationClip)
|
|
@@ -2969,7 +2980,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2969
2980
|
track.selected[newIdx] = undefined;
|
|
2970
2981
|
track.edited[newIdx] = undefined;
|
|
2971
2982
|
|
|
2972
|
-
|
|
2983
|
+
|
|
2973
2984
|
let end = clip.start + clip.duration;
|
|
2974
2985
|
|
|
2975
2986
|
if( end > this.duration || !this.animationClip.duration)
|
|
@@ -2977,8 +2988,8 @@ class ClipsTimeline extends Timeline {
|
|
|
2977
2988
|
this.setDuration(end);
|
|
2978
2989
|
}
|
|
2979
2990
|
|
|
2980
|
-
|
|
2981
|
-
|
|
2991
|
+
// // Update animation action interpolation info
|
|
2992
|
+
if(this.onUpdateTrack)
|
|
2982
2993
|
this.onUpdateTrack( trackIdx );
|
|
2983
2994
|
|
|
2984
2995
|
LX.emit( "@on_current_time_" + this.constructor.name, this.currentTime);
|
|
@@ -2996,7 +3007,7 @@ class ClipsTimeline extends Timeline {
|
|
|
2996
3007
|
* @callback: (optional) function to call after adding the clip
|
|
2997
3008
|
*/
|
|
2998
3009
|
addClips( clips, offsetTime = 0, callback = null ) {
|
|
2999
|
-
|
|
3010
|
+
|
|
3000
3011
|
if(!this.animationClip)
|
|
3001
3012
|
this.addNewTrack();
|
|
3002
3013
|
|
|
@@ -3025,7 +3036,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3025
3036
|
console.warn("There is already a clip stored in time slot ", clipInCurrentSlot)
|
|
3026
3037
|
if(!this.animationClip.tracks[i+1]) {
|
|
3027
3038
|
this.addNewTrack();
|
|
3028
|
-
|
|
3039
|
+
|
|
3029
3040
|
trackIdxs[c] = {trackIdx: i+1, stat: newStart, end: newStart + clip.duration};
|
|
3030
3041
|
}
|
|
3031
3042
|
else {
|
|
@@ -3192,7 +3203,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3192
3203
|
// Delete every selected clip
|
|
3193
3204
|
for(let [trackIdx, clipIdx] of pts) {
|
|
3194
3205
|
this.saveState(trackIdx, clipIdx);
|
|
3195
|
-
this
|
|
3206
|
+
this.#delete(trackIdx, clipIdx );
|
|
3196
3207
|
deletedIndices++;
|
|
3197
3208
|
}
|
|
3198
3209
|
}
|
|
@@ -3201,7 +3212,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3201
3212
|
const [trackIdx, clipIdx] = clip;
|
|
3202
3213
|
|
|
3203
3214
|
this.saveState(trackIdx, clipIdx);
|
|
3204
|
-
this
|
|
3215
|
+
this.#delete( trackIdx, clipIdx );
|
|
3205
3216
|
}
|
|
3206
3217
|
|
|
3207
3218
|
|
|
@@ -3215,7 +3226,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3215
3226
|
|
|
3216
3227
|
}
|
|
3217
3228
|
|
|
3218
|
-
|
|
3229
|
+
#delete( trackIdx, clipIdx) {
|
|
3219
3230
|
|
|
3220
3231
|
let clips = this.animationClip.tracks[trackIdx].clips;
|
|
3221
3232
|
if(clipIdx >= 0)
|
|
@@ -3310,8 +3321,16 @@ class ClipsTimeline extends Timeline {
|
|
|
3310
3321
|
clips: [],
|
|
3311
3322
|
selected: [], edited: [], hovered: []
|
|
3312
3323
|
};
|
|
3313
|
-
|
|
3324
|
+
//delete all selectedclips
|
|
3314
3325
|
this.animationClip.tracks[idx] = trackInfo;
|
|
3326
|
+
let selected = [];
|
|
3327
|
+
for(let i = 0; i < this.lastClipsSelected.length; i++) {
|
|
3328
|
+
let [trackIdx, clipIdx] = this.lastClipsSelected[i];
|
|
3329
|
+
if(trackIdx != idx)
|
|
3330
|
+
selected.push(this.lastClipsSelected[i]);
|
|
3331
|
+
|
|
3332
|
+
}
|
|
3333
|
+
this.lastClipsSelected = selected;
|
|
3315
3334
|
return trackInfo.idx;
|
|
3316
3335
|
}
|
|
3317
3336
|
|
|
@@ -3376,6 +3395,19 @@ class ClipsTimeline extends Timeline {
|
|
|
3376
3395
|
return unselected;
|
|
3377
3396
|
}
|
|
3378
3397
|
|
|
3398
|
+
selectAll( ) {
|
|
3399
|
+
|
|
3400
|
+
this.unSelectAllClips();
|
|
3401
|
+
for(let idx = 0; idx < this.animationClip.tracks.length; idx++) {
|
|
3402
|
+
for(let clipIdx = 0; clipIdx < this.animationClip.tracks[idx].clips.length; clipIdx++) {
|
|
3403
|
+
this.animationClip.tracks[idx].selected[clipIdx] = true;
|
|
3404
|
+
let currentSelection = [ idx, clipIdx];
|
|
3405
|
+
this.lastClipsSelected.push( currentSelection );
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
if(this.onSelectClip)
|
|
3409
|
+
this.onSelectClip();
|
|
3410
|
+
}
|
|
3379
3411
|
processCurrentClip( e, clipIndex, track, localX, multiple ) {
|
|
3380
3412
|
|
|
3381
3413
|
e.multipleSelection = multiple;
|
|
@@ -3636,7 +3668,7 @@ class CurvesTimeline extends Timeline {
|
|
|
3636
3668
|
}
|
|
3637
3669
|
return
|
|
3638
3670
|
|
|
3639
|
-
|
|
3671
|
+
|
|
3640
3672
|
}
|
|
3641
3673
|
|
|
3642
3674
|
const removeHover = () => {
|
|
@@ -3763,7 +3795,7 @@ class CurvesTimeline extends Timeline {
|
|
|
3763
3795
|
// this.canvasArea.root.innerHtml = "";
|
|
3764
3796
|
let offset = this.trackHeight;
|
|
3765
3797
|
this.scrollableHeight = this.topMargin;
|
|
3766
|
-
|
|
3798
|
+
for(let t = 0; t < this.selectedItems.length; t++) {
|
|
3767
3799
|
let tracks = this.tracksPerItem[this.selectedItems[t]] ? this.tracksPerItem[this.selectedItems[t]] : [{name: this.selectedItems[t]}];
|
|
3768
3800
|
if(!tracks) continue;
|
|
3769
3801
|
|
|
@@ -3777,7 +3809,7 @@ class CurvesTimeline extends Timeline {
|
|
|
3777
3809
|
if(track.hide) {
|
|
3778
3810
|
continue;
|
|
3779
3811
|
}
|
|
3780
|
-
|
|
3812
|
+
|
|
3781
3813
|
this.drawTrackWithCurves(ctx, offsetI * height + offset + scroll_y, height, track.name + " (" + track.type + ")", this.animationClip.tracks[track.clipIdx], track);
|
|
3782
3814
|
offsetI++;
|
|
3783
3815
|
}
|
|
@@ -3817,7 +3849,7 @@ class CurvesTimeline extends Timeline {
|
|
|
3817
3849
|
|
|
3818
3850
|
ctx.save();
|
|
3819
3851
|
ctx.translate(keyframePosX, y );
|
|
3820
|
-
|
|
3852
|
+
|
|
3821
3853
|
if( keyframePosX <= this.sidebarWidth ){
|
|
3822
3854
|
ctx.moveTo( 0, value );
|
|
3823
3855
|
}
|
|
@@ -4121,7 +4153,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4121
4153
|
}
|
|
4122
4154
|
|
|
4123
4155
|
|
|
4124
|
-
|
|
4156
|
+
#paste( track, index ) {
|
|
4125
4157
|
|
|
4126
4158
|
let clipboardInfo = this.clipboard.value;
|
|
4127
4159
|
|
|
@@ -4148,7 +4180,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4148
4180
|
this.saveState(track.clipIdx);
|
|
4149
4181
|
|
|
4150
4182
|
// Copy to current key
|
|
4151
|
-
this
|
|
4183
|
+
this.#paste( track, index );
|
|
4152
4184
|
|
|
4153
4185
|
if(!e.multipleSelection)
|
|
4154
4186
|
return;
|
|
@@ -4158,7 +4190,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4158
4190
|
|
|
4159
4191
|
// Copy to every selected key
|
|
4160
4192
|
for(let [name, idx, keyIndex] of this.lastKeyFramesSelected) {
|
|
4161
|
-
this
|
|
4193
|
+
this.#paste( this.tracksPerItem[name][idx], keyIndex );
|
|
4162
4194
|
}
|
|
4163
4195
|
}
|
|
4164
4196
|
|
|
@@ -4167,7 +4199,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4167
4199
|
this.saveState(track.clipIdx);
|
|
4168
4200
|
|
|
4169
4201
|
// Copy to current key
|
|
4170
|
-
this
|
|
4202
|
+
this.#paste( track, index );
|
|
4171
4203
|
|
|
4172
4204
|
if(!e.multipleSelection)
|
|
4173
4205
|
return;
|
|
@@ -4177,7 +4209,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4177
4209
|
|
|
4178
4210
|
// Copy to every selected key
|
|
4179
4211
|
for(let [name, idx, keyIndex] of this.lastKeyFramesSelected) {
|
|
4180
|
-
this
|
|
4212
|
+
this.#paste( this.tracksPerItem[name][idx], keyIndex );
|
|
4181
4213
|
}
|
|
4182
4214
|
}
|
|
4183
4215
|
|
|
@@ -4249,7 +4281,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4249
4281
|
track.hovered[newIdx] = undefined;
|
|
4250
4282
|
track.selected[newIdx] = undefined;
|
|
4251
4283
|
track.edited[newIdx] = true;
|
|
4252
|
-
|
|
4284
|
+
|
|
4253
4285
|
|
|
4254
4286
|
// Update animation action interpolation info
|
|
4255
4287
|
if(this.onUpdateTrack)
|
|
@@ -4271,7 +4303,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4271
4303
|
* @track: track that keyframe belongs to
|
|
4272
4304
|
* @index: index of the keyframe on the track
|
|
4273
4305
|
*/
|
|
4274
|
-
|
|
4306
|
+
#delete( track, index ) {
|
|
4275
4307
|
|
|
4276
4308
|
// Don't remove by now the first key
|
|
4277
4309
|
if(index == 0) {
|
|
@@ -4339,7 +4371,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4339
4371
|
// Delete every selected key
|
|
4340
4372
|
for(let [name, idx, keyIndex] of pts) {
|
|
4341
4373
|
this.saveState(this.tracksPerItem[name][idx].clipIdx);
|
|
4342
|
-
let deleted = this
|
|
4374
|
+
let deleted = this.#delete( this.tracksPerItem[name][idx], keyIndex - deletedIndices );
|
|
4343
4375
|
deletedIndices += deleted ? 1 : 0;
|
|
4344
4376
|
}
|
|
4345
4377
|
}
|
|
@@ -4355,7 +4387,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4355
4387
|
|
|
4356
4388
|
if ( track ){
|
|
4357
4389
|
this.saveState(track.clipIdx);
|
|
4358
|
-
this
|
|
4390
|
+
this.#delete( track, index );
|
|
4359
4391
|
}
|
|
4360
4392
|
}
|
|
4361
4393
|
|
|
@@ -4379,7 +4411,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4379
4411
|
for(let i = count - 1; i >= 0; i--)
|
|
4380
4412
|
{
|
|
4381
4413
|
this.saveState(track.clipIdx);
|
|
4382
|
-
this
|
|
4414
|
+
this.#delete(track, i );
|
|
4383
4415
|
}
|
|
4384
4416
|
if(defaultValue != undefined) {
|
|
4385
4417
|
if(typeof(defaultValue) == 'number') {
|
|
@@ -4527,7 +4559,7 @@ class CurvesTimeline extends Timeline {
|
|
|
4527
4559
|
const name = this.tracksDictionary[track.fullname];
|
|
4528
4560
|
let t = this.tracksPerItem[ name ][track.idx];
|
|
4529
4561
|
let currentSelection = [name, track.idx, keyFrameIndex];
|
|
4530
|
-
|
|
4562
|
+
if(!multiple)
|
|
4531
4563
|
this.selectKeyFrame(t, currentSelection, keyFrameIndex);
|
|
4532
4564
|
else
|
|
4533
4565
|
this.lastKeyFramesSelected.push( currentSelection );
|
|
@@ -4599,7 +4631,7 @@ CanvasRenderingContext2D.prototype.roundRect = function(x, y, width, height, rad
|
|
|
4599
4631
|
this.fill();
|
|
4600
4632
|
}
|
|
4601
4633
|
if (stroke) {
|
|
4602
|
-
|
|
4634
|
+
this.stroke();
|
|
4603
4635
|
}
|
|
4604
4636
|
}
|
|
4605
4637
|
|
package/build/lexgui.css
CHANGED
|
@@ -2900,6 +2900,14 @@ ul.lexassetscontent {
|
|
|
2900
2900
|
margin: 0;
|
|
2901
2901
|
pointer-events: unset;
|
|
2902
2902
|
cursor: default;
|
|
2903
|
+
height: 18px;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
.lexcodeeditor .autocomplete pre a {
|
|
2907
|
+
font-size: 11px;
|
|
2908
|
+
margin-top: 4px;
|
|
2909
|
+
margin-right: 6px;
|
|
2910
|
+
margin-left: 2px;
|
|
2903
2911
|
}
|
|
2904
2912
|
|
|
2905
2913
|
.lexcodeeditor .autocomplete pre:hover {
|
|
@@ -2912,7 +2920,6 @@ ul.lexassetscontent {
|
|
|
2912
2920
|
}
|
|
2913
2921
|
|
|
2914
2922
|
.lexcodeeditor .autocomplete pre span {
|
|
2915
|
-
margin: 2px 0px;
|
|
2916
2923
|
cursor: inherit;
|
|
2917
2924
|
}
|
|
2918
2925
|
|
|
@@ -2924,15 +2931,26 @@ ul.lexassetscontent {
|
|
|
2924
2931
|
color: #95a0e1;
|
|
2925
2932
|
}
|
|
2926
2933
|
|
|
2927
|
-
.cm-str { color: #d0774e; } /* string */
|
|
2928
|
-
.cm-kwd { color: #218cce; } /* keyword */
|
|
2929
|
-
.cm-com { color: #5cab5a; } /* comment */
|
|
2930
|
-
.cm-typ { color: #36c0b0; } /* type */
|
|
2931
|
-
.cm-std { color: #cf6dcf; } /* statements & declarations */
|
|
2932
|
-
.cm-bln { color: inherit; } /* builtin */
|
|
2933
|
-
.cm-dec { color: #b1ce9b; } /* decimal */
|
|
2934
|
-
.cm-sym { color: #e7ded2; } /* symbol */
|
|
2935
|
-
.cm-mtd { color: #e0cc68 } /* method */
|
|
2934
|
+
.cm-str.javascript { color: #d0774e; } /* string */
|
|
2935
|
+
.cm-kwd.javascript { color: #218cce; } /* keyword */
|
|
2936
|
+
.cm-com.javascript { color: #5cab5a; } /* comment */
|
|
2937
|
+
.cm-typ.javascript { color: #36c0b0; } /* type */
|
|
2938
|
+
.cm-std.javascript { color: #cf6dcf; } /* statements & declarations */
|
|
2939
|
+
.cm-bln.javascript { color: inherit; } /* builtin */
|
|
2940
|
+
.cm-dec.javascript { color: #b1ce9b; } /* decimal */
|
|
2941
|
+
.cm-sym.javascript { color: #e7ded2; } /* symbol */
|
|
2942
|
+
.cm-mtd.javascript { color: #e0cc68 } /* method */
|
|
2943
|
+
|
|
2944
|
+
.cm-str.cpp { color: #d0774e; } /* string */
|
|
2945
|
+
.cm-kwd.cpp { color: #218cce; } /* keyword */
|
|
2946
|
+
.cm-com.cpp { color: #5cab5a; } /* comment */
|
|
2947
|
+
.cm-typ.cpp { color: #36c0b0; } /* type */
|
|
2948
|
+
.cm-std.cpp { color: #cf6dcf; } /* statements & declarations */
|
|
2949
|
+
.cm-bln.cpp { color: #d44141; } /* builtin */
|
|
2950
|
+
.cm-dec.cpp { color: #2ddf53; } /* decimal */
|
|
2951
|
+
.cm-sym.cpp { color: #e7ded2; } /* symbol */
|
|
2952
|
+
.cm-mtd.cpp { color: #7493d6 } /* method */
|
|
2953
|
+
.cm-ppc.cpp { color: #969696 } /* preprocessor */
|
|
2936
2954
|
|
|
2937
2955
|
.cm-str.css { color: #d0774e; } /* string */
|
|
2938
2956
|
.cm-kwd.css { color: #e8be53; } /* keyword */
|
|
@@ -2974,6 +2992,16 @@ ul.lexassetscontent {
|
|
|
2974
2992
|
.cm-sym.wgsl { color: #f9cb20; } /* symbol */
|
|
2975
2993
|
.cm-mtd.wgsl { color: #e0cc68; } /* method */
|
|
2976
2994
|
|
|
2995
|
+
.cm-str.python { color: #d0774e; } /* string */
|
|
2996
|
+
.cm-kwd.python { color: #218cce; } /* keyword */
|
|
2997
|
+
.cm-com.python { color: #5cab5a; } /* comment */
|
|
2998
|
+
.cm-typ.python { color: #36c0b0; } /* type */
|
|
2999
|
+
.cm-std.python { color: #cf6dcf; } /* statements & declarations */
|
|
3000
|
+
.cm-bln.python { color: inherit; } /* builtin */
|
|
3001
|
+
.cm-dec.python { color: #b1ce9b; } /* decimal */
|
|
3002
|
+
.cm-sym.python { color: #e7ded2; } /* symbol */
|
|
3003
|
+
.cm-mtd.python { color: #e0cc68 } /* method */
|
|
3004
|
+
|
|
2977
3005
|
/* plain color */
|
|
2978
3006
|
.cm-str.plaintext, .cm-kwd.plaintext, .cm-com.plaintext, .cm-typ.plaintext, .cm-std.plaintext,
|
|
2979
3007
|
.cm-bln.plaintext, .cm-dec.plaintext, .cm-sym.plaintext, .cm-mtd.plaintext { color: inherit; }
|