aboutsummaryrefslogtreecommitdiff
path: root/static/dragable.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-21 16:08:08 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-21 16:25:59 +0100
commite7d80fcfa91f92c712110d58151df0f8f1e6ed86 (patch)
tree9bc424729c8d9e6ef65d959cc0bfe7cc0f9145e8 /static/dragable.ts
parentAdd basic rrule tab. (diff)
downloadcalp-e7d80fcfa91f92c712110d58151df0f8f1e6ed86.tar.gz
calp-e7d80fcfa91f92c712110d58151df0f8f1e6ed86.tar.xz
Rework popup components.
Previously popups were driven through some CSS hacks, which used labels with specific positioning, and z-index changes. This never really worked, and led the rest of the tree to be unmanagable. This commit replaces that system with a simpler one, which is being driven by javascript. This also allowed a much simpler tree, which allowed us to - make the popups rezisable (with a resize anchor) - move the window handle to above (configurable) - Add and remove tabs without having manually reflow where all labels are
Diffstat (limited to 'static/dragable.ts')
-rw-r--r--static/dragable.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/static/dragable.ts b/static/dragable.ts
index 6110a510..b32bb608 100644
--- a/static/dragable.ts
+++ b/static/dragable.ts
@@ -18,7 +18,7 @@ function bind_popup_control(nav: HTMLElement) {
// throw TypeError('not a popup container');
// }
- nav.onmousedown = function(e) {
+ nav.addEventListener('mousedown', function(e) {
/* Ignore mousedown on children */
if (e.target != nav) return;
nav.style.cursor = "grabbing";
@@ -27,7 +27,7 @@ function bind_popup_control(nav: HTMLElement) {
// let popup = nav.closest(".popup-container");
let popup = nav.closest("popup-element") as HTMLElement;
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);