@twick/video-editor 0.15.26 → 0.15.27
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.js +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -19599,15 +19599,28 @@ function TimelineView({
|
|
|
19599
19599
|
const handleDragWithDrop = React.useCallback(
|
|
19600
19600
|
(payload, dropPointer) => {
|
|
19601
19601
|
var _a;
|
|
19602
|
-
if (dropPointer
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19602
|
+
if (!dropPointer || !onElementDrop) {
|
|
19603
|
+
onElementDrag(payload);
|
|
19604
|
+
return;
|
|
19605
|
+
}
|
|
19606
|
+
const rect = (_a = timelineContentRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
19607
|
+
const dropTarget = rect ? getTrackOrSeparatorAt(dropPointer.clientY, rect.top, TRACK_HEIGHT) : null;
|
|
19608
|
+
if ((dropTarget == null ? void 0 : dropTarget.type) === "track") {
|
|
19609
|
+
const elementTrackId = payload.element.getTrackId();
|
|
19610
|
+
const elementTrackIndex = (tracks || []).findIndex(
|
|
19611
|
+
(t2) => t2.getId() === elementTrackId
|
|
19612
|
+
);
|
|
19613
|
+
if (elementTrackIndex === dropTarget.trackIndex) {
|
|
19614
|
+
onElementDrag(payload);
|
|
19615
|
+
return;
|
|
19616
|
+
}
|
|
19617
|
+
} else if (!dropTarget) {
|
|
19607
19618
|
onElementDrag(payload);
|
|
19619
|
+
return;
|
|
19608
19620
|
}
|
|
19621
|
+
onElementDrop({ ...payload, dropTarget });
|
|
19609
19622
|
},
|
|
19610
|
-
[onElementDrag, onElementDrop]
|
|
19623
|
+
[onElementDrag, onElementDrop, tracks]
|
|
19611
19624
|
);
|
|
19612
19625
|
useEdgeAutoScroll({
|
|
19613
19626
|
isActive: !!draggingElementId,
|
|
@@ -19879,13 +19892,14 @@ const useTimelineManager = () => {
|
|
|
19879
19892
|
const deltaMin = -minStart;
|
|
19880
19893
|
const deltaMax = duration - maxEnd;
|
|
19881
19894
|
const clampedDelta = Math.max(deltaMin, Math.min(deltaMax, delta));
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
}
|
|
19895
|
+
const batchUpdates = elements.map((el) => ({
|
|
19896
|
+
elementId: el.getId(),
|
|
19897
|
+
updates: {
|
|
19898
|
+
s: el.getStart() + clampedDelta,
|
|
19899
|
+
e: el.getEnd() + clampedDelta
|
|
19900
|
+
}
|
|
19901
|
+
}));
|
|
19902
|
+
editor.updateElements(batchUpdates);
|
|
19889
19903
|
setSelectedItem(element);
|
|
19890
19904
|
editor.refresh();
|
|
19891
19905
|
return;
|
|
@@ -19902,10 +19916,10 @@ const useTimelineManager = () => {
|
|
|
19902
19916
|
}
|
|
19903
19917
|
}
|
|
19904
19918
|
}
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
setSelectedItem(
|
|
19919
|
+
editor.updateElements([
|
|
19920
|
+
{ elementId: element.getId(), updates: { s: updates.start, e: updates.end } }
|
|
19921
|
+
]);
|
|
19922
|
+
setSelectedItem(element);
|
|
19909
19923
|
editor.refresh();
|
|
19910
19924
|
};
|
|
19911
19925
|
const isElementTrackType = (track) => track.getType() === timeline.TRACK_TYPES.ELEMENT;
|