From 286fa5cd7eb5052d2c166145447f53b33174b62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milorad=20FIlipovi=C4=87?= Date: Wed, 3 Apr 2024 11:15:51 +0200 Subject: [PATCH] fix(editor): Fix canvas selection for touch devices that use mouse (#9036) --- .../design-system/src/composables/useDeviceSupport.test.ts | 7 ------- packages/design-system/src/composables/useDeviceSupport.ts | 3 --- 2 files changed, 10 deletions(-) diff --git a/packages/design-system/src/composables/useDeviceSupport.test.ts b/packages/design-system/src/composables/useDeviceSupport.test.ts index 330b0ebb2..d6974cb9e 100644 --- a/packages/design-system/src/composables/useDeviceSupport.test.ts +++ b/packages/design-system/src/composables/useDeviceSupport.test.ts @@ -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); - }); }); }); diff --git a/packages/design-system/src/composables/useDeviceSupport.ts b/packages/design-system/src/composables/useDeviceSupport.ts index 01d52b890..8ead46c14 100644 --- a/packages/design-system/src/composables/useDeviceSupport.ts +++ b/packages/design-system/src/composables/useDeviceSupport.ts @@ -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; }