Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1655e5d
commit f4f2ccb
Showing
2 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Constraint exposing (Model, init, positions) | ||
|
||
import Dict exposing (Dict) | ||
|
||
|
||
type Model | ||
= Model | ||
{ -- comment ID to comment height | ||
heights : Dict Int Float | ||
|
||
-- comment ID to ideal position | ||
, attachments : Dict Int Float | ||
|
||
-- comment ID to actual position | ||
, positions : Dict Int Float | ||
|
||
-- margin to leave around comments | ||
, margin : Int | ||
} | ||
|
||
|
||
init : | ||
{ heights : Dict Int Float | ||
, attachments : Dict Int Float | ||
, margin : Int | ||
} | ||
-> Model | ||
init { heights, attachments, margin } = | ||
Model | ||
{ heights = heights | ||
, attachments = attachments | ||
, positions = Dict.empty | ||
, margin = margin | ||
} | ||
|
||
|
||
positions : Model -> Dict Int Float | ||
positions (Model guts) = | ||
guts.positions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters