fix: address native cursor review findings

This commit is contained in:
EtienneLescot
2026-05-05 22:07:08 +02:00
parent 9b85cacec7
commit 826790fe52
5 changed files with 92 additions and 23 deletions
@@ -89,6 +89,15 @@ import {
import { UnsavedChangesDialog } from "./UnsavedChangesDialog";
import VideoPlayback, { VideoPlaybackRef } from "./VideoPlayback";
function isClickInteractionType(interactionType: string | null | undefined) {
return (
interactionType === "click" ||
interactionType === "double-click" ||
interactionType === "right-click" ||
interactionType === "middle-click"
);
}
export default function VideoEditor() {
const {
state: editorState,
@@ -188,6 +188,25 @@ function getResolvedVideoDuration(video: HTMLVideoElement): number | null {
return null;
}
function getEndedVideoDuration(video: HTMLVideoElement): number | null {
const currentTime = video.currentTime;
if (!Number.isFinite(currentTime) || currentTime <= 0) {
return null;
}
if (video.ended) {
return currentTime;
}
const resolvedDuration = getResolvedVideoDuration(video);
const durationEpsilonSeconds = 0.05;
if (resolvedDuration && currentTime >= resolvedDuration - durationEpsilonSeconds) {
return resolvedDuration;
}
return null;
}
const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
(
{