mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
fix(editor): Fix canvas selection for touch devices that use mouse (#9036)
This commit is contained in:
committed by
कारतोफ्फेलस्क्रिप्ट™
parent
571b6135dd
commit
286fa5cd7e
@@ -69,12 +69,5 @@ describe('useDeviceSupport()', () => {
|
|||||||
const event = new KeyboardEvent('keydown', { ctrlKey: true });
|
const event = new KeyboardEvent('keydown', { ctrlKey: true });
|
||||||
expect(isCtrlKeyPressed(event)).toEqual(true);
|
expect(isCtrlKeyPressed(event)).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true for touch device on MouseEvent', () => {
|
|
||||||
Object.defineProperty(window, 'ontouchstart', { value: {} });
|
|
||||||
const { isCtrlKeyPressed } = useDeviceSupport();
|
|
||||||
const mockEvent = new MouseEvent('click');
|
|
||||||
expect(isCtrlKeyPressed(mockEvent)).toEqual(true);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ export function useDeviceSupport() {
|
|||||||
const controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');
|
const controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');
|
||||||
|
|
||||||
function isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
|
function isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
|
||||||
if (isTouchDevice.value && e instanceof MouseEvent) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (isMacOs.value) {
|
if (isMacOs.value) {
|
||||||
return (e as KeyboardEvent).metaKey;
|
return (e as KeyboardEvent).metaKey;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user