Skip to content

Build your personal knowledge base with Trilium Notes

clip screenshot crops correctly when HIDPI display is used

zadam28eb3f2aaed4
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index fdf1fc87c0..94a25f7f4c 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
- <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
diff --git a/background.js b/background.js
index 034a2a8e04..06b8c22131 100644
--- a/background.js
+++ b/background.js
@@ -36,7 +36,12 @@ function cropImage(newArea, dataUrl) {
async function takeScreenshot(cropRect) {
const activeTab = await getActiveTab();
- const zoom = await browser.tabs.getZoom(activeTab.id);
+ 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 newArea = Object.assign({}, cropRect);
newArea.x *= zoom;
newArea.y *= zoom;
@@ -332,4 +337,4 @@ browser.runtime.onMessage.addListener(async request => {
else if (request.name === 'send-trilium-search-status') {
triliumServerFacade.sendTriliumSearchStatusToPopup();
}
-});
\ No newline at end of file
+});