[IMP] web: core: draggable: execute willStartDrag

Before this commit, the draggable hook did not execute willStartDrag, that is, before
the element is actually moved.

After this commit it does, allowing for implementing some features, like copyOnDrag.

Part-of: odoo/odoo#115799
This commit is contained in:
Lucas Perais
2023-04-03 13:55:15 +02:00
parent 323b893049
commit 6085480ea1
@@ -43,6 +43,7 @@ import { pick } from "@web/core/utils/objects";
/** @type {(params: DraggableParams) => DraggableState} */
export const useDraggable = makeDraggableHook({
name: "useDraggable",
onWillStartDrag: ({ctx}) => pick(ctx.current, "element"),
onDragStart: ({ ctx }) => pick(ctx.current, "element"),
onDrag: ({ ctx }) => pick(ctx.current, "element"),
onDragEnd: ({ ctx }) => pick(ctx.current, "element"),