Work on boundaries for dragging windows

This commit is contained in:
2026-04-06 00:52:09 +01:00
parent ed28af8d11
commit 1f52c4b588
9 changed files with 17 additions and 20 deletions
+4 -9
View File
@@ -132,15 +132,10 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
setPixelOffsetBounded :: Config -> Point2 -> LDParams -> LDParams
setPixelOffsetBounded cfig (V2 x y) ldp = ldp & ldpPos . spPixelOff .~ V2 x' y'
where
-- (V2 xmin ymax, V2 xmax ymin) = ldpRect cfig ldp
h = fromIntegral $ cfig ^. windowX
w = fromIntegral $ cfig ^. windowY
V2 ax ay = -V2 w h + ldp ^. ldpPos . spScreenOff * V2 w h
x' = min w $ max 1 x
y' = y
boundPixelOffset :: Config -> Point2 -> Point2 -> Point2 -> Point2
boundPixelOffset cfig nw se p = p
h = fromIntegral $ cfig ^. windowY
w = fromIntegral $ cfig ^. windowX
x' = min (w - (1+10*ldp ^?! ldpSize . _Just . _x . to fromIntegral)) $ max 1 x
y' = max (1+20*(ldp^.ldpVerticalGap + ldp^?!ldpSize._Just._y.to fromIntegral)-h) y
--leftHeldPosShift :: World -> Point2
--leftHeldPosShift w = fromMaybe 0 $ do