fix(editor): Fix canvas selection for touch devices that use mouse (#9036)

This commit is contained in:
Milorad FIlipović 2024-04-03 11:15:51 +02:00 committed by कारतोफ्फेलस्क्रिप्ट™
parent 571b6135dd
commit 286fa5cd7e
2 changed files with 0 additions and 10 deletions

View file

@ -69,12 +69,5 @@ describe('useDeviceSupport()', () => {
const event = new KeyboardEvent('keydown', { ctrlKey: 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);
});
});
});

View file

@ -12,9 +12,6 @@ export function useDeviceSupport() {
const controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');
function isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
if (isTouchDevice.value && e instanceof MouseEvent) {
return true;
}
if (isMacOs.value) {
return (e as KeyboardEvent).metaKey;
}