Methods
(static) makeInteractableDraggable(interactable, checkDrop, isDraggable)
This function allows an element to be dragged across the screen with the mouse.
During the drag, the element's style changes for visual feedback (e.g., scaling
and reduced opacity). The checkDrop callback verifies if the drop is valid,
resetting the element's position if it's not.
Parameters:
| Name | Type | Description |
|---|---|---|
interactable |
HTMLElement | The element to make draggable. |
checkDrop |
function | A callback function to check |
isDraggable |
function | A callback function to determine |
Example
// Make a patch draggablemakeInteractableDraggable(patchElement, checkDropCallback, () => isDraggable);
(inner) resetInteractable(interactable)
Resets the position and styling of a draggable element.
Parameters:
| Name | Type | Description |
|---|---|---|
interactable |
HTMLElement | The draggable element to reset. |