lexgui 8.1.1 → 8.2.0

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.
Files changed (52) hide show
  1. package/build/components/Avatar.d.ts +15 -0
  2. package/build/components/NodeTree.d.ts +51 -26
  3. package/build/components/Vector.d.ts +10 -9
  4. package/build/core/Event.d.ts +6 -26
  5. package/build/core/Namespace.js +1 -1
  6. package/build/core/Namespace.js.map +1 -1
  7. package/build/core/Panel.d.ts +538 -538
  8. package/build/extensions/AssetView.d.ts +7 -6
  9. package/build/extensions/AssetView.js +194 -155
  10. package/build/extensions/AssetView.js.map +1 -1
  11. package/build/extensions/Audio.js.map +1 -1
  12. package/build/extensions/CodeEditor.d.ts +358 -350
  13. package/build/extensions/CodeEditor.js +5054 -5022
  14. package/build/extensions/CodeEditor.js.map +1 -1
  15. package/build/extensions/DocMaker.js +330 -327
  16. package/build/extensions/DocMaker.js.map +1 -1
  17. package/build/extensions/GraphEditor.js +2754 -2760
  18. package/build/extensions/GraphEditor.js.map +1 -1
  19. package/build/extensions/Timeline.d.ts +668 -670
  20. package/build/extensions/Timeline.js +3948 -3955
  21. package/build/extensions/Timeline.js.map +1 -1
  22. package/build/extensions/VideoEditor.d.ts +128 -128
  23. package/build/extensions/VideoEditor.js +893 -898
  24. package/build/extensions/VideoEditor.js.map +1 -1
  25. package/build/index.css.d.ts +3 -4
  26. package/build/index.d.ts +57 -56
  27. package/build/lexgui.all.js +1587 -1369
  28. package/build/lexgui.all.js.map +1 -1
  29. package/build/lexgui.all.min.js +1 -1
  30. package/build/lexgui.all.module.js +1584 -1364
  31. package/build/lexgui.all.module.js.map +1 -1
  32. package/build/lexgui.all.module.min.js +1 -1
  33. package/build/lexgui.css +6157 -5583
  34. package/build/lexgui.js +977 -815
  35. package/build/lexgui.js.map +1 -1
  36. package/build/lexgui.min.css +2 -3
  37. package/build/lexgui.min.js +1 -1
  38. package/build/lexgui.module.js +975 -811
  39. package/build/lexgui.module.js.map +1 -1
  40. package/build/lexgui.module.min.js +1 -1
  41. package/changelog.md +52 -1
  42. package/demo.js +167 -65
  43. package/examples/all-components.html +38 -52
  44. package/examples/asset-view.html +27 -0
  45. package/examples/code-editor.html +1 -1
  46. package/examples/editor.html +10 -95
  47. package/examples/index.html +2 -2
  48. package/examples/side-bar.html +1 -1
  49. package/examples/timeline.html +2 -2
  50. package/examples/video-editor.html +1 -1
  51. package/examples/video-editor2.html +2 -2
  52. package/package.json +7 -4
@@ -1,670 +1,668 @@
1
- declare const Area: any;
2
- declare const Panel: any;
3
- declare const Dialog: any;
4
- declare const TreeEvent: any;
5
- type Nullable<T> = T | null | undefined;
6
- /**
7
- * @class Timeline
8
- * @description Agnostic timeline, do not impose any timeline content. Renders to a canvas
9
- */
10
- export declare abstract class Timeline {
11
- #private;
12
- static BACKGROUND_COLOR: string;
13
- static TRACK_COLOR_PRIMARY: string;
14
- static TRACK_COLOR_SECONDARY: string;
15
- static TRACK_COLOR_TERCIARY: string;
16
- static TRACK_COLOR_QUATERNARY: string;
17
- static TRACK_SELECTED: string;
18
- static TRACK_SELECTED_LIGHT: string;
19
- static FONT: string;
20
- static FONT_COLOR_PRIMARY: string;
21
- static FONT_COLOR_TERTIARY: string;
22
- static FONT_COLOR_QUATERNARY: string;
23
- static KEYFRAME_COLOR: string;
24
- static KEYFRAME_COLOR_HOVERED: string;
25
- static KEYFRAME_COLOR_SELECTED: string;
26
- static KEYFRAME_COLOR_LOCK: string;
27
- static KEYFRAME_COLOR_EDITED: string;
28
- static KEYFRAME_COLOR_INACTIVE: string;
29
- static TIME_MARKER_COLOR: string;
30
- static TIME_MARKER_COLOR_TEXT: string;
31
- static BOX_SELECTION_COLOR: string;
32
- uniqueID: string;
33
- timelineTitle: string;
34
- animationClip: any;
35
- duration: number;
36
- currentTime: number;
37
- visualTimeRange: [number, number];
38
- visualOriginTime: number;
39
- pixelsPerSecond: number;
40
- secondsPerPixel: number;
41
- clickTime: number;
42
- clickDiscardTimeout: number;
43
- lastMouse: [number, number];
44
- boxSelection: boolean;
45
- boxSelectionStart: [number, number];
46
- boxSelectionEnd: [number, number];
47
- historyUndo: Array<any>;
48
- historyRedo: Array<any>;
49
- historySaveEnabler: boolean;
50
- historyMaxSteps: number;
51
- clipboard: any;
52
- grabbing: boolean;
53
- grabTime: number;
54
- grabbingTimeBar: boolean;
55
- grabbingScroll: boolean;
56
- movingKeys: boolean;
57
- timeBeforeMove: number;
58
- currentScroll: number;
59
- currentScrollInPixels: number;
60
- trackHeight: number;
61
- timeSeparators: number[];
62
- playing: boolean;
63
- loop: boolean;
64
- active: boolean;
65
- skipVisibility: boolean;
66
- skipLock: boolean;
67
- disableNewTracks: boolean;
68
- optimizeThreshold: number;
69
- selectedTracks: any[];
70
- selectedItems: any[];
71
- leftPanel: typeof Panel;
72
- trackTreesPanel: any;
73
- trackTreesComponent: any;
74
- lastTrackTreesComponentOffset: any;
75
- mainArea: typeof Area;
76
- root: HTMLBodyElement;
77
- header: typeof Panel;
78
- canvasArea: typeof Area;
79
- canvas: HTMLCanvasElement;
80
- size: [number, number];
81
- topMargin: number;
82
- header_offset: number;
83
- updateTheme: () => void;
84
- onCreateBeforeTopBar: Nullable<(headerPanel: typeof Panel) => void>;
85
- onCreateAfterTopBar: Nullable<(headerPanel: typeof Panel) => void>;
86
- onCreateControlsButtons: Nullable<(headerPanel: typeof Panel) => void>;
87
- onCreateSettingsButtons: Nullable<(headerPanel: typeof Panel) => void>;
88
- onShowOptimizeMenu: Nullable<(event: any) => void>;
89
- onShowConfiguration: Nullable<(panel: typeof Panel) => void>;
90
- onMouse: Nullable<(event: any, t: number) => void>;
91
- onDblClick: Nullable<(event: any) => void>;
92
- onShowContextMenu: Nullable<(event: any) => void>;
93
- onAddNewTrackButton: Nullable<() => void>;
94
- onAddNewTrack: Nullable<(track: any, options: any) => void>;
95
- onTrackTreeEvent: Nullable<(event: typeof TreeEvent) => void>;
96
- onBeforeDrawContent: Nullable<(ctx: CanvasRenderingContext2D) => void>;
97
- onStateStop: Nullable<() => void>;
98
- onStateChange: Nullable<(s: boolean) => void>;
99
- onChangeLoopMode: Nullable<(l: boolean) => void>;
100
- onSetDuration: Nullable<(d: number) => void>;
101
- onSetTime: Nullable<(t: number) => void>;
102
- onItemSelected: Nullable<(selected: any[], itemsToAdd: Nullable<any[]>, itemsToRemove: Nullable<any[]>) => void>;
103
- onSetTrackSelection: Nullable<(track: object, oldValue: boolean) => void>;
104
- onSetTrackState: Nullable<(track: object, oldValue: boolean) => void>;
105
- onSetTrackLock: Nullable<(track: object, oldValue: boolean) => void>;
106
- onUpdateTrack: Nullable<(tracks: number[] | string[]) => void>;
107
- configurationDialog: Nullable<typeof Dialog>;
108
- abstract onMouseUp(event: any, t: number): void;
109
- abstract onMouseDown(event: any, t: number): void;
110
- abstract onMouseMove(event: any, t: number): void;
111
- abstract drawContent(ctx: CanvasRenderingContext2D): void;
112
- abstract deleteSelectedContent(skipCallback: boolean): void;
113
- abstract copySelectedContent(): void;
114
- abstract pasteContent(time: number): void;
115
- abstract historyGenerateTrackStep(trackIdx: number): any;
116
- abstract historyApplyTrackStep(state: any, isUndo: boolean): any;
117
- /**
118
- * @param {String} id = string unique id
119
- * @param {Object} options = {skipLock, skipVisibility}
120
- */
121
- constructor(id: string, options?: any);
122
- clear(): void;
123
- /**
124
- * @method updateHeader
125
- */
126
- updateHeader(): void;
127
- /**
128
- * @method updateLeftPanel
129
- */
130
- updateLeftPanel(): void;
131
- setTrackHeight(trackHeight: number): void;
132
- /**
133
- * @param {Object} options options for the new track
134
- * { id: string, active: bool, locked: bool, }
135
- * @returns
136
- */
137
- addNewTrack(options?: any, skipCallback?: boolean): number;
138
- /**
139
- * Finds tracks ( wholy and partially ) inside the range minY maxY.
140
- * ( Full ) Canvas local coordinates.
141
- * @param {Number} minY pixels
142
- * @param {Number} maxY pixels
143
- * @returns array of trackDatas
144
- */
145
- getTracksInRange(minY: number, maxY: number): any;
146
- /**
147
- * @method setAnimationClip
148
- * @param {*} animation
149
- * @param {Boolean} needsToProcess
150
- * @param {Object} processOptions
151
- * [ KeyFrameTimeline ] - each track should contain an attribute "dim" to indicate the value dimension ( e.g. vector3 -> dim=3). Otherwise dimensions will be infered from track's values and times. Default is 1
152
- */
153
- setAnimationClip(animation: any, needsToProcess?: boolean): any;
154
- drawTimeInfo(w: number, h?: number): void;
155
- drawTracksBackground(w: number, h: number): void;
156
- /**
157
- * @method draw
158
- */
159
- draw(): void;
160
- /**
161
- * @method clearState
162
- */
163
- clearState(): void;
164
- /**
165
- * @method setDuration
166
- * @param {Number} t
167
- * @param {Boolean} skipCallback
168
- * @param {Boolean} updateHeader
169
- */
170
- setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
171
- setTime(time: number, skipCallback?: boolean): void;
172
- xToTime(x: number): number;
173
- timeToX(t: number): number;
174
- /**
175
- * @method setScale
176
- * @param {*} pixelsPerSecond >0. totalVisiblePixels / totalVisibleSeconds.
177
- */
178
- setScale(pixelsPerSecond: number): void;
179
- /**
180
- * @method setScroll
181
- * not delta from last state, but full scroll amount.
182
- * @param {Number} scrollY either pixels or [0,1 ]
183
- * @param {Boolean} normalized if true, scrollY is in range[0,1 ] being 1 fully scrolled. Otherwised scrollY represents pixels
184
- * @returns
185
- */
186
- setScroll(scrollY: number, normalized?: boolean): void;
187
- /**
188
- * @method processMouse
189
- * @param {*} e
190
- */
191
- processMouse(e: any): true | undefined;
192
- /**
193
- * keydown
194
- * @method processKeys
195
- * @param {*} e
196
- */
197
- processKeys(e: KeyboardEvent): void;
198
- /**
199
- * @method changeState
200
- * @param {Boolean} skipCallback defaults false
201
- * @description change play/pause state
202
- */
203
- changeState(skipCallback?: boolean): void;
204
- /**
205
- * @method setState
206
- * @param {Boolean} state
207
- * @param {Boolean} skipCallback defaults false
208
- * @description change play/pause state
209
- */
210
- setState(state: boolean, skipCallback?: boolean): void;
211
- /**
212
- * @method setLoopMode
213
- * @param {Boolean} loopState
214
- * @param {Boolean} skipCallback defaults false
215
- * @description change loop mode of the timeline
216
- */
217
- setLoopMode(loopState: boolean, skipCallback?: boolean): void;
218
- /**
219
- * @returns the tree elements ( tracks and grouops ) shown in the timeline.
220
- * Each item has { treeData: { trackData: track } }, where track is the actual track information of the animationClip.
221
- * If not a track, trackData will be undefined
222
- */
223
- getVisibleItems(): any;
224
- /**
225
- * [ trackIdx ]
226
- * @param {Array} itemsName array of numbers identifying tracks
227
- */
228
- setSelectedItems(items: any[], skipCallback?: boolean): void;
229
- /**
230
- * @param {Array} itemsToAdd [ trackIdx ], array of numbers identifying tracks by their index
231
- * @param {Array} itemsToRemove [ trackIdx ], array of numbers identifying tracks by their index
232
- */
233
- changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
234
- /**
235
- * It will find the first occurrence of trackId in animationClip.tracks
236
- * @param {String} trackId
237
- * @returns
238
- */
239
- getTrack(trackId: string): any;
240
- /**
241
- * @param {Boolean} updateTrackTree whether the track tree needs a refresh
242
- * @returns
243
- */
244
- deselectAllTracks(updateTrackTree?: boolean): void;
245
- /**
246
- * @param {Int} trackIdx
247
- * @param {Boolean} isSelected new "selected" state of the track
248
- * @param {Boolean} skipCallback whether to call onSetTrackSelection
249
- * @param {Boolean} updateTrackTree whether track tree panel needs a refresh
250
- * @returns
251
- */
252
- setTrackSelection(trackIdx: number, isSelected: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
253
- /**
254
- * updates trackTreesComponent's nodes, to match the selectedTracks
255
- */
256
- _updateTrackTreeSelection(): void;
257
- deselectAllElements(): void;
258
- /**
259
- * @method setTrackState
260
- * @param {Int} trackIdx
261
- * @param {Boolean} isEnbaled
262
- * @param {Boolean} skipCallback onSetTrackState
263
- * @param {Boolean} updateTrackTree updates eye icon of the track, if it is visible in the timeline
264
- */
265
- setTrackState(trackIdx: number, isEnbaled?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
266
- /**
267
- * @param {Int} trackIdx
268
- * @param {Boolean} isLocked
269
- * @param {Boolean} skipCallback onSetTrackLock
270
- * @param {Boolean} updateTrackTree updates lock icon of the track, if it is visible in the timeline
271
- */
272
- setTrackLock(trackIdx: number, isLocked?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
273
- /**
274
- * @param {Int} trackIdx index of track in the animation ( not local index )
275
- * @param {Boolean} combineWithPrevious whether to create a new entry or unify changes into a single undo entry
276
- */
277
- saveState(trackIdx: number, combineWithPrevious?: boolean): void;
278
- undo(): boolean;
279
- redo(): boolean;
280
- /**
281
- * @method resize
282
- * @param {*} size
283
- */
284
- resize(size?: Nullable<[number, number]>): void;
285
- resizeCanvas(): void;
286
- /**
287
- * @method hide
288
- * Hide timeline area
289
- */
290
- hide(): void;
291
- /**
292
- * @method show
293
- * Show timeline area if it is hidden
294
- */
295
- show(): void;
296
- /**
297
- These functions might be overriden by child classes. Nonetheless, they must have the same attributes, at least.
298
- Usually call a super.whateverFunction to generate its base form, and expand it with extra attributes
299
- */
300
- /**
301
- * This functions uses the selectedItems and generates the data that will feed the LX.Tree Component.
302
- * This function is used by updateLeftPanel. Some timelines might allow grouping of tracks. Such timelines may override this function
303
- * WARNING: track entries MUST have an attribute of 'trackData' with the track info
304
- * @returns lexgui tree data as expected for the creation of a LX.Tree
305
- */
306
- generateSelectedItemsTreeData(): any;
307
- /**
308
- * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
309
- * @returns
310
- */
311
- instantiateTrack(options?: any, clone?: boolean): {
312
- isTrack: boolean;
313
- id: any;
314
- active: any;
315
- locked: any;
316
- isSelected: boolean;
317
- trackIdx: number;
318
- data: any;
319
- };
320
- /**
321
- * Generates an animationClip using either the parameters set in the animation argument or using default values
322
- * @param {Object} options data with which to generate an animationClip
323
- * @param {Boolean} clone whether to clone clips or make a shallow copy
324
- * @returns
325
- */
326
- instantiateAnimationClip(options?: any, clone?: boolean): any;
327
- }
328
- /**
329
- * @class KeyFramesTimeline
330
- */
331
- export declare class KeyFramesTimeline extends Timeline {
332
- #private;
333
- static ADDKEY_VALUESINARRAYS: number;
334
- lastKeyFramesSelected: any[];
335
- keyValuePerPixel: number;
336
- defaultCurves: boolean;
337
- defaultCurvesRange: [number, number];
338
- keyframeSize: number;
339
- keyframeSizeHovered: number;
340
- lastHovered: Nullable<[number, number]>;
341
- moveKeyMinTime: number;
342
- onContentMoved: Nullable<(trackIdx: number, keyIdx: number) => void>;
343
- onOptimizeTracks: Nullable<(trackIdx: number) => void>;
344
- onDeleteKeyFrames: Nullable<(trackIdx: number, indices: number[]) => void>;
345
- onSelectKeyFrame: Nullable<(selection: [number, number, number][]) => void>;
346
- onDeselectKeyFrames: Nullable<(lastSelected: any[]) => void>;
347
- /**
348
- * @param {String} name unique string
349
- * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
350
- */
351
- constructor(name: string, options?: any);
352
- generateSelectedItemsTreeData(): any;
353
- /**
354
- * OVERRIDE
355
- * @param {Object} options track information that wants to be set to the new track
356
- * id, dim, values, times, selected, edited, hovered
357
- * @returns
358
- */
359
- instantiateTrack(options?: any, clone?: boolean): any;
360
- /**
361
- * Generates an animationClip using either the parameters set in the animation argument or using default values
362
- * @param {Object} animation data with which to generate an animationClip
363
- * @returns
364
- */
365
- instantiateAnimationClip(animation: Nullable<any>, clone?: boolean): any;
366
- deselectAllElements(): void;
367
- /**
368
- * OVERRIDE
369
- * @param {Array} itemsToAdd [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
370
- * @param {Array} itemsToRemove [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
371
- */
372
- changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
373
- /**
374
- * @param {String} groupId unique identifier
375
- * @param {Array} groupTracks [ "trackID", trackIdx ] array of strings and/or numbers of the existing tracks to include in this group. A track can only be part of 1 group
376
- * if groupTracks == null, groupId is removed from the list
377
- */
378
- setTracksGroup(groupId: string, groupTracks?: Nullable<(string | number)[]>): void;
379
- /**
380
- * @param {String} groupId
381
- * @returns array of tracks or null
382
- */
383
- getTracksGroup(groupId: string): any[] | null;
384
- /**
385
- * OVERRIDE
386
- * @param {String} trackId
387
- * @param {String} groupId optionl. If not set, it will find the first occurrence of trackId in animationClip.tracks
388
- * @returns
389
- */
390
- getTrack(trackId: string, groupId?: Nullable<string>): any;
391
- /**
392
- * @param {Number} size pixels, height of keyframe
393
- * @param {Number} sizeHovered optional, size in pixels when hovered
394
- */
395
- setKeyframeSize(size: number, sizeHovered?: Nullable<number>): void;
396
- onMouseUp(e: any, time: number): void;
397
- onMouseDown(e: any, time: number): void;
398
- onMouseMove(e: any, time: number): void;
399
- drawContent(ctx: CanvasRenderingContext2D): void;
400
- /**
401
- * @method drawTrackWithKeyframes
402
- * @param {*} ctx
403
- * ...
404
- * @description helper function, you can call it from drawContent to render all the keyframes
405
- */
406
- drawTrackWithKeyframes(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
407
- drawTrackWithCurves(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
408
- _getValidTrackName(uglyName: string): (string | null)[];
409
- /**
410
- * updates an existing track with new values and times.
411
- * @param {Int} trackIdx index of track in the animationClip
412
- * @param {*} newTrack object with two arrays: values and times. These will be set to the selected track
413
- * @returns
414
- */
415
- updateTrack(trackIdx: number, newTrack: any): boolean;
416
- /**
417
- * removes equivalent sequential keys either because of equal times or values
418
- * ( 0,0,0,0,1,1,1,0,0,0,0,0,0,0 ) --> ( 0, 0,1,1,0, 0 )
419
- * @param {Int} trackIdx index of track in the animation
420
- * @param {Boolean} onlyEqualTime if true, removes only keyframes with equal times. Otherwise, values are ALSO compared through the class threshold
421
- * @param {Boolean} skipCallback if false, triggers "onOptimizeTracks" after optimizing
422
- */
423
- optimizeTrack(trackIdx: number, onlyEqualTime?: boolean, skipCallback?: boolean): void;
424
- optimizeTracks(onlyEqualTime?: boolean): void;
425
- /**
426
- * saveState function uses this to generate a "copy" of the track.
427
- * @param {Number} trackIdx
428
- * @returns All necessary information to reconstruct the track state
429
- */
430
- historyGenerateTrackStep(trackIdx: number): {
431
- trackIdx: number;
432
- t: any;
433
- v: any;
434
- edited: any;
435
- };
436
- /**
437
- * It should swap the previous state with the incoming state of the track. It must return the previous state.
438
- * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
439
- * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
440
- * @param {Boolean} isUndo
441
- * @returns previous state object
442
- */
443
- historyApplyTrackStep(state: any, isUndo: boolean): {
444
- trackIdx: any;
445
- t: any;
446
- v: any;
447
- edited: any;
448
- };
449
- /**
450
- * @param {*} track
451
- * @param {Number} srcIdx keyFrame index
452
- * @param {Number} trgIdx keyFrame index
453
- */
454
- swapKeyFrames(track: any, srcIdx: number, trgIdx: number): void;
455
- copySelectedContent(): void;
456
- copyKeyFrameValue(track: any, index: number): void;
457
- copyKeyFrames(track: any, indices: number[]): void;
458
- canPasteKeyFrame(): boolean;
459
- pasteContentValue(): boolean;
460
- pasteContent(time?: number): boolean;
461
- pasteKeyFrameValue(track: any, index: number): void;
462
- pasteKeyFrames(pasteTime?: number): boolean;
463
- /**
464
- *
465
- * @param {Int} trackIdx
466
- * @param {Array} newValues array of values for each keyframe. It should be a flat array of size track.dim*numKeyframes. Check ADDKEY_VALUESINARRAYS flag
467
- * @param {Array of numbers } newTimes must be ordered ascendently
468
- * @param {Number} timeOffset
469
- * @param {Int} flags
470
- * KeyFramesTimeline.ADDKEY_VALUESINARRAYS: if set, newValues is an array of arrays, one for each entry [ [1,2,3], [5,6,7] ]. Times is still a flat array of values [ 0, 0.2 ]
471
-
472
- * @returns
473
- */
474
- addKeyFrames(trackIdx: number, newValues: any[], newTimes: number[], timeOffset?: number, flags?: number): number[] | null;
475
- deleteSelectedContent(skipCallback?: boolean): void;
476
- deleteKeyFrames(trackIdx: number, indices: number[], skipCallback?: boolean): boolean;
477
- /**
478
- * Binary search. Relies on track.times being a sorted array
479
- * @param {Object} track
480
- * @param {Number} time
481
- * @param {Number} mode on of the possible values
482
- * - -1 = nearest frame with t[ f ] <= time
483
- * - 0 = nearest frame
484
- * - 1 = nearest frame with t[ f ] >= time
485
- * @returns a zero/positive value if successful. On failure returnes -1 meaning either there are no frames ( 0 ), no frame-time is lower ( -1 ) or no frame-time is higher (1 )
486
- */
487
- getNearestKeyFrame(track: any, time: number, mode?: number): number;
488
- /**
489
- * get the nearest keyframe to "time" given a maximum threshold.
490
- * @param {Object} track
491
- * @param {Number} time
492
- * @param {Number} threshold must be positive value
493
- * @returns returns a postive/zero value if there is a frame inside the threshold range. Otherwise, -1
494
- */
495
- getCurrentKeyFrame(track: any, time: number, threshold?: number): number;
496
- /**
497
- * Returns the interval of frames between minTime and maxTime (both included )
498
- * @param {Object} track
499
- * @param {Number} minTime
500
- * @param {Number} maxTime
501
- * @param {Number} threshold must be positive value
502
- * @returns an array with two values [ minFrame, maxFrame ]. Otherwise null
503
- */
504
- getKeyFramesInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
505
- unHoverAll(): Nullable<[number, number]>;
506
- deselectAllKeyFrames(): boolean;
507
- isKeyFrameSelected(track: any, index: number): any;
508
- /**
509
- * @param {Int} trackIdx track index of animation clip
510
- * @param {Int} frameIdx frame ( index ) to select inside the track
511
- * @param {Boolean} skipCallback
512
- * @returns
513
- */
514
- selectKeyFrame(trackIdx: number, frameIdx: number, skipCallback?: boolean): any[] | null;
515
- deselectKeyFrame(trackIdx: number, frameIdx: number): boolean;
516
- getNumKeyFramesSelected(): number;
517
- /**
518
- * helper function to process a selection with multiple keyframes. Sets the time of the timeline to the first selected keyframe
519
- * @param {Number} trackIdx
520
- * @param {Number} keyFrameIndex
521
- * @param {Boolean} multipleSelection whether to append to selection or reset it and make this keyframe the only current selection
522
- * @returns
523
- */
524
- processSelectionKeyFrame(trackIdx: number, keyFrameIndex: number, multipleSelection?: boolean): void;
525
- /**
526
- * @method clearTrack
527
- */
528
- clearTrack(trackIdx: number): number | undefined;
529
- }
530
- /**
531
- * @class ClipsTimeline
532
- */
533
- export declare class ClipsTimeline extends Timeline {
534
- #private;
535
- static CLONEREASON_COPY: number;
536
- static CLONEREASON_PASTE: number;
537
- static CLONEREASON_HISTORY: number;
538
- static CLONEREASON_TRACKCLONE: number;
539
- lastClipsSelected: any;
540
- lastTrackClipsMove: number;
541
- dragClipMode: Nullable<string>;
542
- lastHovered: Nullable<[number, number]>;
543
- onSelectClip: Nullable<(clip: Nullable<any>) => void>;
544
- onContentMoved: Nullable<(clip: Nullable<any>, delta: number) => void>;
545
- onDeleteSelectedClips: Nullable<(selected: any[]) => void>;
546
- onDeleteClip: Nullable<(trackIdx: number, clipIdx: number, clip: any) => void>;
547
- /**
548
- * @param {String} name
549
- * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
550
- */
551
- constructor(name: string, options?: any);
552
- /**
553
- * Generates an animationClip using either the parameters set in the animation argument or using default values
554
- * @param {Object} animation data with which to generate an animationClip
555
- * @returns
556
- */
557
- instantiateAnimationClip(animation: any, clone?: boolean): any;
558
- /**
559
- * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
560
- * @returns
561
- */
562
- instantiateTrack(options?: any, clone?: boolean): any;
563
- instantiateClip(options?: any): {
564
- id: any;
565
- start: any;
566
- duration: any;
567
- fadein: any;
568
- fadeout: any;
569
- clipColor: any;
570
- fadeColor: any;
571
- active: any;
572
- trackIdx: number;
573
- };
574
- addNewTrack(options?: any, updateLeftPanel?: boolean, skipCallback?: boolean): any;
575
- setAnimationClip(animation: any, needsToProcess?: boolean): any;
576
- deselectAllElements(): void;
577
- /**
578
- * OVERRIDE ITEM SELECTION.
579
- * CLIPS WILL OFFER NO SELECTION. All tracks are visible
580
- */
581
- changeSelectedItems(): void;
582
- unHoverAll(): Nullable<[number, number]>;
583
- onMouseUp(e: any): void;
584
- onMouseDown(e: any, time: number): void;
585
- onMouseMove(e: any, time: number): true | undefined;
586
- drawContent(ctx: CanvasRenderingContext2D): void;
587
- /**
588
- * @method drawTrackWithBoxes
589
- * @param {*} ctx
590
- */
591
- drawTrackWithBoxes(ctx: CanvasRenderingContext2D, y: number, trackHeight: number, track: any): void;
592
- /**
593
- * @method optimizeTrack
594
- */
595
- optimizeTrack(trackIdx: number): void;
596
- /**
597
- * @method optimizeTracks
598
- */
599
- optimizeTracks(): void;
600
- /**
601
- * @param {Object} clip clip to be added
602
- * @param {Int} trackIdx ( optional ) track where to put the clip. -1 will find the first free slot. ***WARNING*** Must call getClipsInRange, before calling this function with a valid trackdIdx
603
- * @param {Number} offsetTime ( optional ) offset time of current time
604
- * @param {Number} searchStartTrackIdx ( optional ) if trackIdx is set to -1, this idx will be used as the starting point to find a valid track
605
- * @returns a zero/positive value if successful. Otherwise, -1
606
- */
607
- addClip(clip: any, trackIdx?: number, offsetTime?: number, searchStartTrackIdx?: number): any;
608
- /**
609
- * Add an array of clips to the timeline in the first suitable tracks. It tries to put clips in the same track if possible. All clips will be in adjacent tracks to each other
610
- * @param {Object[] } clips
611
- * @param {Number} offsetTime
612
- * @param {Int} searchStartTrackIdx
613
- * @returns
614
- */
615
- addClips(clips: any[], offsetTime?: number, searchStartTrackIdx?: number): boolean;
616
- deleteSelectedContent(skipCallback?: boolean): void;
617
- /** Delete clip from the timeline
618
- * @param {Number} trackIdx
619
- * @param {Number} clipIdx clip to be deleted
620
- */
621
- deleteClip(trackIdx: number, clipIdx: number, skipCallback?: boolean): void;
622
- /**
623
- * User defined. Used when copying and pasting
624
- * @param {Array of clips } clipsToClone array of original clips. Do not modify clips in this array
625
- * @param {Number} timeOffset Value of time that should be added ( or subtracted ) from the timing attributes
626
- * @param {Int} reason Flag to signal the reason of the clone
627
- * @returns {Array of clips }
628
- */
629
- cloneClips(clipsToClone: any[], timeOffset: number, reason?: number): any;
630
- /**
631
- * Overwrite the "cloneClips" function to provide a custom cloning of clips. Otherwise, JSON serialization is used
632
- */
633
- copySelectedContent(): void;
634
- pasteContent(time?: number): void;
635
- /**
636
- * @method clearTrack
637
- */
638
- clearTrack(trackIdx: number): void;
639
- /**
640
- * saveState function uses this to generate a "copy" of the track.
641
- * @param {Number} trackIdx
642
- * @returns All necessary information to reconstruct the track state
643
- */
644
- historyGenerateTrackStep(trackIdx: number): {
645
- trackIdx: number;
646
- clips: any;
647
- edited: any;
648
- };
649
- /**
650
- * It should swap the previous state with the incoming state of the track. It must return the previous state.
651
- * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
652
- * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
653
- * @param {Boolean} isUndo
654
- * @returns previous state object
655
- */
656
- historyApplyTrackStep(state: any, isUndo: boolean): {
657
- trackIdx: any;
658
- clips: any;
659
- edited: any;
660
- };
661
- getClipOnTime(track: any, time: number, threshold: number): number;
662
- deselectAllClips(): boolean;
663
- selectAll(skipCallback?: boolean): void;
664
- selectClip(trackIdx: number, clipIndex: number, deselect?: boolean, skipCallback?: boolean): number;
665
- deselectClip(trackIdx: number, clipIndex: number): number;
666
- getClipsInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
667
- validateDuration(t: number): number;
668
- setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
669
- }
670
- export {};
1
+ declare const Area: any;
2
+ declare const Panel: any;
3
+ declare const Dialog: any;
4
+ type Nullable<T> = T | null | undefined;
5
+ /**
6
+ * @class Timeline
7
+ * @description Agnostic timeline, do not impose any timeline content. Renders to a canvas
8
+ */
9
+ export declare abstract class Timeline {
10
+ #private;
11
+ static BACKGROUND_COLOR: string;
12
+ static TRACK_COLOR_PRIMARY: string;
13
+ static TRACK_COLOR_SECONDARY: string;
14
+ static TRACK_COLOR_TERTIARY: string;
15
+ static TRACK_SELECTED: string;
16
+ static TRACK_SELECTED_LIGHT: string;
17
+ static FONT: string;
18
+ static FONT_COLOR_PRIMARY: string;
19
+ static FONT_COLOR_TERTIARY: string;
20
+ static FONT_COLOR_QUATERNARY: string;
21
+ static KEYFRAME_COLOR: string;
22
+ static KEYFRAME_COLOR_HOVERED: string;
23
+ static KEYFRAME_COLOR_SELECTED: string;
24
+ static KEYFRAME_COLOR_LOCK: string;
25
+ static KEYFRAME_COLOR_EDITED: string;
26
+ static KEYFRAME_COLOR_INACTIVE: string;
27
+ static TIME_MARKER_COLOR: string;
28
+ static TIME_MARKER_COLOR_TEXT: string;
29
+ static BOX_SELECTION_COLOR: string;
30
+ uniqueID: string;
31
+ timelineTitle: string;
32
+ animationClip: any;
33
+ duration: number;
34
+ currentTime: number;
35
+ visualTimeRange: [number, number];
36
+ visualOriginTime: number;
37
+ pixelsPerSecond: number;
38
+ secondsPerPixel: number;
39
+ clickTime: number;
40
+ clickDiscardTimeout: number;
41
+ lastMouse: [number, number];
42
+ boxSelection: boolean;
43
+ boxSelectionStart: [number, number];
44
+ boxSelectionEnd: [number, number];
45
+ historyUndo: Array<any>;
46
+ historyRedo: Array<any>;
47
+ historySaveEnabler: boolean;
48
+ historyMaxSteps: number;
49
+ clipboard: any;
50
+ grabbing: boolean;
51
+ grabTime: number;
52
+ grabbingTimeBar: boolean;
53
+ grabbingScroll: boolean;
54
+ movingKeys: boolean;
55
+ timeBeforeMove: number;
56
+ currentScroll: number;
57
+ currentScrollInPixels: number;
58
+ trackHeight: number;
59
+ timeSeparators: number[];
60
+ playing: boolean;
61
+ loop: boolean;
62
+ active: boolean;
63
+ skipVisibility: boolean;
64
+ skipLock: boolean;
65
+ disableNewTracks: boolean;
66
+ optimizeThreshold: number;
67
+ selectedTracks: any[];
68
+ selectedItems: any[];
69
+ leftPanel: typeof Panel;
70
+ trackTreesPanel: any;
71
+ trackTreesComponent: any;
72
+ lastTrackTreesComponentOffset: any;
73
+ mainArea: typeof Area;
74
+ root: HTMLBodyElement;
75
+ header: typeof Panel;
76
+ canvasArea: typeof Area;
77
+ canvas: HTMLCanvasElement;
78
+ size: [number, number];
79
+ topMargin: number;
80
+ header_offset: number;
81
+ updateTheme: () => void;
82
+ onCreateBeforeTopBar: Nullable<(headerPanel: typeof Panel) => void>;
83
+ onCreateAfterTopBar: Nullable<(headerPanel: typeof Panel) => void>;
84
+ onCreateControlsButtons: Nullable<(headerPanel: typeof Panel) => void>;
85
+ onCreateSettingsButtons: Nullable<(headerPanel: typeof Panel) => void>;
86
+ onShowOptimizeMenu: Nullable<(event: any) => void>;
87
+ onShowConfiguration: Nullable<(panel: typeof Panel) => void>;
88
+ onMouse: Nullable<(event: any, t: number) => void>;
89
+ onDblClick: Nullable<(event: any) => void>;
90
+ onShowContextMenu: Nullable<(event: any) => void>;
91
+ onAddNewTrackButton: Nullable<() => void>;
92
+ onAddNewTrack: Nullable<(track: any, options: any) => void>;
93
+ onTrackTreeEvent: Nullable<(event: any) => void>;
94
+ onBeforeDrawContent: Nullable<(ctx: CanvasRenderingContext2D) => void>;
95
+ onStateStop: Nullable<() => void>;
96
+ onStateChange: Nullable<(s: boolean) => void>;
97
+ onChangeLoopMode: Nullable<(l: boolean) => void>;
98
+ onSetDuration: Nullable<(d: number) => void>;
99
+ onSetTime: Nullable<(t: number) => void>;
100
+ onItemSelected: Nullable<(selected: any[], itemsToAdd: Nullable<any[]>, itemsToRemove: Nullable<any[]>) => void>;
101
+ onSetTrackSelection: Nullable<(track: object, oldValue: boolean) => void>;
102
+ onSetTrackState: Nullable<(track: object, oldValue: boolean) => void>;
103
+ onSetTrackLock: Nullable<(track: object, oldValue: boolean) => void>;
104
+ onUpdateTrack: Nullable<(tracks: number[] | string[]) => void>;
105
+ configurationDialog: Nullable<typeof Dialog>;
106
+ abstract onMouseUp(event: any, t: number): void;
107
+ abstract onMouseDown(event: any, t: number): void;
108
+ abstract onMouseMove(event: any, t: number): void;
109
+ abstract drawContent(ctx: CanvasRenderingContext2D): void;
110
+ abstract deleteSelectedContent(skipCallback: boolean): void;
111
+ abstract copySelectedContent(): void;
112
+ abstract pasteContent(time: number): void;
113
+ abstract historyGenerateTrackStep(trackIdx: number): any;
114
+ abstract historyApplyTrackStep(state: any, isUndo: boolean): any;
115
+ /**
116
+ * @param {String} id = string unique id
117
+ * @param {Object} options = {skipLock, skipVisibility}
118
+ */
119
+ constructor(id: string, options?: any);
120
+ clear(): void;
121
+ /**
122
+ * @method updateHeader
123
+ */
124
+ updateHeader(): void;
125
+ /**
126
+ * @method updateLeftPanel
127
+ */
128
+ updateLeftPanel(): void;
129
+ setTrackHeight(trackHeight: number): void;
130
+ /**
131
+ * @param {Object} options options for the new track
132
+ * { id: string, active: bool, locked: bool, }
133
+ * @returns
134
+ */
135
+ addNewTrack(options?: any, skipCallback?: boolean): number;
136
+ /**
137
+ * Finds tracks ( wholy and partially ) inside the range minY maxY.
138
+ * ( Full ) Canvas local coordinates.
139
+ * @param {Number} minY pixels
140
+ * @param {Number} maxY pixels
141
+ * @returns array of trackDatas
142
+ */
143
+ getTracksInRange(minY: number, maxY: number): any;
144
+ /**
145
+ * @method setAnimationClip
146
+ * @param {*} animation
147
+ * @param {Boolean} needsToProcess
148
+ * @param {Object} processOptions
149
+ * [ KeyFrameTimeline ] - each track should contain an attribute "dim" to indicate the value dimension ( e.g. vector3 -> dim=3). Otherwise dimensions will be infered from track's values and times. Default is 1
150
+ */
151
+ setAnimationClip(animation: any, needsToProcess?: boolean): any;
152
+ drawTimeInfo(w: number, h?: number): void;
153
+ drawTracksBackground(w: number, h: number): void;
154
+ /**
155
+ * @method draw
156
+ */
157
+ draw(): void;
158
+ /**
159
+ * @method clearState
160
+ */
161
+ clearState(): void;
162
+ /**
163
+ * @method setDuration
164
+ * @param {Number} t
165
+ * @param {Boolean} skipCallback
166
+ * @param {Boolean} updateHeader
167
+ */
168
+ setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
169
+ setTime(time: number, skipCallback?: boolean): void;
170
+ xToTime(x: number): number;
171
+ timeToX(t: number): number;
172
+ /**
173
+ * @method setScale
174
+ * @param {*} pixelsPerSecond >0. totalVisiblePixels / totalVisibleSeconds.
175
+ */
176
+ setScale(pixelsPerSecond: number): void;
177
+ /**
178
+ * @method setScroll
179
+ * not delta from last state, but full scroll amount.
180
+ * @param {Number} scrollY either pixels or [0,1 ]
181
+ * @param {Boolean} normalized if true, scrollY is in range[0,1 ] being 1 fully scrolled. Otherwised scrollY represents pixels
182
+ * @returns
183
+ */
184
+ setScroll(scrollY: number, normalized?: boolean): void;
185
+ /**
186
+ * @method processMouse
187
+ * @param {*} e
188
+ */
189
+ processMouse(e: any): true | undefined;
190
+ /**
191
+ * keydown
192
+ * @method processKeys
193
+ * @param {*} e
194
+ */
195
+ processKeys(e: KeyboardEvent): void;
196
+ /**
197
+ * @method changeState
198
+ * @param {Boolean} skipCallback defaults false
199
+ * @description change play/pause state
200
+ */
201
+ changeState(skipCallback?: boolean): void;
202
+ /**
203
+ * @method setState
204
+ * @param {Boolean} state
205
+ * @param {Boolean} skipCallback defaults false
206
+ * @description change play/pause state
207
+ */
208
+ setState(state: boolean, skipCallback?: boolean): void;
209
+ /**
210
+ * @method setLoopMode
211
+ * @param {Boolean} loopState
212
+ * @param {Boolean} skipCallback defaults false
213
+ * @description change loop mode of the timeline
214
+ */
215
+ setLoopMode(loopState: boolean, skipCallback?: boolean): void;
216
+ /**
217
+ * @returns the tree elements ( tracks and grouops ) shown in the timeline.
218
+ * Each item has { treeData: { trackData: track } }, where track is the actual track information of the animationClip.
219
+ * If not a track, trackData will be undefined
220
+ */
221
+ getVisibleItems(): any;
222
+ /**
223
+ * [ trackIdx ]
224
+ * @param {Array} itemsName array of numbers identifying tracks
225
+ */
226
+ setSelectedItems(items: any[], skipCallback?: boolean): void;
227
+ /**
228
+ * @param {Array} itemsToAdd [ trackIdx ], array of numbers identifying tracks by their index
229
+ * @param {Array} itemsToRemove [ trackIdx ], array of numbers identifying tracks by their index
230
+ */
231
+ changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
232
+ /**
233
+ * It will find the first occurrence of trackId in animationClip.tracks
234
+ * @param {String} trackId
235
+ * @returns
236
+ */
237
+ getTrack(trackId: string): any;
238
+ /**
239
+ * @param {Boolean} updateTrackTree whether the track tree needs a refresh
240
+ * @returns
241
+ */
242
+ deselectAllTracks(updateTrackTree?: boolean): void;
243
+ /**
244
+ * @param {Int} trackIdx
245
+ * @param {Boolean} isSelected new "selected" state of the track
246
+ * @param {Boolean} skipCallback whether to call onSetTrackSelection
247
+ * @param {Boolean} updateTrackTree whether track tree panel needs a refresh
248
+ * @returns
249
+ */
250
+ setTrackSelection(trackIdx: number, isSelected: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
251
+ /**
252
+ * updates trackTreesComponent's nodes, to match the selectedTracks
253
+ */
254
+ _updateTrackTreeSelection(): void;
255
+ deselectAllElements(): void;
256
+ /**
257
+ * @method setTrackState
258
+ * @param {Int} trackIdx
259
+ * @param {Boolean} isEnbaled
260
+ * @param {Boolean} skipCallback onSetTrackState
261
+ * @param {Boolean} updateTrackTree updates eye icon of the track, if it is visible in the timeline
262
+ */
263
+ setTrackState(trackIdx: number, isEnbaled?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
264
+ /**
265
+ * @param {Int} trackIdx
266
+ * @param {Boolean} isLocked
267
+ * @param {Boolean} skipCallback onSetTrackLock
268
+ * @param {Boolean} updateTrackTree updates lock icon of the track, if it is visible in the timeline
269
+ */
270
+ setTrackLock(trackIdx: number, isLocked?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
271
+ /**
272
+ * @param {Int} trackIdx index of track in the animation ( not local index )
273
+ * @param {Boolean} combineWithPrevious whether to create a new entry or unify changes into a single undo entry
274
+ */
275
+ saveState(trackIdx: number, combineWithPrevious?: boolean): void;
276
+ undo(): boolean;
277
+ redo(): boolean;
278
+ /**
279
+ * @method resize
280
+ * @param {*} size
281
+ */
282
+ resize(size?: Nullable<[number, number]>): void;
283
+ resizeCanvas(): void;
284
+ /**
285
+ * @method hide
286
+ * Hide timeline area
287
+ */
288
+ hide(): void;
289
+ /**
290
+ * @method show
291
+ * Show timeline area if it is hidden
292
+ */
293
+ show(): void;
294
+ /**
295
+ These functions might be overriden by child classes. Nonetheless, they must have the same attributes, at least.
296
+ Usually call a super.whateverFunction to generate its base form, and expand it with extra attributes
297
+ */
298
+ /**
299
+ * This functions uses the selectedItems and generates the data that will feed the LX.Tree Component.
300
+ * This function is used by updateLeftPanel. Some timelines might allow grouping of tracks. Such timelines may override this function
301
+ * WARNING: track entries MUST have an attribute of 'trackData' with the track info
302
+ * @returns lexgui tree data as expected for the creation of a LX.Tree
303
+ */
304
+ generateSelectedItemsTreeData(): any;
305
+ /**
306
+ * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
307
+ * @returns
308
+ */
309
+ instantiateTrack(options?: any, clone?: boolean): {
310
+ isTrack: boolean;
311
+ id: any;
312
+ active: any;
313
+ locked: any;
314
+ isSelected: boolean;
315
+ trackIdx: number;
316
+ data: any;
317
+ };
318
+ /**
319
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
320
+ * @param {Object} options data with which to generate an animationClip
321
+ * @param {Boolean} clone whether to clone clips or make a shallow copy
322
+ * @returns
323
+ */
324
+ instantiateAnimationClip(options?: any, clone?: boolean): any;
325
+ }
326
+ /**
327
+ * @class KeyFramesTimeline
328
+ */
329
+ export declare class KeyFramesTimeline extends Timeline {
330
+ #private;
331
+ static ADDKEY_VALUESINARRAYS: number;
332
+ lastKeyFramesSelected: any[];
333
+ keyValuePerPixel: number;
334
+ defaultCurves: boolean;
335
+ defaultCurvesRange: [number, number];
336
+ keyframeSize: number;
337
+ keyframeSizeHovered: number;
338
+ lastHovered: Nullable<[number, number]>;
339
+ moveKeyMinTime: number;
340
+ onContentMoved: Nullable<(trackIdx: number, keyIdx: number) => void>;
341
+ onOptimizeTracks: Nullable<(trackIdx: number) => void>;
342
+ onDeleteKeyFrames: Nullable<(trackIdx: number, indices: number[]) => void>;
343
+ onSelectKeyFrame: Nullable<(selection: [number, number, number][]) => void>;
344
+ onDeselectKeyFrames: Nullable<(lastSelected: any[]) => void>;
345
+ /**
346
+ * @param {String} name unique string
347
+ * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
348
+ */
349
+ constructor(name: string, options?: any);
350
+ generateSelectedItemsTreeData(): any;
351
+ /**
352
+ * OVERRIDE
353
+ * @param {Object} options track information that wants to be set to the new track
354
+ * id, dim, values, times, selected, edited, hovered
355
+ * @returns
356
+ */
357
+ instantiateTrack(options?: any, clone?: boolean): any;
358
+ /**
359
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
360
+ * @param {Object} animation data with which to generate an animationClip
361
+ * @returns
362
+ */
363
+ instantiateAnimationClip(animation: Nullable<any>, clone?: boolean): any;
364
+ deselectAllElements(): void;
365
+ /**
366
+ * OVERRIDE
367
+ * @param {Array} itemsToAdd [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
368
+ * @param {Array} itemsToRemove [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
369
+ */
370
+ changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
371
+ /**
372
+ * @param {String} groupId unique identifier
373
+ * @param {Array} groupTracks [ "trackID", trackIdx ] array of strings and/or numbers of the existing tracks to include in this group. A track can only be part of 1 group
374
+ * if groupTracks == null, groupId is removed from the list
375
+ */
376
+ setTracksGroup(groupId: string, groupTracks?: Nullable<(string | number)[]>): void;
377
+ /**
378
+ * @param {String} groupId
379
+ * @returns array of tracks or null
380
+ */
381
+ getTracksGroup(groupId: string): any[] | null;
382
+ /**
383
+ * OVERRIDE
384
+ * @param {String} trackId
385
+ * @param {String} groupId optionl. If not set, it will find the first occurrence of trackId in animationClip.tracks
386
+ * @returns
387
+ */
388
+ getTrack(trackId: string, groupId?: Nullable<string>): any;
389
+ /**
390
+ * @param {Number} size pixels, height of keyframe
391
+ * @param {Number} sizeHovered optional, size in pixels when hovered
392
+ */
393
+ setKeyframeSize(size: number, sizeHovered?: Nullable<number>): void;
394
+ onMouseUp(e: any, time: number): void;
395
+ onMouseDown(e: any, time: number): void;
396
+ onMouseMove(e: any, time: number): void;
397
+ drawContent(ctx: CanvasRenderingContext2D): void;
398
+ /**
399
+ * @method drawTrackWithKeyframes
400
+ * @param {*} ctx
401
+ * ...
402
+ * @description helper function, you can call it from drawContent to render all the keyframes
403
+ */
404
+ drawTrackWithKeyframes(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
405
+ drawTrackWithCurves(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
406
+ _getValidTrackName(uglyName: string): (string | null)[];
407
+ /**
408
+ * updates an existing track with new values and times.
409
+ * @param {Int} trackIdx index of track in the animationClip
410
+ * @param {*} newTrack object with two arrays: values and times. These will be set to the selected track
411
+ * @returns
412
+ */
413
+ updateTrack(trackIdx: number, newTrack: any): boolean;
414
+ /**
415
+ * removes equivalent sequential keys either because of equal times or values
416
+ * ( 0,0,0,0,1,1,1,0,0,0,0,0,0,0 ) --> ( 0, 0,1,1,0, 0 )
417
+ * @param {Int} trackIdx index of track in the animation
418
+ * @param {Boolean} onlyEqualTime if true, removes only keyframes with equal times. Otherwise, values are ALSO compared through the class threshold
419
+ * @param {Boolean} skipCallback if false, triggers "onOptimizeTracks" after optimizing
420
+ */
421
+ optimizeTrack(trackIdx: number, onlyEqualTime?: boolean, skipCallback?: boolean): void;
422
+ optimizeTracks(onlyEqualTime?: boolean): void;
423
+ /**
424
+ * saveState function uses this to generate a "copy" of the track.
425
+ * @param {Number} trackIdx
426
+ * @returns All necessary information to reconstruct the track state
427
+ */
428
+ historyGenerateTrackStep(trackIdx: number): {
429
+ trackIdx: number;
430
+ t: any;
431
+ v: any;
432
+ edited: any;
433
+ };
434
+ /**
435
+ * It should swap the previous state with the incoming state of the track. It must return the previous state.
436
+ * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
437
+ * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
438
+ * @param {Boolean} isUndo
439
+ * @returns previous state object
440
+ */
441
+ historyApplyTrackStep(state: any, isUndo: boolean): {
442
+ trackIdx: any;
443
+ t: any;
444
+ v: any;
445
+ edited: any;
446
+ };
447
+ /**
448
+ * @param {*} track
449
+ * @param {Number} srcIdx keyFrame index
450
+ * @param {Number} trgIdx keyFrame index
451
+ */
452
+ swapKeyFrames(track: any, srcIdx: number, trgIdx: number): void;
453
+ copySelectedContent(): void;
454
+ copyKeyFrameValue(track: any, index: number): void;
455
+ copyKeyFrames(track: any, indices: number[]): void;
456
+ canPasteKeyFrame(): boolean;
457
+ pasteContentValue(): boolean;
458
+ pasteContent(time?: number): boolean;
459
+ pasteKeyFrameValue(track: any, index: number): void;
460
+ pasteKeyFrames(pasteTime?: number): boolean;
461
+ /**
462
+ *
463
+ * @param {Int} trackIdx
464
+ * @param {Array} newValues array of values for each keyframe. It should be a flat array of size track.dim*numKeyframes. Check ADDKEY_VALUESINARRAYS flag
465
+ * @param {Array of numbers } newTimes must be ordered ascendently
466
+ * @param {Number} timeOffset
467
+ * @param {Int} flags
468
+ * KeyFramesTimeline.ADDKEY_VALUESINARRAYS: if set, newValues is an array of arrays, one for each entry [ [1,2,3], [5,6,7] ]. Times is still a flat array of values [ 0, 0.2 ]
469
+
470
+ * @returns
471
+ */
472
+ addKeyFrames(trackIdx: number, newValues: any[], newTimes: number[], timeOffset?: number, flags?: number): number[] | null;
473
+ deleteSelectedContent(skipCallback?: boolean): void;
474
+ deleteKeyFrames(trackIdx: number, indices: number[], skipCallback?: boolean): boolean;
475
+ /**
476
+ * Binary search. Relies on track.times being a sorted array
477
+ * @param {Object} track
478
+ * @param {Number} time
479
+ * @param {Number} mode on of the possible values
480
+ * - -1 = nearest frame with t[ f ] <= time
481
+ * - 0 = nearest frame
482
+ * - 1 = nearest frame with t[ f ] >= time
483
+ * @returns a zero/positive value if successful. On failure returnes -1 meaning either there are no frames ( 0 ), no frame-time is lower ( -1 ) or no frame-time is higher (1 )
484
+ */
485
+ getNearestKeyFrame(track: any, time: number, mode?: number): number;
486
+ /**
487
+ * get the nearest keyframe to "time" given a maximum threshold.
488
+ * @param {Object} track
489
+ * @param {Number} time
490
+ * @param {Number} threshold must be positive value
491
+ * @returns returns a postive/zero value if there is a frame inside the threshold range. Otherwise, -1
492
+ */
493
+ getCurrentKeyFrame(track: any, time: number, threshold?: number): number;
494
+ /**
495
+ * Returns the interval of frames between minTime and maxTime (both included )
496
+ * @param {Object} track
497
+ * @param {Number} minTime
498
+ * @param {Number} maxTime
499
+ * @param {Number} threshold must be positive value
500
+ * @returns an array with two values [ minFrame, maxFrame ]. Otherwise null
501
+ */
502
+ getKeyFramesInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
503
+ unHoverAll(): Nullable<[number, number]>;
504
+ deselectAllKeyFrames(): boolean;
505
+ isKeyFrameSelected(track: any, index: number): any;
506
+ /**
507
+ * @param {Int} trackIdx track index of animation clip
508
+ * @param {Int} frameIdx frame ( index ) to select inside the track
509
+ * @param {Boolean} skipCallback
510
+ * @returns
511
+ */
512
+ selectKeyFrame(trackIdx: number, frameIdx: number, skipCallback?: boolean): any[] | null;
513
+ deselectKeyFrame(trackIdx: number, frameIdx: number): boolean;
514
+ getNumKeyFramesSelected(): number;
515
+ /**
516
+ * helper function to process a selection with multiple keyframes. Sets the time of the timeline to the first selected keyframe
517
+ * @param {Number} trackIdx
518
+ * @param {Number} keyFrameIndex
519
+ * @param {Boolean} multipleSelection whether to append to selection or reset it and make this keyframe the only current selection
520
+ * @returns
521
+ */
522
+ processSelectionKeyFrame(trackIdx: number, keyFrameIndex: number, multipleSelection?: boolean): void;
523
+ /**
524
+ * @method clearTrack
525
+ */
526
+ clearTrack(trackIdx: number): number | undefined;
527
+ }
528
+ /**
529
+ * @class ClipsTimeline
530
+ */
531
+ export declare class ClipsTimeline extends Timeline {
532
+ #private;
533
+ static CLONEREASON_COPY: number;
534
+ static CLONEREASON_PASTE: number;
535
+ static CLONEREASON_HISTORY: number;
536
+ static CLONEREASON_TRACKCLONE: number;
537
+ lastClipsSelected: any;
538
+ lastTrackClipsMove: number;
539
+ dragClipMode: Nullable<string>;
540
+ lastHovered: Nullable<[number, number]>;
541
+ onSelectClip: Nullable<(clip: Nullable<any>) => void>;
542
+ onContentMoved: Nullable<(clip: Nullable<any>, delta: number) => void>;
543
+ onDeleteSelectedClips: Nullable<(selected: any[]) => void>;
544
+ onDeleteClip: Nullable<(trackIdx: number, clipIdx: number, clip: any) => void>;
545
+ /**
546
+ * @param {String} name
547
+ * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
548
+ */
549
+ constructor(name: string, options?: any);
550
+ /**
551
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
552
+ * @param {Object} animation data with which to generate an animationClip
553
+ * @returns
554
+ */
555
+ instantiateAnimationClip(animation: any, clone?: boolean): any;
556
+ /**
557
+ * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
558
+ * @returns
559
+ */
560
+ instantiateTrack(options?: any, clone?: boolean): any;
561
+ instantiateClip(options?: any): {
562
+ id: any;
563
+ start: any;
564
+ duration: any;
565
+ fadein: any;
566
+ fadeout: any;
567
+ clipColor: any;
568
+ fadeColor: any;
569
+ active: any;
570
+ trackIdx: number;
571
+ };
572
+ addNewTrack(options?: any, updateLeftPanel?: boolean, skipCallback?: boolean): any;
573
+ setAnimationClip(animation: any, needsToProcess?: boolean): any;
574
+ deselectAllElements(): void;
575
+ /**
576
+ * OVERRIDE ITEM SELECTION.
577
+ * CLIPS WILL OFFER NO SELECTION. All tracks are visible
578
+ */
579
+ changeSelectedItems(): void;
580
+ unHoverAll(): Nullable<[number, number]>;
581
+ onMouseUp(e: any): void;
582
+ onMouseDown(e: any, time: number): void;
583
+ onMouseMove(e: any, time: number): true | undefined;
584
+ drawContent(ctx: CanvasRenderingContext2D): void;
585
+ /**
586
+ * @method drawTrackWithBoxes
587
+ * @param {*} ctx
588
+ */
589
+ drawTrackWithBoxes(ctx: CanvasRenderingContext2D, y: number, trackHeight: number, track: any): void;
590
+ /**
591
+ * @method optimizeTrack
592
+ */
593
+ optimizeTrack(trackIdx: number): void;
594
+ /**
595
+ * @method optimizeTracks
596
+ */
597
+ optimizeTracks(): void;
598
+ /**
599
+ * @param {Object} clip clip to be added
600
+ * @param {Int} trackIdx ( optional ) track where to put the clip. -1 will find the first free slot. ***WARNING*** Must call getClipsInRange, before calling this function with a valid trackdIdx
601
+ * @param {Number} offsetTime ( optional ) offset time of current time
602
+ * @param {Number} searchStartTrackIdx ( optional ) if trackIdx is set to -1, this idx will be used as the starting point to find a valid track
603
+ * @returns a zero/positive value if successful. Otherwise, -1
604
+ */
605
+ addClip(clip: any, trackIdx?: number, offsetTime?: number, searchStartTrackIdx?: number): any;
606
+ /**
607
+ * Add an array of clips to the timeline in the first suitable tracks. It tries to put clips in the same track if possible. All clips will be in adjacent tracks to each other
608
+ * @param {Object[] } clips
609
+ * @param {Number} offsetTime
610
+ * @param {Int} searchStartTrackIdx
611
+ * @returns
612
+ */
613
+ addClips(clips: any[], offsetTime?: number, searchStartTrackIdx?: number): boolean;
614
+ deleteSelectedContent(skipCallback?: boolean): void;
615
+ /** Delete clip from the timeline
616
+ * @param {Number} trackIdx
617
+ * @param {Number} clipIdx clip to be deleted
618
+ */
619
+ deleteClip(trackIdx: number, clipIdx: number, skipCallback?: boolean): void;
620
+ /**
621
+ * User defined. Used when copying and pasting
622
+ * @param {Array of clips } clipsToClone array of original clips. Do not modify clips in this array
623
+ * @param {Number} timeOffset Value of time that should be added ( or subtracted ) from the timing attributes
624
+ * @param {Int} reason Flag to signal the reason of the clone
625
+ * @returns {Array of clips }
626
+ */
627
+ cloneClips(clipsToClone: any[], timeOffset: number, reason?: number): any;
628
+ /**
629
+ * Overwrite the "cloneClips" function to provide a custom cloning of clips. Otherwise, JSON serialization is used
630
+ */
631
+ copySelectedContent(): void;
632
+ pasteContent(time?: number): void;
633
+ /**
634
+ * @method clearTrack
635
+ */
636
+ clearTrack(trackIdx: number): void;
637
+ /**
638
+ * saveState function uses this to generate a "copy" of the track.
639
+ * @param {Number} trackIdx
640
+ * @returns All necessary information to reconstruct the track state
641
+ */
642
+ historyGenerateTrackStep(trackIdx: number): {
643
+ trackIdx: number;
644
+ clips: any;
645
+ edited: any;
646
+ };
647
+ /**
648
+ * It should swap the previous state with the incoming state of the track. It must return the previous state.
649
+ * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
650
+ * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
651
+ * @param {Boolean} isUndo
652
+ * @returns previous state object
653
+ */
654
+ historyApplyTrackStep(state: any, isUndo: boolean): {
655
+ trackIdx: any;
656
+ clips: any;
657
+ edited: any;
658
+ };
659
+ getClipOnTime(track: any, time: number, threshold: number): number;
660
+ deselectAllClips(): boolean;
661
+ selectAll(skipCallback?: boolean): void;
662
+ selectClip(trackIdx: number, clipIndex: number, deselect?: boolean, skipCallback?: boolean): number;
663
+ deselectClip(trackIdx: number, clipIndex: number): number;
664
+ getClipsInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
665
+ validateDuration(t: number): number;
666
+ setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
667
+ }
668
+ export {};