diff --git a/web/html/threeVisualizer.html b/web/html/threeVisualizer.html index 5de6546..6527421 100644 --- a/web/html/threeVisualizer.html +++ b/web/html/threeVisualizer.html @@ -27,6 +27,7 @@ } + diff --git a/web/js/threeVisualizer.js b/web/js/threeVisualizer.js index 0652b08..033f781 100644 --- a/web/js/threeVisualizer.js +++ b/web/js/threeVisualizer.js @@ -174,4 +174,16 @@ if (referenceTexture && depthTexture) { frameUpdate(); } +document.getElementById('screenshotButton').addEventListener('click', takeScreenshot); + +function takeScreenshot() { + renderer.render(scene, camera); + const dataURL = renderer.domElement.toDataURL('image/png'); + const link = document.createElement('a'); + link.href = dataURL; + link.download = "screenshot.png"; + link.click(); + console.log("Screenshot taken"); +} + main(); \ No newline at end of file diff --git a/web/style/threeStyle.css b/web/style/threeStyle.css index dab2f09..2b7392a 100644 --- a/web/style/threeStyle.css +++ b/web/style/threeStyle.css @@ -88,4 +88,32 @@ a, button, input, select { background-color: #f00; margin-top: 20px; padding: 10px; +} + +#screenshotButton { + position: absolute; + bottom: 10px; /* Adjust as needed */ + left: 10px; /* Position to the left */ + z-index: 10; /* Ensure this is above the canvas's z-index */ + padding: 5px 5px; + border: none; + border-radius: 5px; + background: linear-gradient(145deg, #007bff, #0056b3); + color: #ffffff; + font-size: 10px; + cursor: pointer; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: background 0.3s ease-in-out, transform 0.2s ease; +} + +#screenshotButton:hover { + background: linear-gradient(145deg, #0056b3, #007bff); + transform: translateY(-2px); + box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); +} + +#screenshotButton:active { + background: #0056b3; + transform: translateY(1px); + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); } \ No newline at end of file