鼠标触摸屏中的鼠标事件

发布于 2025-02-03 13:54:44 字数 1270 浏览 1 评论 0原文

我被编码为在角度材料中的拖放,并且掉落的元素应该在正确的悬停卡中,因此我采用了卡索引并使用鼠标丢弃元素。现在问题是因为touchstart仅在触摸卡后才采用索引,因此问题是不起作用。有任何选择以正确的方式执行

<div class="xxl:m-2 m-1 xxl:rounded-xl rounded-lg xxl:min-h-24 min-h-14 bg-gray-400 bg-opacity-12
  (mouseover)="dropped(i)" (touchstart)="dropped(i)" >
          <div class="xxl:p-3 p-2">
                <div class="z-20 flex items-center justify-between xxl:py-3 py-1 xxl:px-4 px-2 xxl:my-2 my-1 cursor-move xxl:rounded-lg rounded-md  bg-card max-h-8 xxl:max-h-full"
                       *ngFor="let map of card.stages;" cdkDrag  [cdkDragData]="map" (mousedown)="getData(map)" (touchstart)="getData(map)">
                            <div class="min-w-0" >
                                <div class="font-medium leading-5 truncate">{{map.stage_name}}</div>
                                </div>
                                <button mat-icon-button (click)="cutStage(map)">
                                    <mat-icon class="xxl:icon-size-6 icon-size-5 " svgIcon="heroicons_outline:x-circle"></mat-icon>
                                </button>
                            </div>
                        </div>
                    </div>

I'm coded for drag and drop in angular material and dropped element should in correct hovered card , So I took index of card and drop the element using mouseover. Now the problem is for tab its not working because touchstart only take the index after touch the card.Is there any option to do that in correct way

<div class="xxl:m-2 m-1 xxl:rounded-xl rounded-lg xxl:min-h-24 min-h-14 bg-gray-400 bg-opacity-12
  (mouseover)="dropped(i)" (touchstart)="dropped(i)" >
          <div class="xxl:p-3 p-2">
                <div class="z-20 flex items-center justify-between xxl:py-3 py-1 xxl:px-4 px-2 xxl:my-2 my-1 cursor-move xxl:rounded-lg rounded-md  bg-card max-h-8 xxl:max-h-full"
                       *ngFor="let map of card.stages;" cdkDrag  [cdkDragData]="map" (mousedown)="getData(map)" (touchstart)="getData(map)">
                            <div class="min-w-0" >
                                <div class="font-medium leading-5 truncate">{{map.stage_name}}</div>
                                </div>
                                <button mat-icon-button (click)="cutStage(map)">
                                    <mat-icon class="xxl:icon-size-6 icon-size-5 " svgIcon="heroicons_outline:x-circle"></mat-icon>
                                </button>
                            </div>
                        </div>
                    </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文