Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dd-draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
public destroy(): void {
if (this.dragTimeout) window.clearTimeout(this.dragTimeout);
delete this.dragTimeout;
if (this.dragging) this._mouseUp(this.mouseDownEvent);
if (this.mouseDownEvent) this._mouseUp(this.mouseDownEvent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems ok, but I would really like to know why would you remove the element after mouse down, but before a move+up behavior ? Also I need to look at why we only wanted to call up if we moved >3 pixels instead of always...

Copy link
Author

@jemunk jemunk Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I my case it is being removed from a configuration. A DB change makes the element remove.
So if a user starts dragging in that moment, it is possible for it being removed just between the press and move handlers.
But the _mouseUp method seems to take fully care of all cleaning up. So it is just a matter of the destroy method doing it right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked at code and you are correct. _mouseUp() handles this.dragging separately so it should ways be called if down. thanks.

this.disable(true);
delete this.el;
delete this.helper;
Expand Down