Unify terminal size determination
This commit is contained in:
+7
-6
@@ -47,6 +47,7 @@ import Dodge.Shockwave.Update
|
||||
import Dodge.SmoothScroll
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Spark
|
||||
import Dodge.Terminal.Type
|
||||
import Dodge.Tesla.Arc
|
||||
import Dodge.TmTm
|
||||
import Dodge.TractorBeam.Update
|
||||
@@ -315,7 +316,8 @@ updateMouseContextGame :: Configuration -> Universe -> Universe
|
||||
updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
|
||||
OverInvDrag i _ _ _ -> u & uvWorld . input . mouseContext .~ invdrag i
|
||||
OverInvDragSelect{} -> u
|
||||
_ -> u & uvWorld . input . mouseContext
|
||||
_ ->
|
||||
u & uvWorld . input . mouseContext
|
||||
.~ fromMaybe aimcontext (overinv <|> overcomb <|> overterm)
|
||||
where
|
||||
w = u ^. uvWorld
|
||||
@@ -332,7 +334,7 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
|
||||
return $ OverInvDrag i' (Just (i, j)) above bneath
|
||||
overinv = do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
selpos@(i,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
|
||||
selpos@(i, j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
|
||||
case w ^? hud . hudElement . subInventory . ciSelection of
|
||||
Just _ -> do
|
||||
guard (i == 0)
|
||||
@@ -384,7 +386,7 @@ getMenuMouseContext screen u = case screen ^. scOptions of
|
||||
u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable
|
||||
|
||||
isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool
|
||||
isOverTerminalScreen cfig _ (V2 x y) =
|
||||
isOverTerminalScreen cfig tm (V2 x y) =
|
||||
x <= xmax
|
||||
&& x >= xmin - 5
|
||||
&& y <= ymax + 5
|
||||
@@ -392,9 +394,8 @@ isOverTerminalScreen cfig _ (V2 x y) =
|
||||
where
|
||||
ldp = secondColumnParams
|
||||
V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
|
||||
s = 5 + 15 * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
||||
-- the 15 is the length of list in the terminal display, don't change
|
||||
-- without changing drawTerminalDisplay
|
||||
tsize = fromIntegral $ getMaxLinesTM (tm ^. tmType) + 1
|
||||
s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
||||
ymin = ymax - s
|
||||
xmax = xmin + 555 -- HACK drawSelectionListBackground
|
||||
|
||||
|
||||
Reference in New Issue
Block a user