mirror of https://github.com/mifi/lossless-cut
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
625 B
JavaScript
27 lines
625 B
JavaScript
|
6 years ago
|
import uuid from 'uuid';
|
||
|
|
|
||
|
|
import { generateColor } from './util';
|
||
|
|
|
||
|
|
export const createSegment = ({ start, end, name } = {}) => ({
|
||
|
|
start,
|
||
|
|
end,
|
||
|
|
name: name || '',
|
||
|
|
color: generateColor(),
|
||
|
|
uuid: uuid.v4(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const createInitialCutSegments = () => [createSegment()];
|
||
|
|
|
||
|
|
// Because segments could have undefined start / end
|
||
|
|
// (meaning extend to start of timeline or end duration)
|
||
|
|
export function getSegApparentStart(seg) {
|
||
|
|
const time = seg.start;
|
||
|
|
return time !== undefined ? time : 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getCleanCutSegments = (cs) => cs.map((seg) => ({
|
||
|
|
start: seg.start,
|
||
|
|
end: seg.end,
|
||
|
|
name: seg.name,
|
||
|
|
}));
|