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

Draft: fix #24 #53

Merged
merged 5 commits into from
Apr 17, 2024
Merged

Draft: fix #24 #53

merged 5 commits into from
Apr 17, 2024

Conversation

Dufgui
Copy link
Collaborator

@Dufgui Dufgui commented Apr 7, 2024

Describe your changes

Fix #24

Issue ticket number and link

#24

Checklist before requesting a review

  • I have read and understand the Contributions section
  • I have performed a self-review of my code
  • I ran the unit tests and my PR does not break any tests
  • I documented the changes I've made on the CHANGES.md and followed actual conventions
  • I added a new section on how-to.md (optional)

addon/button.js Outdated
@@ -107,7 +107,29 @@ function initButton(sfHost, inInspector) {
closePopup();
}
});
//manage our self the darg n drop
btn.ondragstart = function() {
Copy link
Owner

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

Copy link
Owner

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

@Dufgui Dufgui force-pushed the fix_24 branch 2 times, most recently from 1eeaf47 to 5fb5886 Compare April 14, 2024 17:12
@dufoli
Copy link
Owner

dufoli commented Apr 14, 2024

I have fixd major issue but I found that still bugy with some weird behaviour.

@dufoli
Copy link
Owner

dufoli commented Apr 17, 2024

I will squash and merge.

@dufoli dufoli merged commit 8172fc0 into dufoli:master Apr 17, 2024
@Dufgui Dufgui deleted the fix_24 branch May 23, 2024 19:21
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.

movable popup button
2 participants