Skip to content

Commit

Permalink
fix screenshot scaling issue on firefox, zadam/trilium#1202
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Apr 10, 2021
1 parent 80e82b4 commit 6cd9aad
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ function cropImage(newArea, dataUrl) {

async function takeScreenshot(cropRect) {
const activeTab = await getActiveTab();

const isFirefox = typeof InstallTrigger !== 'undefined';

// Chrome/blink do not incorporate automatically the devicePixelRatio so we need to do it manually
const zoom = await browser.tabs.getZoom(activeTab.id)
* (isFirefox ? 1 : window.devicePixelRatio);
const zoom = await browser.tabs.getZoom(activeTab.id) * window.devicePixelRatio;

const newArea = Object.assign({}, cropRect);
newArea.x *= zoom;
Expand Down

0 comments on commit 6cd9aad

Please sign in to comment.