Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be better with element.getBoundingClientRect() #1032

Open
mihalcea-bogdan-daniel opened this issue Aug 19, 2022 · 1 comment
Open

Comments

@mihalcea-bogdan-daniel
Copy link

Math.pow(pageX.value - (elem.offsetLeft + elem.clientWidth / 2), 2) +

I don't have time right now to fork-fix-pull request. I will do it in 1 week from now if you want.

Awesome repository! ❤️

@mihalcea-bogdan-daniel
Copy link
Author

Something like this I did.

export interface BoundingClientRect {
  bottom: number,
  left: number,
  right: number,
  height: number,
  top: number,
  width: number,
  x: number,
  y: number
}

const rect:BoundingClientRect = elem.$el.getBoundingClientRect();
      return Math.floor(
        Math.sqrt(
          Math.pow(pageX.value - (rect.left + rect.width / 2), 2) +
            Math.pow(pageY.value - (rect.top + rect.height / 2), 2)
        )
      );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant