allow snapshots in jpeg format

This commit is contained in:
mig 2017-05-11 22:38:01 +02:00
parent dd07e5cf9b
commit 48fd8c6e72
2 changed files with 5 additions and 3 deletions

View file

@ -279,11 +279,13 @@ $(document).ready(function () {
}); });
$("#snapshot").on("click",function() { $("#snapshot").on("click",function() {
match.viewControl("takeSnapshot") match.viewControl("takeSnapshot",{
format: "jpeg"
})
.then((snapshot)=>{ .then((snapshot)=>{
var a = document.createElement("a"); var a = document.createElement("a");
a.href = snapshot; a.href = snapshot;
a.setAttribute("download",gameName+".png"); a.setAttribute("download",gameName+".jpg");
a.click(); a.click();
}) })
.catch((error)=>{ .catch((error)=>{

View file

@ -2777,7 +2777,7 @@ if(window.JoclyXdViewCleanup)
if(threeCtx) { if(threeCtx) {
var canvas = threeCtx.renderer.domElement; var canvas = threeCtx.renderer.domElement;
threeCtx.renderer.render( threeCtx.scene, threeCtx.camera ); threeCtx.renderer.render( threeCtx.scene, threeCtx.camera );
resolve(canvas.toDataURL("image/png")); resolve(canvas.toDataURL("image/"+(options.format || "png")));
} else } else
reject(new Error("Snapshot only available on 3D views")); reject(new Error("Snapshot only available on 3D views"));
break; break;