Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
802 views
in Technique[技术] by (71.8m points)

drag and drop - Angular Material Mat-Tree dragover event firing unnecessary

I have mat-tree with events attached to for the drag-drop functionality. I have two components ( one for Source Tree and other for Destination Tree). I am dragging item from Source Tree and dropping it on Destination Tree.

The issue is when an item is dragged and dropped, the dropover events keeps firing even when the item has been dropped.

The functionality is working smoothly in Edge browser but not in Chrome. In Chrome, we can see that the dragover event is firing unnecessary.

    <mat-tree-node *matTreeNodeDef="let node; when: hasMicroChild" matTreeNodePadding
                (dragover)="handleDragOver($event, node);" (dragend)="handleDragEnd($event, node);"
                (drop)="handleDrop($event, node);" [ngClass]="getStyle(node)">
                <button mat-icon-button matTreeNodeToggle [attr.aria-label]="'toggle ' + node.item">
                    <mat-icon class="mat-icon-rtl-mirror">
                        {{TreeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
                    </mat-icon>
                </button>
                <span class="checklist-leaf-node">
                    <span class="nodeContent">
                        <div *ngIf="node.queryType; else elseBlock">{{node.item}} ({{node.queryType}})</div>
                        <ng-template #elseBlock>{{node.item}}</ng-template>
                    </span>
                </span>
            </mat-tree-node>
question from:https://stackoverflow.com/questions/65879971/angular-material-mat-tree-dragover-event-firing-unnecessary

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...