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

Commit

Permalink
Merge pull request #4218 from chenba/4217-overlay-way-off
Browse files Browse the repository at this point in the history
Calculate left and top margin of selection frame with left and top of doucument element and body
  • Loading branch information
ianb authored Mar 13, 2018
2 parents 2ee7af6 + cd36b7c commit 0b9ce08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/webextension/selector/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
if (window.getComputedStyle(document.body).position === "relative") {
const docBoundingRect = document.documentElement.getBoundingClientRect();
const bodyBoundingRect = document.body.getBoundingClientRect();
this.element.style.marginLeft = `-${bodyBoundingRect.right - docBoundingRect.right}px`;
this.element.style.marginTop = `-${bodyBoundingRect.bottom - docBoundingRect.bottom}px`;
this.element.style.marginLeft = `-${bodyBoundingRect.left - docBoundingRect.left}px`;
this.element.style.marginTop = `-${bodyBoundingRect.top - docBoundingRect.top}px`;
}
}
if (force && visible) {
Expand Down

0 comments on commit 0b9ce08

Please sign in to comment.