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