@twick/video-editor 0.15.25 → 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.
@@ -112,16 +112,8 @@ export declare const AVAILABLE_TEXT_FONTS: {
112
112
  readonly PATTAYA: "Pattaya";
113
113
  /** Unique display font */
114
114
  readonly PERALTA: "Peralta";
115
- /** Bold impact font */
116
- readonly IMPACT: "Impact";
117
115
  /** Handwritten-style font */
118
116
  readonly LUMANOSIMO: "Lumanosimo";
119
117
  /** Custom display font */
120
118
  readonly KAPAKANA: "Kapakana";
121
- /** Handwritten font */
122
- readonly HANDYRUSH: "HandyRush";
123
- /** Decorative font */
124
- readonly DASHER: "Dasher";
125
- /** Signature-style font */
126
- readonly BRITTANY_SIGNATURE: "Brittany Signature";
127
119
  };
package/dist/index.js CHANGED
@@ -9190,18 +9190,10 @@ const AVAILABLE_TEXT_FONTS = {
9190
9190
  // CDN Fonts
9191
9191
  /** Unique display font */
9192
9192
  PERALTA: "Peralta",
9193
- /** Bold impact font */
9194
- IMPACT: "Impact",
9195
9193
  /** Handwritten-style font */
9196
9194
  LUMANOSIMO: "Lumanosimo",
9197
9195
  /** Custom display font */
9198
- KAPAKANA: "Kapakana",
9199
- /** Handwritten font */
9200
- HANDYRUSH: "HandyRush",
9201
- /** Decorative font */
9202
- DASHER: "Dasher",
9203
- /** Signature-style font */
9204
- BRITTANY_SIGNATURE: "Brittany Signature"
9196
+ KAPAKANA: "Kapakana"
9205
9197
  };
9206
9198
  const DEFAULT_DROP_DURATION = 5;
9207
9199
  function useTimelineDrop({
@@ -19607,15 +19599,28 @@ function TimelineView({
19607
19599
  const handleDragWithDrop = React.useCallback(
19608
19600
  (payload, dropPointer) => {
19609
19601
  var _a;
19610
- if (dropPointer && onElementDrop) {
19611
- const rect = (_a = timelineContentRef.current) == null ? void 0 : _a.getBoundingClientRect();
19612
- const dropTarget = rect ? getTrackOrSeparatorAt(dropPointer.clientY, rect.top, TRACK_HEIGHT) : null;
19613
- onElementDrop({ ...payload, dropTarget });
19614
- } else {
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) {
19615
19618
  onElementDrag(payload);
19619
+ return;
19616
19620
  }
19621
+ onElementDrop({ ...payload, dropTarget });
19617
19622
  },
19618
- [onElementDrag, onElementDrop]
19623
+ [onElementDrag, onElementDrop, tracks]
19619
19624
  );
19620
19625
  useEdgeAutoScroll({
19621
19626
  isActive: !!draggingElementId,
@@ -19887,13 +19892,14 @@ const useTimelineManager = () => {
19887
19892
  const deltaMin = -minStart;
19888
19893
  const deltaMax = duration - maxEnd;
19889
19894
  const clampedDelta = Math.max(deltaMin, Math.min(deltaMax, delta));
19890
- for (const el of elements) {
19891
- const newStart = el.getStart() + clampedDelta;
19892
- const newEnd = el.getEnd() + clampedDelta;
19893
- el.setStart(newStart);
19894
- el.setEnd(newEnd);
19895
- editor.updateElement(el);
19896
- }
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);
19897
19903
  setSelectedItem(element);
19898
19904
  editor.refresh();
19899
19905
  return;
@@ -19910,10 +19916,10 @@ const useTimelineManager = () => {
19910
19916
  }
19911
19917
  }
19912
19918
  }
19913
- element.setStart(updates.start);
19914
- element.setEnd(updates.end);
19915
- const updatedElement = editor.updateElement(element);
19916
- setSelectedItem(updatedElement);
19919
+ editor.updateElements([
19920
+ { elementId: element.getId(), updates: { s: updates.start, e: updates.end } }
19921
+ ]);
19922
+ setSelectedItem(element);
19917
19923
  editor.refresh();
19918
19924
  };
19919
19925
  const isElementTrackType = (track) => track.getType() === timeline.TRACK_TYPES.ELEMENT;