Skip to content

Commit

Permalink
chore: fix the split view, reset window on timeline click (#27007)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman authored Sep 12, 2023
1 parent d9eabda commit 7c83865
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions packages/trace-viewer/src/ui/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/splitView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7c83865

Please sign in to comment.