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