1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Fixed context menu not being displayed on high DPI screens

This commit is contained in:
Laurent Cozic
2021-01-07 21:44:31 +00:00
parent f43ec71d9a
commit df3e6a6219
3 changed files with 8 additions and 7 deletions

View File

@@ -620,7 +620,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
function pointerInsideEditor(x: number, y: number) {
const elements = document.getElementsByClassName('codeMirrorEditor');
if (!elements.length) return null;
const rect = convertToScreenCoordinates(elements[0].getBoundingClientRect());
const rect = convertToScreenCoordinates(Setting.value('windowContentZoomFactor'), elements[0].getBoundingClientRect());
return rect.x < x && rect.y < y && rect.right > x && rect.bottom > y;
}

View File

@@ -7,6 +7,7 @@ import { menuItems, ContextMenuOptions, ContextMenuItemType } from '../../../uti
import MenuUtils from '@joplin/lib/services/commands/MenuUtils';
import CommandService from '@joplin/lib/services/CommandService';
import convertToScreenCoordinates from '../../../../utils/convertToScreenCoordinates';
import Setting from '@joplin/lib/models/Setting';
const Resource = require('@joplin/lib/models/Resource');
@@ -21,7 +22,7 @@ function contextMenuElement(editor: any, x: number, y: number) {
const iframes = document.getElementsByClassName('tox-edit-area__iframe');
if (!iframes.length) return null;
const iframeRect = convertToScreenCoordinates(iframes[0].getBoundingClientRect());
const iframeRect = convertToScreenCoordinates(Setting.value('windowContentZoomFactor'), iframes[0].getBoundingClientRect());
if (iframeRect.x < x && iframeRect.y < y && iframeRect.right > x && iframeRect.bottom > y) {
const relativeX = x - iframeRect.x;