mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
fix: one more
This commit is contained in:
@@ -3,6 +3,7 @@ import type { ComputeDropTargetParams, DropTarget } from "@/lib/timeline";
|
|||||||
import { resolveTrackPlacement } from "@/lib/timeline/placement";
|
import { resolveTrackPlacement } from "@/lib/timeline/placement";
|
||||||
import { TIMELINE_TRACK_GAP_PX } from "./layout";
|
import { TIMELINE_TRACK_GAP_PX } from "./layout";
|
||||||
import { getTrackHeight } from "./track-layout";
|
import { getTrackHeight } from "./track-layout";
|
||||||
|
import { TICKS_PER_SECOND } from "@/lib/wasm";
|
||||||
|
|
||||||
function findElementAtPosition({
|
function findElementAtPosition({
|
||||||
mouseX,
|
mouseX,
|
||||||
@@ -19,7 +20,9 @@ function findElementAtPosition({
|
|||||||
pixelsPerSecond: number;
|
pixelsPerSecond: number;
|
||||||
zoomLevel: number;
|
zoomLevel: number;
|
||||||
}): { elementId: string; trackId: string } | null {
|
}): { elementId: string; trackId: string } | null {
|
||||||
const time = mouseX / (pixelsPerSecond * zoomLevel);
|
const time = Math.round(
|
||||||
|
(mouseX / (pixelsPerSecond * zoomLevel)) * TICKS_PER_SECOND,
|
||||||
|
);
|
||||||
const track = tracks[trackIndex];
|
const track = tracks[trackIndex];
|
||||||
if (!track || !("elements" in track)) return null;
|
if (!track || !("elements" in track)) return null;
|
||||||
|
|
||||||
@@ -112,7 +115,9 @@ export function computeDropTarget({
|
|||||||
? startTimeOverride
|
? startTimeOverride
|
||||||
: isExternalDrop
|
: isExternalDrop
|
||||||
? playheadTime
|
? playheadTime
|
||||||
: Math.max(0, mouseX / (pixelsPerSecond * zoomLevel));
|
: Math.round(
|
||||||
|
Math.max(0, mouseX / (pixelsPerSecond * zoomLevel)) * TICKS_PER_SECOND,
|
||||||
|
);
|
||||||
|
|
||||||
if (orderedTracks.length === 0) {
|
if (orderedTracks.length === 0) {
|
||||||
const placementResult = resolveTrackPlacement({
|
const placementResult = resolveTrackPlacement({
|
||||||
|
|||||||
Reference in New Issue
Block a user