function renderTree() {
treeContainer.innerHTML = "";
// Buat node root terlebih dahulu di luar layar untuk hitung ukurannya
const tempDiv = document.createElement("div");
tempDiv.className = "node";
tempDiv.style.visibility = "hidden";
tempDiv.innerHTML = `${data.name}`;
document.body.appendChild(tempDiv);
const nodeWidth = tempDiv.offsetWidth;
const nodeHeight = tempDiv.offsetHeight;
document.body.removeChild(tempDiv);
// Hitung posisi center layar
const centerX = (window.innerWidth / 2) - (nodeWidth / 2);
const startY = 40;
renderNode(data, centerX, startY, 0);
updateTransform();
}