Skip to content

Commit

Permalink
Merge pull request #1676 from xeokit/fix/snapshots-plugin
Browse files Browse the repository at this point in the history
[FIX] Fix snapshots in presence of multiple plugins
  • Loading branch information
xeolabs committed Sep 19, 2024
2 parents ad83bfc + c2ce29b commit 0ab414d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,14 @@ class Viewer {

for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
const containerElement = pluginContainerElements[i];
//only calculate the scale for first plugin
//for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
//resulting in increase/decreased size for the the canvas that is being overlapped
const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
await html2canvas(containerElement, {
canvas: snapshotCanvas,
backgroundColor: null,
scale: snapshotCanvas.width / containerElement.clientWidth
scale
});
}
if (!params.includeGizmos) {
Expand Down

0 comments on commit 0ab414d

Please sign in to comment.