Skip to content

Commit 4120761

Browse files
committed
Adding debug information to figure why drag & drop is not working.
1 parent 3720596 commit 4120761

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

eform-client/src/app/common/services/navigation-menu/navigation-menu-drag-drop.service.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CdkDropList, CdkDragMove, CdkDragRelease, CdkDrag } from '@angular/cdk/
55
/**
66
* Service to handle nested drag and drop operations in navigation menu.
77
* Based on: https://stackoverflow.com/a/67337935/2144807
8-
*
8+
*
99
* This service dynamically tracks which drop list is currently being hovered
1010
* during drag operations, enabling nested drag and drop functionality that
1111
* cdkDropListGroup doesn't support out of the box.
@@ -29,24 +29,25 @@ export class NavigationMenuDragDropService {
2929
*/
3030
dragMoved(event: CdkDragMove<any>) {
3131
const elementFromPoint = this.document.elementFromPoint(
32-
event.pointerPosition.x,
32+
event.pointerPosition.x,
3333
event.pointerPosition.y
3434
);
35-
35+
3636
if (!elementFromPoint) {
3737
this.currentHoverDropListId = undefined;
3838
return;
3939
}
40-
40+
4141
const dropList = elementFromPoint.classList.contains('cdk-drop-list')
4242
? elementFromPoint
4343
: elementFromPoint.closest('.cdk-drop-list');
44-
44+
4545
if (!dropList) {
4646
this.currentHoverDropListId = undefined;
4747
return;
4848
}
49-
49+
50+
console.log('Hovering over drop list:', dropList.id);
5051
this.currentHoverDropListId = dropList.id;
5152
}
5253

eform-client/src/app/modules/advanced/modules/navigation-menu/components/navigation-menu-page/navigation-menu-page.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020
</eform-new-subheader>
2121

22-
<div class="d-flex flex-row align-items-start" cdkDropListGroup>
22+
<div class="d-flex flex-row align-items-start">
2323
<mat-accordion multi="true" displayMode="flat" class="mr-2">
2424
<mat-expansion-panel *ngFor="
2525
let menuTemplate of navigationMenuModel.menuTemplates;
@@ -66,8 +66,7 @@
6666
[cdkDropListData]="navigationMenuModel.actualMenu"
6767
[cdkDropListConnectedTo]="connectedLists"
6868
[cdkDropListEnterPredicate]="allowDropPredicate"
69-
(cdkDropListDropped)="dropMenuItem($event)"
70-
class="dragula-item">
69+
(cdkDropListDropped)="dropMenuItem($event)">
7170
<mat-expansion-panel *ngFor="
7271
let menuItem of navigationMenuModel.actualMenu;
7372
let firstLevelIndex = index"
@@ -102,7 +101,6 @@
102101
</mat-panel-title>
103102
</mat-expansion-panel-header>
104103
<div
105-
class="dropdownBody"
106104
cdkDropList
107105
[id]="getDropdownId(firstLevelIndex)"
108106
[cdkDropListData]="menuItem.children"

0 commit comments

Comments
 (0)