Cancel drag on key press Angular cdk Drag and Drop

后端 未结 5 429
醉话见心
醉话见心 2021-01-11 23:16

I´m working in a application implementing the new drag and drop from angular material CDK and i´m trying to cancel the drag event of the element pressing Esc, i

5条回答
  •  迷失自我
    2021-01-11 23:44

    You can move the dragged item to a position using:

    event['source']['element']['nativeElement']['style']['transform'] = 'translate3d(0,0,0)';
    event['source']['_dragRef']['_activeTransform'] = {x: 0, y: 0};
    event['source']['_dragRef']['_passiveTransform'] = {x: 0, y: 0};
    

提交回复
热议问题