mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 06:34:25 +01:00
clip screenshot crops correctly when HIDPI display is used
This commit is contained in:
parent
b61149382e
commit
28eb3f2aae
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -36,7 +36,12 @@ function cropImage(newArea, dataUrl) {
|
|||||||
async function takeScreenshot(cropRect) {
|
async function takeScreenshot(cropRect) {
|
||||||
const activeTab = await getActiveTab();
|
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);
|
const newArea = Object.assign({}, cropRect);
|
||||||
newArea.x *= zoom;
|
newArea.x *= zoom;
|
||||||
newArea.y *= zoom;
|
newArea.y *= zoom;
|
||||||
@ -332,4 +337,4 @@ browser.runtime.onMessage.addListener(async request => {
|
|||||||
else if (request.name === 'send-trilium-search-status') {
|
else if (request.name === 'send-trilium-search-status') {
|
||||||
triliumServerFacade.sendTriliumSearchStatusToPopup();
|
triliumServerFacade.sendTriliumSearchStatusToPopup();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user