) => {
+ if (highlighterData && canvasRef?.current) {
+ const canvasRect = canvasRef.current.getBoundingClientRect();
+ const clickX = e.clientX - canvasRect.left;
+ const clickY = e.clientY - canvasRect.top;
+
+ const highlightRect = highlighterData.rect;
+ if (
+ clickX >= highlightRect.left &&
+ clickX <= highlightRect.right &&
+ clickY >= highlightRect.top &&
+ clickY <= highlightRect.bottom
+ ) {
+ setShowConfirmation(true);
+ }
+ }
+ };
+
+ const handleConfirmation = (confirmed: boolean) => {
+ if (confirmed) {
+ console.log(`User confirmed interaction with: ${highlighterData?.selector}`);
+ // Here you can add logic to interact with the element
+ } else {
+ console.log('User declined interaction');
+ }
+ setShowConfirmation(false);
+ };
+
return (
- <>
+
+ setShowConfirmation(false)}
+ canBeClosed={false}
+ >
+ handleConfirmation(true)}
+ onNo={() => handleConfirmation(false)}
+ />
+
{(highlighterData?.rect != null && highlighterData?.rect.top != null) && canvasRef?.current ?
{
width={width}
height={height}
/>
- >
+
);
};