~starkingdoms/starkingdoms

2e07985da4a84be4a611b4e18bb5135d48cecd53 — TerraMaster85 1 year, 11 months ago 477c730
Temporarily disable on-load draggable popup position bounds checking
1 files changed, 6 insertions(+), 3 deletions(-)

M starkingdoms-client/src/components/ui/Popup.svelte
M starkingdoms-client/src/components/ui/Popup.svelte => starkingdoms-client/src/components/ui/Popup.svelte +6 -3
@@ 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,