We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f1db6e commit cc19d27Copy full SHA for cc19d27
src/PieMenu.component.js
@@ -63,9 +63,10 @@ const PieMenu = ({
63
64
const isInsidePie = (x, y) => {
65
if (!ref.current) return false;
66
+ const { pageXOffset, pageYOffset } = window;
67
const { left: pieX, top: pieY } = ref.current.getBoundingClientRect();
- const distance = (x - (pieX - window.pageXOffset) - radiusPx) ** 2
68
- + (y - (pieY + window.pageYOffset) - radiusPx) ** 2;
+ const distance = (x + pageXOffset - (pieX + pageXOffset) - radiusPx) ** 2
69
+ + (y + pageYOffset - (pieY + pageYOffset) - radiusPx) ** 2;
70
return centerArea <= distance && distance <= pieArea;
71
};
72
0 commit comments