Record mouse over combination selections
This commit is contained in:
@@ -40,6 +40,7 @@ data SubInventory
|
||||
{ _ciSections :: IntMap (SelectionSection CombinableItem)
|
||||
, _ciSelection :: Maybe (Int, Int)
|
||||
, _ciFilter :: Maybe String
|
||||
, _ciMouseOver :: Maybe (Int,Int)
|
||||
}
|
||||
| LockedInventory
|
||||
| DisplayTerminal {_termID :: Int}
|
||||
|
||||
@@ -289,9 +289,11 @@ enterCombineInv :: Configuration -> World -> World
|
||||
enterCombineInv cfig w =
|
||||
w & hud . hudElement . subInventory
|
||||
.~ CombineInventory
|
||||
sss
|
||||
selpos
|
||||
Nothing
|
||||
{ _ciSections = sss
|
||||
, _ciSelection = selpos
|
||||
, _ciFilter = Nothing
|
||||
, _ciMouseOver = Nothing
|
||||
}
|
||||
& hud . hudElement . diInvFilter
|
||||
.~ Nothing
|
||||
where
|
||||
|
||||
+13
-1
@@ -102,7 +102,6 @@ getRootItemBounds i inv = do
|
||||
y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID
|
||||
return (x,y)
|
||||
|
||||
|
||||
drawDIMouseOver :: World -> Picture
|
||||
drawDIMouseOver w = fromMaybe mempty $ do
|
||||
(j, i) <- w ^? hud . hudElement . diMouseOver . _Just
|
||||
@@ -112,6 +111,15 @@ drawDIMouseOver w = fromMaybe mempty $ do
|
||||
where
|
||||
curs = BackdropCursor
|
||||
|
||||
drawCIMouseOver :: World -> Picture
|
||||
drawCIMouseOver w = fromMaybe mempty $ do
|
||||
(j, i) <- w ^? hud . hudElement . subInventory . ciMouseOver . _Just
|
||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
let idp = invDisplayParams w
|
||||
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (j, i)
|
||||
where
|
||||
curs = BackdropCursor
|
||||
|
||||
getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
|
||||
getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
|
||||
Just (MouseInvSelect s (Just e)) -> Just (s, e)
|
||||
@@ -147,6 +155,10 @@ drawCombineInventory cfig sss w =
|
||||
<> drawSelectionSections sss secondColumnParams cfig
|
||||
<> drawSSCursor sss msel secondColumnParams curs cfig
|
||||
<> combineInventoryExtra sss msel cfig w
|
||||
<> translateScreenPos
|
||||
cfig
|
||||
(secondColumnParams ^. ldpPos)
|
||||
(drawCIMouseOver w)
|
||||
where
|
||||
curs = BoundaryCursor [North, South, West]
|
||||
msel = w ^? hud . hudElement . subInventory . ciSelection . _Just
|
||||
|
||||
@@ -223,6 +223,7 @@ inverseSelSecYintXPosCheck cfig ldp x yint sss = do
|
||||
let l = length $ _ssShownItems ss
|
||||
V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos)
|
||||
guard (x - x0 < 150) -- HACK, should determine selection item width and offset below
|
||||
guard (x > x0)
|
||||
if l <= yint
|
||||
then inverseSelSecYint (yint - l) othersss
|
||||
else do
|
||||
|
||||
@@ -280,6 +280,7 @@ functionalUpdate u =
|
||||
. over uvWorld updateWheelEvents
|
||||
. over uvWorld (updateMouseInventorySelection (u ^. uvConfig))
|
||||
. over uvWorld (updateMouseOverInventory (u ^. uvConfig))
|
||||
. over uvWorld (updateMouseOverCombineInventory (u ^. uvConfig))
|
||||
. over uvWorld zoneClouds
|
||||
. over uvWorld zoneCreatures
|
||||
-- . over uvWorld updateInventorySelectionList
|
||||
@@ -387,6 +388,15 @@ updateMouseOverInventory cfig w = fromMaybe w $ do
|
||||
where
|
||||
ldp = invDisplayParams w
|
||||
|
||||
updateMouseOverCombineInventory :: Configuration -> World -> World
|
||||
updateMouseOverCombineInventory cfig w = fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
return $
|
||||
w & hud . hudElement . subInventory . ciMouseOver
|
||||
.~ inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
|
||||
where
|
||||
ldp = secondColumnParams
|
||||
|
||||
updateWheelEvents :: World -> World
|
||||
updateWheelEvents w
|
||||
| yi == 0 = w
|
||||
|
||||
Reference in New Issue
Block a user