Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #1740, put in a max height/width on full page (5000px)
Browse files Browse the repository at this point in the history
Fix the calculation of the page height and width by also using scrollHeight and scrollWidth
  • Loading branch information
ianb committed Oct 13, 2016
1 parent 895ca67 commit 01e1e5f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions addon/data/shooter-interactive-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ mouseupNoAutoselect (true if a mouseup in draggingReady should not trigger autos

var isChrome = false;

const MAX_PAGE_HEIGHT = 5000;
const MAX_PAGE_WIDTH = 5000;

let annotateForPage = false;
if (! isChrome && self.options.annotateForPage) {
annotateForPage = true;
Expand Down Expand Up @@ -110,10 +113,21 @@ let standardOverlayCallbacks = {
},
onClickFullPage: () => {
sendEvent("capture-full-page", "selection-button");
let width = Math.max(
document.body.clientWidth,
document.documentElement.clientWidth,
document.body.scrollWidth,
document.documentElement.scrollWidth);
width = Math.min(width, MAX_PAGE_WIDTH);
let height = Math.max(
document.body.clientHeight,
document.documentElement.clientHeight,
document.body.scrollHeight,
document.documentElement.scrollHeight);
height = Math.min(height, MAX_PAGE_HEIGHT);
selectedPos = new Selection(
0, 0,
Math.max(document.body.clientWidth, document.documentElement.clientWidth),
Math.max(document.body.clientHeight, document.documentElement.clientHeight));
width, height);
reportSelection("fullPage");
}
}
Expand Down

0 comments on commit 01e1e5f

Please sign in to comment.