mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
clip screenshot crops correctly when HIDPI display is used
This commit is contained in:
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -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>
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user