From 5e425372f92687af2b24972ca1d28ae66d3c15d6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 14 Jun 2020 18:17:03 +0200 Subject: Rework layout and add description field. --- src/ws/view.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/ws/view.js') diff --git a/src/ws/view.js b/src/ws/view.js index 264ef9f..6c43dc8 100644 --- a/src/ws/view.js +++ b/src/ws/view.js @@ -83,7 +83,7 @@ function deleteNode(id) function getElementAfter(e) { - if(e.target.className != "children") + if(!e.target.classList.contains("children")) { return null; } @@ -92,7 +92,7 @@ function getElementAfter(e) var min_y_diff = 9999999999999; for(var i = 0; i < e.target.childNodes.length; ++i) { - if(e.target.children[i].className != "node") // Only look at node elements + if(!e.target.children[i].classList.contains("node")) // Only look at node elements { continue; } @@ -121,7 +121,7 @@ var last_over = null; function dragenter(e) { // Only highlight children areas - if(e.target.className != "children") + if(!e.target.classList.contains("children")) { return; } @@ -133,7 +133,7 @@ var last_after = null; function dragover(e) { // // Only highlight children areas -// if(e.target.className != "children") +// if(!e.target.classList.contains("children")) // { // return; // } @@ -155,7 +155,7 @@ function dragover(e) function dragleave(e) { // Only highlight children areas - if(e.target.className != "children") + if(!e.target.classList.contains("children")) { return; } @@ -172,7 +172,7 @@ function dragEnd(e) update(idFromStr(id), "dragged", "false"); // // Only highlight children areas -// if(e.target.className != "children") +// if(!e.target.classList.contains("children")) // { // return; // } @@ -199,7 +199,7 @@ function drop(e) e.stopPropagation(); // Only allow drops in children areas - if(e.target.className != "children") + if(!e.target.classList.contains("children")) { return; } @@ -209,7 +209,6 @@ function drop(e) // Get drop id from targets parent (children tag inside the node) var dropid = e.target.parentElement.id; - console.log("dropid: " + dropid); // Prevent dropping on item itself if(id == dropid) { @@ -338,10 +337,10 @@ function collapse(e) e.stopPropagation(); if(collapsed) { - node.children_element.classList.add('collapsed'); + node.element.classList.add('collapsed'); } else { - node.children_element.classList.remove('collapsed'); + node.element.classList.remove('collapsed'); } } -- cgit v1.2.3