Fixed a style bug where the border and outline were visible during drag and drop

This commit is contained in:
2025-10-24 17:55:21 +05:30
parent 5b4017a7c3
commit 4a3474cb4e

View File

@@ -111,7 +111,7 @@ export const OutlineList: React.FC<OutlinePanelProps> = ({
const dropAction = getDropZone(y);
if (dropAction === "none") {
clearHighlight(hoveredDiv);
clearAllHighlights();
setDraggedNode(null);
return;
}
@@ -126,7 +126,7 @@ export const OutlineList: React.FC<OutlinePanelProps> = ({
setHierarchy(updatedHierarchy);
setDraggedNode(null);
clearHighlight(hoveredDiv);
clearAllHighlights();
};
const getDropZone = (y: number): DropAction => {
@@ -136,11 +136,17 @@ export const OutlineList: React.FC<OutlinePanelProps> = ({
return "none";
};
const clearHighlight = (el: HTMLElement) => {
el.style.borderTop = "none";
el.style.borderBottom = "none";
el.style.outline = "none";
el.style.border = "none";
const clearAllHighlights = () => {
const allNodes = document.querySelectorAll<HTMLElement>(
".tree-node, .tree-node-content, .group-node, .dragging"
);
allNodes.forEach((node) => {
node.style.borderTop = "none";
node.style.borderBottom = "none";
node.style.outline = "none";
node.style.border = "none";
});
};
const removeFromHierarchy = (item: AssetGroupChild, tree: AssetGroupChild[]): boolean => {