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

Fix event x/y by finding container node #849

Merged
merged 2 commits into from
Aug 12, 2019

Conversation

jberg
Copy link
Collaborator

@jberg jberg commented Aug 12, 2019

Need to calculate x/y based off of the "top" absolute positioned element, so follow offsetParent up the chain. Probably gets rid of the forced layout too

relativeParent = relativeParent.offsetParent;
}
const x = event.clientX - relativeParent.offsetLeft;
const y = event.clientY - relativeParent.offsetTop;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was imagining we would do this by traversing up our own state tree (Maki or Redux) until we find a container, and then using the x/y values that we currently have from the last time we set them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yea, thats much much better!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, just fixed it...SO MUCH BETTER!!!

@jberg jberg changed the title Fix event x/y by finding relativeParent Fix event x/y by finding container node Aug 12, 2019
@captbaritone captbaritone merged commit fc2a015 into captbaritone:master Aug 12, 2019
captbaritone pushed a commit that referenced this pull request Nov 30, 2019
* Fix event x/y by finding relativeParent

* use a tree search to find the container instead of event target hacks
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

Successfully merging this pull request may close these issues.

2 participants