Add toolbox library page with editable examples
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s
This commit is contained in:
parent
8eb622e05d
commit
9b72f4934c
20 changed files with 4774 additions and 31 deletions
|
|
@ -28,19 +28,18 @@ export function usePointerReorder({
|
|||
|
||||
function getDropTarget(event) {
|
||||
const { getTargetId, canDropOn, getPlacement } = optionsRef.current;
|
||||
const element = document.elementFromPoint(event.clientX, event.clientY);
|
||||
const target = element?.closest?.(targetSelector);
|
||||
if (!target || !canDropOn(target, draggingId)) {
|
||||
return { id: "", placement: "before" };
|
||||
const elements = document.elementsFromPoint?.(event.clientX, event.clientY) || [document.elementFromPoint(event.clientX, event.clientY)].filter(Boolean);
|
||||
for (const element of elements) {
|
||||
const target = element?.closest?.(targetSelector);
|
||||
if (!target || !canDropOn(target, draggingId)) continue;
|
||||
const targetId = getTargetId(target);
|
||||
if (targetId === draggingId) continue;
|
||||
return {
|
||||
id: targetId,
|
||||
placement: getPlacement(event, target)
|
||||
};
|
||||
}
|
||||
const targetId = getTargetId(target);
|
||||
if (targetId === draggingId) {
|
||||
return { id: "", placement: "before" };
|
||||
}
|
||||
return {
|
||||
id: targetId,
|
||||
placement: getPlacement(event, target)
|
||||
};
|
||||
return { id: "", placement: "before" };
|
||||
}
|
||||
|
||||
function handlePointerMove(event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue