From c2ce29bd769786e72d01f25d6c364cd34bd42e6b Mon Sep 17 00:00:00 2001 From: ijlal99 Date: Thu, 19 Sep 2024 19:05:53 +0500 Subject: [PATCH] Fix snapshots in presence of multiple plugins --- src/viewer/Viewer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/viewer/Viewer.js b/src/viewer/Viewer.js index 5a1090e8d..39c1bcb6c 100644 --- a/src/viewer/Viewer.js +++ b/src/viewer/Viewer.js @@ -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) {