Tracks original column during drag and drop

Introduces originalSourceColumn to accurately track the starting column during drag events

Improves event rendering by ensuring correct column updates and maintaining drag context
Modifies drag end handling to use original source column for re-rendering
Adds async support for column rendering methods
This commit is contained in:
Janus C. H. Knudsen 2025-11-06 16:18:31 +01:00
parent fb174e7403
commit fba85094d7
3 changed files with 17 additions and 14 deletions

View file

@ -161,6 +161,7 @@ export class DragDropManager {
private draggedClone!: HTMLElement | null;
private currentColumn: IColumnBounds | null = null;
private previousColumn: IColumnBounds | null = null;
private originalSourceColumn: IColumnBounds | null = null; // Track original start column
private isDragStarted = false;
// Movement threshold to distinguish click from drag
@ -360,6 +361,7 @@ export class DragDropManager {
const originalElement = this.originalElement as BaseSwpEventElement;
this.currentColumn = ColumnDetectionUtils.getColumnBounds(currentPosition);
this.originalSourceColumn = this.currentColumn; // Store original source column at drag start
this.draggedClone = originalElement.createClone();
const dragStartPayload: IDragStartEventPayload = {
@ -459,7 +461,7 @@ export class DragDropManager {
originalElement: this.originalElement,
draggedClone: this.draggedClone,
mousePosition,
sourceColumn: this.previousColumn!!,
originalSourceColumn: this.originalSourceColumn!!,
finalPosition: { column, snappedY }, // Where drag ended
target: dropTarget
};
@ -625,6 +627,7 @@ export class DragDropManager {
this.originalElement = null;
this.draggedClone = null;
this.currentColumn = null;
this.originalSourceColumn = null;
this.isDragStarted = false;
this.scrollDeltaY = 0;
this.lastScrollTop = 0;