fix: allow item drag/resize to snap at column 0
- Removed Math.max(beatSec, ...) clamp from clip drag, section drag, section resize handlers - Replaced with Math.max(0, ...) so items can snap to time 0
This commit is contained in:
@@ -10322,11 +10322,11 @@ const App = () => {
|
||||
const mouseX = e.clientX - rect.left + scrollLeft;
|
||||
const time = Math.max(0, mouseX / zoom - leadInMarginRef.current);
|
||||
const beatSec = (60.0 / (parseInt(bpmRef.current) || 120));
|
||||
const rawStart = Math.max(beatSec, time - drag.clickOffset);
|
||||
const rawStart = Math.max(0, time - drag.clickOffset);
|
||||
const secPerBar = beatSec * 4;
|
||||
const marginBar = maxDurationRef.current - secPerBar;
|
||||
const clampedStart = Math.min(rawStart, marginBar);
|
||||
const newStart = snapTime(clampedStart, snapValueRef.current, bpmRef.current);
|
||||
const newStart = snapTime(Math.max(0, clampedStart), snapValueRef.current, bpmRef.current);
|
||||
const itemPx = newStart * zoom;
|
||||
const keepMargin = 80;
|
||||
if (itemPx > scrollLeft + rect.width - keepMargin) {
|
||||
@@ -10492,7 +10492,7 @@ const App = () => {
|
||||
const beatSec = (60.0 / (parseInt(bpm) || 120));
|
||||
const secondsPerBar = beatSec * 4;
|
||||
const marginBar = maxDurationRef.current - secondsPerBar;
|
||||
const rawStart = Math.max(beatSec, Math.min(time - drag.clickOffset, marginBar));
|
||||
const rawStart = Math.max(0, Math.min(time - drag.clickOffset, marginBar));
|
||||
const newStart = snapTime(rawStart, snapValueRef.current, bpmRef.current);
|
||||
const itemPx = newStart * zoom;
|
||||
const keepMargin = 80;
|
||||
@@ -10573,7 +10573,7 @@ const App = () => {
|
||||
const item = items[idx];
|
||||
if (resize.side === 'left') {
|
||||
const beatSec = (60.0 / (parseInt(bpm) || 120));
|
||||
const newStart = Math.max(beatSec, Math.min(time, resize.originalStart + resize.originalDuration - 0.1));
|
||||
const newStart = Math.max(0, Math.min(time, resize.originalStart + resize.originalDuration - 0.1));
|
||||
const end = resize.originalStart + resize.originalDuration;
|
||||
const newDuration = end - newStart;
|
||||
if (newDuration < 0.1) return t;
|
||||
|
||||
Reference in New Issue
Block a user