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

Incorrect ghost position in sort plugin on Bootstrap modal window #741

Open
yusufozturk opened this issue Nov 7, 2018 · 4 comments
Open
Assignees
Labels
bug Identified bug which needs a fix
Milestone

Comments

@yusufozturk
Copy link

First, please check the codepen:

https://codepen.io/yusufozturk/pen/oQbvzj

When you try to move one of the rule, ghost position is not right on the modal.

image

It's because x and y positions are not correct in the modal view. Probably same issue:

https://stackoverflow.com/questions/46626376/incorrect-mouse-x-y-position-on-bootstrap-modal-window

As the solution, we should use modal window instead of browser window? I think select2 has the similar issue in the bootstrap modal and they have "dropdownParent" parameter to overcome this issue:

https://select2.org/troubleshooting/common-problems

I will apply a custom fix for this issue but I don't have time to send a pull request in a short time, sorry.

Yusuf

@mistic100
Copy link
Owner

@yusufozturk
Copy link
Author

I fixed this issue with following change:

from:

// make the ghost follow the cursor
ghost[0].style.top = event.clientY - 15 + 'px';
ghost[0].style.left = event.clientX - 15 + 'px';

to:

// make the ghost follow the cursor
var modalDialog = src.$el.parents('.modal-dialog');
ghost[0].style.top = event.pageY - modalDialog.offset().top - 15 + 'px';
ghost[0].style.left = event.pageX - modalDialog.offset().left - 15 + 'px';

Yusuf

@yusufozturk
Copy link
Author

I will close this issue @mistic100

Would be really nice if there is a parameter for modals, so we can use modal offset :)

Thanks.

Yusuf

@mistic100
Copy link
Owner

mistic100 commented Nov 7, 2018 via email

@yusufozturk yusufozturk reopened this Nov 7, 2018
@mistic100 mistic100 self-assigned this Dec 15, 2018
@mistic100 mistic100 added the bug Identified bug which needs a fix label Dec 15, 2018
@mistic100 mistic100 added this to the 2.5.3 milestone Dec 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified bug which needs a fix
Projects
None yet
Development

No branches or pull requests

2 participants