-
Notifications
You must be signed in to change notification settings - Fork 2
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
Draft: fix #24 #53
Draft: fix #24 #53
Conversation
addon/button.js
Outdated
@@ -107,7 +107,29 @@ function initButton(sfHost, inInspector) { | |||
closePopup(); | |||
} | |||
}); | |||
//manage our self the darg n drop | |||
btn.ondragstart = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button is alrady added through dom so too late to add event handler.
Best is to use addEventListener
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
div element must be draggable:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dragstart_event
Anyway, best is to catch mousedown and mouseup because dragable will add next to pointer the element whereas we need to update position of button.
mousedown => store the initial mouse X and mouseY and initial button position + add listener on mousemove
mousemove => calculate diff between current position and mouse original position and add delta only on Y to button position (btnYPos = btnYOriginPos + deltaY)
mouseup: remove listener mousmove
1eeaf47
to
5fb5886
Compare
I have fixd major issue but I found that still bugy with some weird behaviour. |
I will squash and merge. |
Describe your changes
Fix #24
Issue ticket number and link
#24
Checklist before requesting a review