new background and fixs
This commit is contained in:
@@ -159,29 +159,26 @@ const CustomizeSongStructure = ({ baseStructure = [], onChange }) => {
|
||||
[extractValues]
|
||||
);
|
||||
|
||||
const handleGrant = useCallback(
|
||||
(itemId, event) => {
|
||||
const rect = containerRef.current?.getBoundingClientRect();
|
||||
const scrollY = getScrollY();
|
||||
const nativeEvent = event.nativeEvent || {};
|
||||
const fallbackY =
|
||||
typeof nativeEvent.pageY === "number"
|
||||
? nativeEvent.pageY
|
||||
: typeof nativeEvent.clientY === "number"
|
||||
? nativeEvent.clientY + scrollY
|
||||
: scrollY;
|
||||
const containerTop = rect ? rect.top + scrollY : fallbackY;
|
||||
dragStateRef.current = {
|
||||
itemId,
|
||||
containerTop,
|
||||
};
|
||||
setActiveItemId(itemId);
|
||||
if (typeof document !== "undefined") {
|
||||
document.body.style.userSelect = "none";
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
const handleGrant = useCallback((itemId, event) => {
|
||||
const rect = containerRef.current?.getBoundingClientRect();
|
||||
const scrollY = getScrollY();
|
||||
const nativeEvent = event.nativeEvent || {};
|
||||
const fallbackY =
|
||||
typeof nativeEvent.pageY === "number"
|
||||
? nativeEvent.pageY
|
||||
: typeof nativeEvent.clientY === "number"
|
||||
? nativeEvent.clientY + scrollY
|
||||
: scrollY;
|
||||
const containerTop = rect ? rect.top + scrollY : fallbackY;
|
||||
dragStateRef.current = {
|
||||
itemId,
|
||||
containerTop,
|
||||
};
|
||||
setActiveItemId(itemId);
|
||||
if (typeof document !== "undefined") {
|
||||
document.body.style.userSelect = "none";
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleMove = useCallback((event) => {
|
||||
const { itemId, containerTop } = dragStateRef.current;
|
||||
@@ -210,9 +207,7 @@ const CustomizeSongStructure = ({ baseStructure = [], onChange }) => {
|
||||
}, []);
|
||||
|
||||
const handleRelease = useCallback(() => {
|
||||
setSortableItems((prev) =>
|
||||
buildSortableItems(extractValues(prev))
|
||||
);
|
||||
setSortableItems((prev) => buildSortableItems(extractValues(prev)));
|
||||
dragStateRef.current = {
|
||||
itemId: null,
|
||||
containerTop: 0,
|
||||
|
||||
Reference in New Issue
Block a user