Ngl: makeImage with trim:true leaves canvas in body element

Created on 18 Aug 2016  路  4Comments  路  Source: nglviewer/ngl

Hi Alex!

With trim set to true in makeImage, the code generates a new canvas element distinct from the one that gets disposed of in the TiledRenderer dispose() method, and it hangs around in the background of the page

I have a quick hack that gets rid of it but you may have something more elegant:

basically after this line
https://github.com/arose/ngl/blob/0b7a4fd53b950cf3e1411360f96d18a9512b88c5/src/viewer/viewer-utils.js#L191

I've added this to my current copy of the code

if (canvas.parentNode) {   // if canvas is now the trimmed canvas, not the tiledrenderer canvas
    document.body.removeChild (canvas);
}
bug

All 4 comments

I got the same issue.

I don't know why I add the canvas to the document in the first place. I removed that behavior (5277ee86ae9d5eb288330cdc66bc6c5101ad3cfb) and I still got to download images in all 4 major browser.

@hainm @martingraham does this fix it for you?

yes. thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iwatobipen picture iwatobipen  路  4Comments

stefdoerr picture stefdoerr  路  3Comments

fcharih picture fcharih  路  3Comments

fredludlow picture fredludlow  路  3Comments

garyo picture garyo  路  5Comments