Skip to content

Commit

Permalink
fix scrolling screenshot issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Abid committed Jul 21, 2020
1 parent f78e6eb commit 51ae249
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion build/lib/gradio/static/js/gradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function gradio(config, fn, target) {
target.find(".screenshot").click(function() {
$(".screenshot").hide();
$(".screenshot_logo").show();
html2canvas(target[0]).then(function(canvas) {
html2canvas(target[0], {
scrollX: 0,
scrollY: -window.scrollY
}).then(function(canvas) {
saveAs(canvas.toDataURL(), 'screenshot.png');
$(".screenshot").show();
$(".screenshot_logo").hide();
Expand Down
5 changes: 4 additions & 1 deletion gradio/static/js/gradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function gradio(config, fn, target) {
target.find(".screenshot").click(function() {
$(".screenshot").hide();
$(".screenshot_logo").show();
html2canvas(target[0]).then(function(canvas) {
html2canvas(target[0], {
scrollX: 0,
scrollY: -window.scrollY
}).then(function(canvas) {
saveAs(canvas.toDataURL(), 'screenshot.png');
$(".screenshot").show();
$(".screenshot_logo").hide();
Expand Down

0 comments on commit 51ae249

Please sign in to comment.