question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create a range selection by clicking on a screenshot

See original GitHub issue

As a ~PM stumbling through a profile~ user investigating a responsiveness issue, I want to be able to select the nsRefreshDriver::Tick for a screenshot, so that I can quickly and accurately focus on the code that produced the frame.

I can currently select nsRefreshDriver::Tick by double clicking on the entry in the Stack Chart. It would nice if I could create the range selection by, for example, clicking a screenshot. This would allow me to remain on my current view and to more quickly and accurately create the selection than trying to eyeball the correct Tick below (and starting slightly before) a screenshot.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
julienwcommented, Oct 14, 2020

I think your outline looks good.

Just a quick precision from looking at the code: I think we’ll have to change a bit HoverPreview too. Indeed, I believe the new code you’ll add will be in Screenshots. Therefore I suggest that findScreenshotAtMouse will be moved to Screenshots: then Screenshots will retrieve the current hovered screenshot, and pass directly a ScreenshotPayload to HoverPreview.

About the 2 remarks from Greg:

  • You may need to compare the start time of the marker at that point, and the next marker.

He meant that, to find the new range, you might need to look at the next screenshot. I think that should be OK to look at start and start + dur which should already take that into account, but Greg’s comment was that this might not be the case.

  • Make sure to handle clicking the last or first screenshot correctly.

This is only a warning that the last or first screenshot in a track may behave differently. So just take care that they work. Again I think that start and start+dur should already take that into account, but please just double-check these cases.

Hope this helps!

0reactions
nibble0101commented, Oct 15, 2020

Therefore I suggest that findScreenshotAtMouse will be moved to Screenshots: then Screenshots will retrieve the current hovered screenshot, and pass directly a ScreenshotPayload to HoverPreview

Since the above comment, I have made some major changes.

  1. I wanted to do the extraction in the render method but then essentially I will have to do something like:
    const { pageX, offsetX, containerTop } = this.state;
    let payload: ScreenshotPayload | null;
    if (offsetX !== null) {
      const screenshotIndex = this.findScreenshotAtMouse(offsetX);
      if (screenshotIndex === null) {
        payload = null;
      } else {
        payload = (screenshots[screenshotIndex].data: any);
      }
    } else {
      payload = null;
    }

and then pass payload to HoverPreview. 2) Have payload in state and then pass it to HoverPreview.

I prefer the first one over the second one because I think payload will just be redundant in state because it is derived from offsetX.

This is what is left in HoverPreview after moving findScreenshotAtMouse to Screenshots.

if (
      isMakingPreviewSelection ||
      offsetX === null ||
      pageX === null ||
      payload === null
    ) {
      return null;
    }
    const { url, windowWidth, windowHeight } = payload;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically display cell range contents in a picture
The contents of the cell range is displayed in the picture. To format the picture or do other operations, right click the picture...
Read more >
How to take a screenshot of part of your screen - ContractSafe
Click and drag on your screen to select the part of your screen you want to capture. A screenshot of the screen region...
Read more >
Use the Camera tool in Excel to create dynamic screenshots
In the Choose Commands from box, select All Commands from the drop-down menu. Scroll down the list below the drop down and select...
Read more >
Convert Selected Range into an Image Using Macros In Excel
Convert Selected Range into an Image in Excel - Create your own ... With just one click, you have now created a screenshot...
Read more >
Using Excel's Hidden Camera to Create Live Screenshots
Select the cells you want to capture in a screenshot. Click on Camera on the Quick Access Toolbar. The mouse pointer will change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found