Cleanup
This commit is contained in:
@@ -91,13 +91,6 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
guard $ Just (fst sstart) == fmap fst msel || isNothing msel
|
||||
return $ w & input . mouseContext . mcoSelEnd .~ fmap snd msel
|
||||
OverInvDrag k mmouseover ab bn -> doDrag 30 k mmouseover ab bn w
|
||||
-- OverInvDrag k mmouseover ab bn -> fromMaybe w $ do
|
||||
-- ss <- w ^? hud . hudElement . diSections . ix k . ssItems
|
||||
-- x <- mmouseover
|
||||
-- is <- w ^? hud . hudElement . diSelection . _Just . _3
|
||||
-- return $ if concurrentIS is
|
||||
-- then shiftInvItems k x ab bn is ss w
|
||||
-- else collectInvItems k is w
|
||||
_ -> w
|
||||
where
|
||||
ldp = invDisplayParams w
|
||||
@@ -116,7 +109,7 @@ doDrag n k mmouseover ab bn w = fromMaybe w $ do
|
||||
x <- mmouseover
|
||||
is <- w ^? hud . hudElement . diSelection . _Just . _3
|
||||
return $ if concurrentIS is
|
||||
then shiftInvItems' n k x ab bn is ss w
|
||||
then shiftInvItems n k x ab bn is ss w
|
||||
else collectInvItems k is w
|
||||
|
||||
tryDropSelected :: Maybe (Int,Int) -> World -> Maybe World
|
||||
@@ -297,31 +290,6 @@ collectInvItems secid is w = fromMaybe w $ do
|
||||
return . h (j + 1) ks $ swapInvItems (\_ _ -> Just (j + 1)) k w'
|
||||
|
||||
shiftInvItems ::
|
||||
Int -> -- section where drag started
|
||||
(Int,Int) -> -- selection item mouse is over
|
||||
Maybe (Int,Int) -> -- selection item "above" mouse position (can be same as over)
|
||||
Maybe (Int,Int) -> -- selection item "below" mouse position (can be same as over)
|
||||
IS.IntSet ->
|
||||
IM.IntMap (SelectionItem a) ->
|
||||
World ->
|
||||
World
|
||||
shiftInvItems k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do
|
||||
let xk = fst x
|
||||
guard $ xk == k || xk + 1 == k || xk -1 == k
|
||||
(maxi,_) <- IS.maxView xs
|
||||
(mini,_) <- IS.minView xs
|
||||
case True of
|
||||
_ | x < (k,mini) -> do
|
||||
guard $ not . null . fst $ IM.split mini ss
|
||||
guard $ Just (k,mini-1) /= ab
|
||||
return $ shiftInvItemsUp k xs w
|
||||
_ | x > (k,maxi) -> do
|
||||
guard $ not . null . snd $ IM.split maxi ss
|
||||
guard $ Just (k,maxi+1) /= bn
|
||||
return $ shiftInvItemsDown k xs w
|
||||
_ -> Nothing
|
||||
|
||||
shiftInvItems' ::
|
||||
Int -> -- recurse limit
|
||||
Int -> -- section where drag started
|
||||
(Int,Int) -> -- selection item mouse is over
|
||||
@@ -331,7 +299,7 @@ shiftInvItems' ::
|
||||
IM.IntMap (SelectionItem a) ->
|
||||
World ->
|
||||
World
|
||||
shiftInvItems' n k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do
|
||||
shiftInvItems n k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do
|
||||
let xk = fst x
|
||||
guard $ xk == k || xk + 1 == k || xk -1 == k
|
||||
(maxi,_) <- IS.maxView xs
|
||||
|
||||
Reference in New Issue
Block a user