react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

Property 'clientX' does not exist on type 'TouchEvent<HTMLElement | SVGElement>'.

Open priyanshusaini105 opened this issue 2 years ago • 1 comments
trafficstars

Property 'clientX' does not exist on type 'DraggableEvent'. Property 'clientX' does not exist on type 'TouchEvent<HTMLElement | SVGElement>'.

how to mention the clientX for both touch and mouse event

const onLabelDragged:DraggableEventHandler = (e) => {
    const sliderEle = sliderRef.current;
    if (sliderEle) {
      const sliderRect = sliderRef.current?.getBoundingClientRect();
      let selectedStrikeIndex = Math.floor(
        (e.clientX - sliderRect.left + sliderEle.scrollLeft) / 24 <------
      ); 
     }
  };

I tried this too

((e.clientX || e.touches[0].clientX) - sliderRect.left + sliderEle.scrollLeft) / 24

priyanshusaini105 avatar Jul 14 '23 06:07 priyanshusaini105

Same here, no updates on this problem?

danivalls avatar Dec 30 '23 16:12 danivalls