chore: fix the split view, reset window on timeline click (#27007)

This commit is contained in:
Pavel Feldman 2023-09-11 18:16:02 -07:00 committed by GitHub
parent d9eabda09d
commit 7c838653d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -182,15 +182,10 @@ export const Timeline: React.FunctionComponent<{
const action = model?.actions.findLast(action => action.startTime <= time);
if (action)
onSelected(action);
// Include both, last action as well as the click position.
if (selectedTime && (time < selectedTime.minimum || time > selectedTime.maximum)) {
const minimum = action ? Math.max(Math.min(action.startTime, time), boundaries.minimum) : boundaries.minimum;
const maximum = action ? Math.min(Math.max(action.endTime, time), boundaries.maximum) : boundaries.maximum;
setSelectedTime({ minimum, maximum });
}
setSelectedTime(undefined);
}
setDragWindow(undefined);
}, [boundaries, dragWindow, measure, model, selectedTime, setSelectedTime, onSelected]);
}, [boundaries, dragWindow, measure, model, setSelectedTime, onSelected]);
const onMouseMove = React.useCallback((event: React.MouseEvent) => {
if (!ref.current)

View file

@ -47,11 +47,11 @@ export const SplitView: React.FC<SplitViewProps> = ({
let size: number;
if (orientation === 'vertical') {
size = vSize / window.devicePixelRatio;
if (measure && measure.height < vSize)
if (measure && measure.height < size)
size = measure.height - 10;
} else {
size = hSize / window.devicePixelRatio;
if (measure && measure.width < hSize)
if (measure && measure.width < size)
size = measure.width - 10;
}