From 2e07985da4a84be4a611b4e18bb5135d48cecd53 Mon Sep 17 00:00:00 2001 From: TerraMaster85 Date: Sat, 6 Jan 2024 19:07:38 -0500 Subject: [PATCH] Temporarily disable on-load draggable popup position bounds checking --- starkingdoms-client/src/components/ui/Popup.svelte | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/starkingdoms-client/src/components/ui/Popup.svelte b/starkingdoms-client/src/components/ui/Popup.svelte index b3ba3d848fb8add73a43cb2d52af597c397512ea..e4e8f5b72d0e5cf0214ce24d3cc306cc23353172 100644 --- a/starkingdoms-client/src/components/ui/Popup.svelte +++ b/starkingdoms-client/src/components/ui/Popup.svelte @@ -33,7 +33,9 @@ pos2 = parseInt(window.localStorage.getItem(`pop-${id}left`)); // Correct illegally placed draggables - [pos1, pos2] = dragBoundsEnforce(); + // Disabled until I can find a nice way to run this after the dynamic + // content injection by svelte + //[pos1, pos2] = dragBoundsEnforce(); // I hate JS for letting me pull crap like this popup.style.top = `${pos1}px`; @@ -65,8 +67,6 @@ let [left, top, bounds_violated] = dragBoundsEnforce(); - console.log(left, top, bounds_violated); - popup.style.left = left + "px"; popup.style.top = top + "px"; } @@ -77,6 +77,9 @@ let popup_dimensions = popup.getBoundingClientRect(); + // This was originally meant to specify the amount of error acceptable + // before snapping to an edge or corner, but now it seems to merely adjust + // the amount of pixels between the screen edge and the bounds. let snap_distance = 16; let bounds = { top: 8 + snap_distance,