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 error when opt.half == true #249

Merged

Conversation

fono09
Copy link
Contributor

@fono09 fono09 commented Jan 29, 2023

When there is a space to the left of an element in Raty, incorrect coordinates are returned, resulting in an error.
https://codepen.io/fono0c/pen/MWBBjEP
image

This patch corrects the process of getting the coordinates of the element.

See below:
HTMLElement.offsetLeft: https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetLeft
Element.getBoundingClientRect: https://developer.mozilla.org/ja/docs/Web/API/Element/getBoundingClientRect
MouseEvent.pageX:
https://developer.mozilla.org/ja/docs/Web/API/MouseEvent/pageX

@qzminski
Copy link

@wbotelhos can you merge this one, please? The fix looks correct to me and it affects quite a few use cases, also when the rating is inside a <div> that is positioned relatively.

qzminski added a commit to TSO-AG/OpenFrontend.Framework that referenced this pull request Aug 23, 2023
@wbotelhos
Copy link
Owner

Hi, @qzminski .

Would be nice to have a test simulating the error, if you could try to do it later, I'll appreciate it.

@wbotelhos wbotelhos merged commit 6037616 into wbotelhos:main Aug 23, 2023
@qzminski
Copy link

There you go: https://codepen.io/qzminski/pen/poqgLGQ

qzminski added a commit to TSO-AG/OpenFrontend.Framework that referenced this pull request Aug 31, 2023
* Add ratings component

* CS

* Configure the Rating component with JSON instead of `data` attributes

* CS

* Update the docs

* Patch the raty-js plugin

wbotelhos/raty#249

* Update the dist files

* Automatically apply the package patches

* Enable autoprefixer & stylelint

* Allow to define custom icon

* Update raty-js

* CS

---------

Co-authored-by: Kamil Kuzminski <kamil.kuzminski@codefog.pl>
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.

None yet

3 participants