chore: fix the split view, reset window on timeline click (#27007)
This commit is contained in:
parent
d9eabda09d
commit
7c838653d6
|
|
@ -182,15 +182,10 @@ export const Timeline: React.FunctionComponent<{
|
||||||
const action = model?.actions.findLast(action => action.startTime <= time);
|
const action = model?.actions.findLast(action => action.startTime <= time);
|
||||||
if (action)
|
if (action)
|
||||||
onSelected(action);
|
onSelected(action);
|
||||||
// Include both, last action as well as the click position.
|
setSelectedTime(undefined);
|
||||||
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 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setDragWindow(undefined);
|
setDragWindow(undefined);
|
||||||
}, [boundaries, dragWindow, measure, model, selectedTime, setSelectedTime, onSelected]);
|
}, [boundaries, dragWindow, measure, model, setSelectedTime, onSelected]);
|
||||||
|
|
||||||
const onMouseMove = React.useCallback((event: React.MouseEvent) => {
|
const onMouseMove = React.useCallback((event: React.MouseEvent) => {
|
||||||
if (!ref.current)
|
if (!ref.current)
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ export const SplitView: React.FC<SplitViewProps> = ({
|
||||||
let size: number;
|
let size: number;
|
||||||
if (orientation === 'vertical') {
|
if (orientation === 'vertical') {
|
||||||
size = vSize / window.devicePixelRatio;
|
size = vSize / window.devicePixelRatio;
|
||||||
if (measure && measure.height < vSize)
|
if (measure && measure.height < size)
|
||||||
size = measure.height - 10;
|
size = measure.height - 10;
|
||||||
} else {
|
} else {
|
||||||
size = hSize / window.devicePixelRatio;
|
size = hSize / window.devicePixelRatio;
|
||||||
if (measure && measure.width < hSize)
|
if (measure && measure.width < size)
|
||||||
size = measure.width - 10;
|
size = measure.width - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue