Allow dragging of selected items in inventory
This commit is contained in:
@@ -9,6 +9,8 @@ module Dodge.SelectionSections (
|
||||
inverseSelSecYint,
|
||||
posSelSecYint,
|
||||
inverseSelNumPos,
|
||||
inverseSelBoundaryUp,
|
||||
inverseSelBoundaryDown,
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
@@ -186,5 +188,32 @@ inverseSelNumPos ::
|
||||
inverseSelNumPos cfig ldp sss (V2 x y) =
|
||||
inverseSelSecYintXPosCheck cfig ldp x (posSelSecYint cfig ldp y) sss
|
||||
|
||||
inverseSelBoundaryUp ::
|
||||
Configuration ->
|
||||
ListDisplayParams ->
|
||||
SelectionSections a ->
|
||||
Point2 ->
|
||||
Maybe (Int,Int)
|
||||
inverseSelBoundaryUp cfig ldp sss (V2 _ y) = do
|
||||
sel <- inverseSelSecYint (posSelSecYint cfig ldp y) sss
|
||||
let mselup = inverseSelSecYint (posSelSecYint cfig ldp y - 1) sss
|
||||
if Just sel == mselup
|
||||
then return $ sel & _2 +~ 1
|
||||
else return $ sel
|
||||
|
||||
inverseSelBoundaryDown ::
|
||||
Configuration ->
|
||||
ListDisplayParams ->
|
||||
SelectionSections a ->
|
||||
Point2 ->
|
||||
Maybe (Int,Int)
|
||||
inverseSelBoundaryDown cfig ldp sss (V2 _ y) = do
|
||||
sel <- inverseSelSecYint (posSelSecYint cfig ldp y) sss
|
||||
let mseldown = inverseSelSecYint (posSelSecYint cfig ldp y + 1) sss
|
||||
if Just sel == mseldown
|
||||
then return $ sel & _2 -~ 1
|
||||
else return sel
|
||||
|
||||
|
||||
--getIthPos :: Int -> IM.IntMap (SelectionItem a) -> Int
|
||||
--getIthPos i sm = sum . fmap _siHeight . fst $ IM.split i sm
|
||||
|
||||
Reference in New Issue
Block a user