aboutsummaryrefslogtreecommitdiff
path: root/static/dragable.js
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-10-04 17:40:59 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-10-04 17:43:45 +0200
commitc6c65f9e8273a5bc1b2ac1155d66003d2b98591c (patch)
treeda25ccd8af897dbc2671008e06f22d08d1208035 /static/dragable.js
parentwork (diff)
downloadcalp-c6c65f9e8273a5bc1b2ac1155d66003d2b98591c.tar.gz
calp-c6c65f9e8273a5bc1b2ac1155d66003d2b98591c.tar.xz
{.js => .ts} on relavant files.
Diffstat (limited to 'static/dragable.js')
-rw-r--r--static/dragable.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/static/dragable.js b/static/dragable.js
deleted file mode 100644
index 6eb0b999..00000000
--- a/static/dragable.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Apply to a given component to make it draggable.
- Drag area (usually a title bar) should be be the only argument.
- It is REQUIRED that the object which should be moved have the class
- 'popup-container';
-*/
-
-
-/*
- Given the navbar of a popup, make it dragable.
- */
-function bind_popup_control (nav) {
-
- if (! nav.closest('.popup-container')) {
- throw TypeError('not a popup container');
- }
-
- nav.onmousedown = function (e) {
- /* Ignore mousedown on children */
- if (e.target != nav) return;
- nav.style.cursor = "grabbing";
- nav.dataset.grabbed = "true";
- nav.dataset.grabPoint = e.clientX + ";" + e.clientY;
- // let popup = nav.closest(".popup-container");
- let popup = nav.closest("popup-element");
- nav.dataset.startPoint = popup.offsetLeft + ";" + popup.offsetTop;
- }
- window.addEventListener('mousemove', function (e) {
- if (nav.dataset.grabbed) {
- let [x, y] = nav.dataset.grabPoint.split(";").map(Number);
- let [startX, startY] = nav.dataset.startPoint.split(";").map(Number);
- // let popup = nav.closest(".popup-container");
- let popup = nav.closest("popup-element");
-
- popup.style.left = startX + (e.clientX - x) + "px";
- popup.style.top = startY + (e.clientY - y) + "px";
- }
- });
- window.addEventListener('mouseup', function () {
- nav.dataset.grabbed = "";
- nav.style.cursor = "";
- });
-}