-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refine drag and drop events to prevent interference with other drag/drop-sensitive fields in downstream use cases #2
Conversation
@jywarren @emilyashley @VladimirMikulic @Shreyaa-s @keshav234156 @Shulammite-Aso. |
Please document your code. |
Ok @VladimirMikulic I will add some comment and explanation in short time. |
In this PR, the dragging container css is changed such that whenever we drag any image to the container it will show the `drag and drop` popup and when we drag out the image from that container this popup will disappear. The thing which will look better after this:- Presently, when we drag the image anywhere in the editor it will display a popup of `drag and drop` which is not a good UI or experience to have because we have another drag and drop too which is MainImage Module. After this PR the popup will only appear we dargin the image over that particular container.
Can you explain how it works for |
@Shreyaa-s by dragover in the container, the function handleDragOver will be called. By this function, the popup CSS, |
@NitinBhasneria Ok, It works well. Can you please document what each of the function does, so that code becomes easy to understand |
@keshav234156 yea, cool. |
This looks great. Just curious about the workflow I proposed in this comment, in terms of how we merge this in! Thank you! publiclab/PublicLab.Editor#490 (comment) If you like it, we can open new PRs against those branches and link from here to them, and close this one. Thank you!!! |
OK, so I am a little confused in the comment @jywarren. |
My apologies for not seeing this earlier! OK - so i pointed this at
So we can point the Editor directly at the |
Also I expanded on the title quite a bit to make it very clear what it achieves. Hope that makes sense!!! |
Great! Looking good! |
This will improve publiclab/PublicLab.Editor#504.
After this fix, the drag and drop popup will only appear when it drags into proper div. Hence, in the editor module, the unnecessary popup will not appear.
Now if we drag and drop the image in Main Image Module the editor will not have a drag nd drop popup.
In this PR I have added one function that is dragginstopforce() this function will forcibly stop the CSS popup without checking the condition of entre or leave (i.e, it will not check the variable
draggingCss===0
). This function will be called every time on eventmouseout
anddragend
.Other than this function the pre-existing function are
dragging()
called ondragenter
this function will add CSS popup including thedraggingCss++
,handledragover
called ondragover
this will add CSS popup includingstop(e)
anddraggingstop()
called ondragover
.The flow will be like this:- When the drag enters in the container the
dragenter
event callsdragging()
function after this the dragging in the container will be handled bydragover
and on leaving the container the eventdragover
will call thedragginstop
.In this process is the
mouseout
ordragend
event occurs thendraggingstopforce
will be called.Thank you.