Allow for indentation of individual selection items

This commit is contained in:
2024-09-12 10:21:35 +01:00
parent eddb313ea1
commit 891fd0079c
8 changed files with 213 additions and 181 deletions
+9
View File
@@ -10,6 +10,12 @@ import Data.Aeson
import Data.Aeson.TH
import Data.Bifunctor
data DoubleTreeNodeType
= DTRootNode
| DTTopNode
| DTMidAboveNode
| DTMidBelowNode
| DTBottomNode
data DoubleTree a = DT {_dtValue :: a,_dtLeft :: [DoubleTree a],_dtRight :: [DoubleTree a]}
deriving (Eq,Ord,Show,Read)
@@ -21,6 +27,9 @@ data LabelDoubleTree b a = LDT {_ldtValue :: a, _ldtLeft :: [(b,LabelDoubleTree
instance Functor DoubleTree where
fmap f (DT x l r) = DT (f x) (fmap (fmap f) l) (fmap (fmap f) r)
instance Foldable DoubleTree where
foldMap f (DT x l r) = foldMap (foldMap f) l <> f x <> foldMap (foldMap f) r
instance Functor (LabelDoubleTree b) where
fmap f (LDT x l r) = LDT (f x) (fmap (second $ fmap f) l) (fmap (second $ fmap f) r)
-11
View File
@@ -5,7 +5,6 @@
module Dodge.Data.SelectionList where
import Dodge.Data.DoubleTree
import Color
import Control.Lens
import Data.IntMap.Strict (IntMap)
@@ -62,16 +61,6 @@ data SelectionSection a = SelectionSection
, _ssIndent :: Int
, _ssDescriptor :: String
}
|
SelectionTreeSection
{ _stsItems :: DoubleTree (SelectionItem a)
, _ssCursor :: Maybe SectionCursor
, _ssMinSize :: Int
, _ssOffset :: Int
, _ssShownItems :: [Picture]
, _ssIndent :: Int
, _ssDescriptor :: String
}
data SelectionWidth