summaryrefslogtreecommitdiff
path: root/rust/crates/timeline/src/drag_utils.rs
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
committercashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
commitf5a82152394fde4d8f740f664ab7737b82861618 (patch)
tree5a51b181abead1ce03d2dbfc12b77918d3be0e1b /rust/crates/timeline/src/drag_utils.rs
parente837e7504379e100ff3b56282577ec67bb88bec9 (diff)
downloadopencut-f5a82152394fde4d8f740f664ab7737b82861618.tar.gz
feat: GPUI desktop port foundation
- scene crate: full project/scene/element model, serde round-trip proven against the web SerializedProject shape - transfer crate: .ocp zip container, cross-compat with web fflate archives proven in both directions - storage crate: filesystem project store replacing IndexedDB, .ocp import/export - media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails, waveform summaries) - playback crate: wall-clock anchored, frame-rounded playback clock - gpu crate: native texture readback; compositor renders headless offscreen on Vulkan (spike test) - flake devshell: rust toolchain, GPUI native deps, ffmpeg dev, bindgen clang args; GPUI hello-world builds - port plan in notes/gpui-port.md
Diffstat (limited to 'rust/crates/timeline/src/drag_utils.rs')
-rw-r--r--rust/crates/timeline/src/drag_utils.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/rust/crates/timeline/src/drag_utils.rs b/rust/crates/timeline/src/drag_utils.rs
new file mode 100644
index 00000000..6dcc6c6f
--- /dev/null
+++ b/rust/crates/timeline/src/drag_utils.rs
@@ -0,0 +1,14 @@
+use time::{MediaTime, TICKS_PER_SECOND};
+
+use crate::snap::BASE_TIMELINE_PIXELS_PER_SECOND;
+
+pub fn get_mouse_time_from_client_x(
+ client_x: f64,
+ container_left: f64,
+ zoom_level: f64,
+ scroll_left: f64,
+) -> MediaTime {
+ let mouse_x = client_x - container_left + scroll_left;
+ let seconds = (mouse_x / (BASE_TIMELINE_PIXELS_PER_SECOND * zoom_level)).max(0.0);
+ MediaTime::from_ticks((seconds * TICKS_PER_SECOND as f64).round() as i64)
+}