From 064dbbf10fcc51e9e2754b20322ac0bda1317ae2 Mon Sep 17 00:00:00 2001 From: Vadym Struts Date: Tue, 10 Dec 2024 19:49:22 +0100 Subject: [PATCH] review changes Signed-off-by: Vadym Struts --- .../resources/data/element_picker.ts | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/components/cosmetic_filters/resources/data/element_picker.ts b/components/cosmetic_filters/resources/data/element_picker.ts index 24dd6cfdf91f..eeb203e79633 100644 --- a/components/cosmetic_filters/resources/data/element_picker.ts +++ b/components/cosmetic_filters/resources/data/element_picker.ts @@ -617,26 +617,19 @@ const launchElementPicker = (root: ShadowRoot) => { ) const svg = root.getElementById('picker-ui')! - - svg.addEventListener( - 'mousemove', - (event) => { - console.log('mouse move event') - if(window.matchMedia("(any-hover: none)").matches) { - console.log('mouse move event: no pointer devide detected') - return - } - console.log('mouse move event: !!! pointer devide detected') - if (isAndroid) { - return - } - if (!hasSelectedTarget) { - elementPickerHoverCoordsChanged(event.clientX, event.clientY) - } - event.stopPropagation() - }, - true, - ) + if(window.matchMedia("(pointer: fine)").matches && + window.matchMedia("(hover: hover)").matches) { + svg.addEventListener( + 'mousemove', + (event) => { + if (!hasSelectedTarget) { + elementPickerHoverCoordsChanged(event.clientX, event.clientY) + } + event.stopPropagation() + }, + true, + ) + } const rulesTextArea: HTMLInputElement = root.querySelector( '#rules-box > textarea',