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

FR: Allow dialogs to snap to sidebar #739

Open
nexushoratio opened this issue Jun 6, 2024 · 1 comment
Open

FR: Allow dialogs to snap to sidebar #739

nexushoratio opened this issue Jun 6, 2024 · 1 comment

Comments

@nexushoratio
Copy link
Contributor

nexushoratio commented Jun 6, 2024

TIL that the dialog() wrapper sets up snapping by default. Well, at least to other draggables.

What about defaulting them to also snap to the sidebar?

It looks like the change is simple enough. Change this line:

dialog.dialog().parents('.ui-dialog').draggable('option', 'snap', true);

to read:
dialog.dialog().parents('.ui-dialog').draggable('option', 'snap', '.ui-draggable, #sidebar');

(I don't have my test code in my editor still, so the details on the selectors may be wrong, so verify.)

Bonus if someone could figure out how to make them dock instead of just snap so that as the sidebar changes size, the dialogs stay relative. But I did not see anything in my few minutes of checking the jQuery UI documentation.

@nexushoratio
Copy link
Contributor Author

Was doing some more research. Just capturing some thoughts while in my head. May be completely off:

  • Make dialogs droppable as well as draggable, use a tolerance of fit
  • When drop event received by a droppable, use .position() to tie the items together and listener on some TBD event on the draggable
  • When TBD event received by droppable, undo the work by .position()

Assume the hand-wavy stuff works, that would probably handle the case when the sidebar changes sizes. But unsure what to do when the sidebar is toggled. (Maybe instead make it possible for a draggable to go into the sidebar as a sortable? Dunno, just making things up at this point. Time for bed.)

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