@cyca/react-timeline-editor 0.2.4-alpha.3 → 0.2.4-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-6kJWhJ-8.cjs +1 -0
- package/dist/index-aC1-xztU.js +83 -0
- package/dist/index.d.ts +10 -0
- package/dist/react-timeline-editor.cjs +4 -4
- package/dist/react-timeline-editor.js +1769 -1836
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +5 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/index-Do2XgyZc.js +0 -77
- package/dist/index-HslTC57T.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c="timeline-editor";function _(o,t){const{startLeft:T,scale:n,scaleWidth:s}=t;return T+o/n*s}function E(o,t){const{startLeft:T,scale:n,scaleWidth:s}=t;return(o-T)/s*n}function A(o,t){const{left:T,width:n}=o,s=E(T,t),e=E(T+n,t);return{start:s,end:e}}function r(o,t){const{start:T,end:n}=o,s=_(T,t),e=_(n,t)-s;return{left:s,width:e}}function L(o,t){let T=0;return o.forEach(s=>{s.actions.forEach(e=>{T=Math.max(T,e.end)})}),Math.ceil(T/t.scale)+(t.pad??2)}function i(o,t){const{startLeft:T,scaleWidth:n}=t,s=Math.ceil((o-T)/n);return Math.max(s+2,t.scaleCount)}function a(o,t){const T=[];return o.forEach(n=>{T.push({value:_(n.start,t),actionId:n.id}),T.push({value:_(n.end,t),actionId:n.id})}),T}exports.DEFAULT_MOVE_GRID=1;exports.DEFAULT_ROW_HEIGHT=32;exports.DEFAULT_SCALE=1;exports.DEFAULT_SCALE_SPLIT_COUNT=10;exports.DEFAULT_SCALE_WIDTH=160;exports.DEFAULT_SNAP_DISTANCE=8;exports.DEFAULT_START_LEFT=20;exports.MIN_SCALE_COUNT=20;exports.PREFIX=c;exports.START_CURSOR_TIME=0;exports.getScaleCountByPixel=i;exports.getScaleCountByRows=L;exports.parserActionsToPositions=a;exports.parserPixelToTime=E;exports.parserTimeToPixel=_;exports.parserTimeToTransform=r;exports.parserTransformToTime=A;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const T = "timeline-editor", i = 0, u = 1, _ = 10, E = 160, A = 20, l = 1, L = 8, f = 32, C = 20;
|
|
2
|
+
function e(o, t) {
|
|
3
|
+
const {
|
|
4
|
+
startLeft: s,
|
|
5
|
+
scale: n,
|
|
6
|
+
scaleWidth: c
|
|
7
|
+
} = t;
|
|
8
|
+
return s + o / n * c;
|
|
9
|
+
}
|
|
10
|
+
function r(o, t) {
|
|
11
|
+
const {
|
|
12
|
+
startLeft: s,
|
|
13
|
+
scale: n,
|
|
14
|
+
scaleWidth: c
|
|
15
|
+
} = t;
|
|
16
|
+
return (o - s) / c * n;
|
|
17
|
+
}
|
|
18
|
+
function D(o, t) {
|
|
19
|
+
const {
|
|
20
|
+
left: s,
|
|
21
|
+
width: n
|
|
22
|
+
} = o, c = r(s, t), a = r(s + n, t);
|
|
23
|
+
return {
|
|
24
|
+
start: c,
|
|
25
|
+
end: a
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function d(o, t) {
|
|
29
|
+
const {
|
|
30
|
+
start: s,
|
|
31
|
+
end: n
|
|
32
|
+
} = o, c = e(s, t), a = e(n, t) - c;
|
|
33
|
+
return {
|
|
34
|
+
left: c,
|
|
35
|
+
width: a
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function S(o, t) {
|
|
39
|
+
let s = 0;
|
|
40
|
+
return o.forEach((c) => {
|
|
41
|
+
c.actions.forEach((a) => {
|
|
42
|
+
s = Math.max(s, a.end);
|
|
43
|
+
});
|
|
44
|
+
}), Math.ceil(s / t.scale) + (t.pad ?? 2);
|
|
45
|
+
}
|
|
46
|
+
function h(o, t) {
|
|
47
|
+
const {
|
|
48
|
+
startLeft: s,
|
|
49
|
+
scaleWidth: n
|
|
50
|
+
} = t, c = Math.ceil((o - s) / n);
|
|
51
|
+
return Math.max(c + 2, t.scaleCount);
|
|
52
|
+
}
|
|
53
|
+
function U(o, t) {
|
|
54
|
+
const s = [];
|
|
55
|
+
return o.forEach((n) => {
|
|
56
|
+
s.push({
|
|
57
|
+
value: e(n.start, t),
|
|
58
|
+
actionId: n.id
|
|
59
|
+
}), s.push({
|
|
60
|
+
value: e(n.end, t),
|
|
61
|
+
actionId: n.id
|
|
62
|
+
});
|
|
63
|
+
}), s;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
u as D,
|
|
67
|
+
C as M,
|
|
68
|
+
T as P,
|
|
69
|
+
i as S,
|
|
70
|
+
_ as a,
|
|
71
|
+
E as b,
|
|
72
|
+
A as c,
|
|
73
|
+
f as d,
|
|
74
|
+
l as e,
|
|
75
|
+
L as f,
|
|
76
|
+
d as g,
|
|
77
|
+
D as h,
|
|
78
|
+
h as i,
|
|
79
|
+
r as j,
|
|
80
|
+
S as k,
|
|
81
|
+
U as l,
|
|
82
|
+
e as p
|
|
83
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -276,6 +276,16 @@ export declare interface TimelineEditor extends EditData {
|
|
|
276
276
|
* @default false
|
|
277
277
|
*/
|
|
278
278
|
autoScroll?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* @description Auto scroll speed (default 1)
|
|
281
|
+
* @default 1
|
|
282
|
+
*/
|
|
283
|
+
autoScrollSpeed?: number;
|
|
284
|
+
/**
|
|
285
|
+
* @description Auto scroll max speed (default 10)
|
|
286
|
+
* @default 10
|
|
287
|
+
*/
|
|
288
|
+
autoScrollMaxSpeed?: number;
|
|
279
289
|
/**
|
|
280
290
|
* @description Custom timeline style
|
|
281
291
|
*/
|