sindresorhus/capture-website

Capturing website with webgl-canvas only captures initial angle

ollejj opened this issue · 4 comments

When using the "captureWebsite.file" function on a page with a 360-degree panorama image on a webgl-canvas is only screenshotting the initial 'angle'.

No matter what angle i position the panorama in, it will always generate the output from the same angle.

Try using some of the options to delay the capture.

I did, but it's like your API reads the page before any user-update no matter what.
(No critisism btw, I like this API)

These are the steps:

  1. My page loads
  2. An async function loads properties from an XML-file
  3. The cameras Pan/Tilt are predefined in this XML
  4. I manually pan to a random angle
  5. I run the code with 'node capture.js'
  6. I get the output.png

capture.js
const captureWebsite = require('capture-website');

(() => {
captureWebsite.file('http://localhost:61828/ayeW2Mw6/index.html', 'screenshot.png', {
delay: 10
});
})();

Solved it by some quirky method.
For any future readers that are experiencing the same issue:
I had an XML that stored the start-angle of the camera. Changing these angles (pan/tilt) and then screenshotting
will grab the graphics at that specific angle.

My solution:

  • Before screenshotting, send the angle that you want to screenshot to backend.
  • Update the hard-coded angles in the file that you're storing them in to the new ones.
  • Grab the screenshot.

However the weird thing about this (maybe @sindresorhus can answer this) is that this library doesn't read from the XML at all. So I have NO idea why this worked.