F diff --git a/css/style.css b/css/style.css
--- a/css/style.css
+++ b/css/style.css
border-radius: 0.3rem;
}
- .file:hover {
- padding: 0.5rem;
+ .file.dragged {
+ border: none;
+ }
+
+ .file:hover:not(.dragged) {
background: white;
color: black;
border-color: #ddd;
F diff --git a/loggedin.js b/loggedin.js
--- a/loggedin.js
+++ b/loggedin.js
}
function begin_drag(e, fileview) {
- if (dragging) {
- alert("AAAAAAAAAAAAAA");
- }
+ if (dragging)
+ end_drag();
dragging_placeholder = document.createElement('div');
fileview.visuals.parentNode.insertBefore(dragging_placeholder, fileview.visuals);
dragging = fileview.visuals;
+ dragging.classList.add("dragged");
var elemRect = dragging.getBoundingClientRect();
dragging_offset_y = elemRect.top - e.clientY;
dragging.style.position = "absolute";
- dragging.style.top = "0px";
- dragging.style.left = "0px";
dragging.style.width = elemRect.width + "px";
dragging.style.height = elemRect.height + "px";
document.body.appendChild(dragging);
+
+ dragging.style.left = (e.clientX - dragging_offset_x) + "px";
+ dragging.style.top = (e.clientY + dragging_offset_y) + "px";
+ }
+
+ function end_drag(e) {
+ dragging_placeholder.parentNode.insertBefore(dragging, dragging_placeholder);
+ dragging_placeholder.remove();
+ dragging.style.removeProperty("position");
+ dragging.style.removeProperty("width");
+ dragging.style.removeProperty("height");
+ dragging.style.removeProperty("left");
+ dragging.style.removeProperty("top");
+ dragging.classList.remove("dragged");
+ dragging = null;
}
function add_file_visuals(fileview) {
}
}
+ document.body.onmouseup = (e) => {
+ if (dragging)
+ end_drag();
+ }
+
load_dir();