forked from Github/frigate
fix draggable element pixel alignment (#10708)
This commit is contained in:
@@ -382,12 +382,12 @@ function useDraggableElement({
|
||||
const timelineRect = timelineRef.current.getBoundingClientRect();
|
||||
const timelineTopAbsolute = timelineRect.top;
|
||||
const rect = segmentElement.getBoundingClientRect();
|
||||
const segmentTop =
|
||||
rect.top + scrolled - timelineTopAbsolute - segmentHeight / 2;
|
||||
const segmentTop = rect.top + scrolled - timelineTopAbsolute;
|
||||
const offset =
|
||||
((draggableElementTime - alignedSegmentTime) / segmentDuration) *
|
||||
segmentHeight;
|
||||
const newElementPosition = segmentTop - offset;
|
||||
// subtract half the height of the handlebar cross bar (4px) for pixel perfection
|
||||
const newElementPosition = segmentTop - offset - 2;
|
||||
|
||||
updateDraggableElementPosition(
|
||||
newElementPosition,
|
||||
|
||||
Reference in New Issue
Block a user