Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading