Update single selection to be under mouse while dragging
This commit is contained in:
@@ -280,7 +280,7 @@ shiftInvItems ::
|
||||
IM.IntMap (SelectionItem a) ->
|
||||
World ->
|
||||
World
|
||||
shiftInvItems k x ab bn xs ss w = fromMaybe w $ do
|
||||
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
|
||||
@@ -295,6 +295,13 @@ shiftInvItems k x ab bn xs ss w = fromMaybe w $ do
|
||||
guard $ Just (k,maxi+1) < bn
|
||||
return $ shiftInvItemsDown k xs w
|
||||
|
||||
setSelWhileDragging :: World -> World
|
||||
setSelWhileDragging w = fromMaybe w $ do
|
||||
(i,_,xs) <- w ^? hud . hudElement . diSelection . _Just
|
||||
(k,j) <- w ^? input . mouseContext . mcoMaybeSelect . _Just
|
||||
guard $ i == k && j `IS.member` xs
|
||||
return $ w & hud . hudElement . diSelection . _Just . _2 .~ j
|
||||
|
||||
shiftInvItemsUp :: Int -> IS.IntSet -> World -> World
|
||||
shiftInvItemsUp j is w = IS.foldl' f w is
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user