fix(trace-viewer): display trace without viewport (#7101)

This commit is contained in:
Max Schmitt 2021-06-14 08:11:30 -07:00 committed by GitHub
parent 1448f60547
commit ad5280e5cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,11 +38,12 @@ export const FilmStrip: React.FunctionComponent<{
const screencastFrames = context.pages[pageIndex]?.screencastFrames; const screencastFrames = context.pages[pageIndex]?.screencastFrames;
let previewImage = undefined; let previewImage = undefined;
let previewSize = undefined;
if (previewPoint !== undefined && screencastFrames) { if (previewPoint !== undefined && screencastFrames) {
const previewTime = boundaries.minimum + (boundaries.maximum - boundaries.minimum) * previewPoint.x / measure.width; const previewTime = boundaries.minimum + (boundaries.maximum - boundaries.minimum) * previewPoint.x / measure.width;
previewImage = screencastFrames[upperBound(screencastFrames, previewTime, timeComparator) - 1]; previewImage = screencastFrames[upperBound(screencastFrames, previewTime, timeComparator) - 1];
previewSize = inscribe({width: previewImage.width, height: previewImage.height}, { width: 600, height: 600 });
} }
const previewSize = inscribe(context.options.viewport!, { width: 600, height: 600 });
return <div className='film-strip' ref={ref}>{ return <div className='film-strip' ref={ref}>{
context.pages.filter(p => p.screencastFrames.length).map((page, index) => <FilmStripLane context.pages.filter(p => p.screencastFrames.length).map((page, index) => <FilmStripLane
@ -52,7 +53,7 @@ export const FilmStrip: React.FunctionComponent<{
key={index} key={index}
/>) />)
} }
{previewImage && previewPoint?.x !== undefined && {previewImage && previewSize && previewPoint?.x !== undefined &&
<div className='film-strip-hover' style={{ <div className='film-strip-hover' style={{
width: previewSize.width, width: previewSize.width,
height: previewSize.height, height: previewSize.height,