package toffee
Build not yet checked sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
CSS layout engine for OCaml (Flexbox, Grid, Block)
Install
dune-project
Dependency
Authors
Maintainers
Sources
mosaic-0.3.0.tbz
sha256=a92cbbcbe016fb19fb0a749222da0e459a9567aef3f4c7340d9bd6b71c53ed6f
sha512=6a7ab054605538bb31a2b73a1a6d093981a2704c9f0af5852221c05735290d74aca7c7282298c4d0f91e86a800e2ccd94b4918af883cd963449c758eb6b272b3
doc/src/toffee.geometry/rect.ml.html
Source file rect.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62type 'a t = { left : 'a; right : 'a; top : 'a; bottom : 'a } let all value = { left = value; right = value; top = value; bottom = value } (* Creation *) let make ~left ~right ~top ~bottom = { left; right; top; bottom } (* Mapping functions *) let map f rect = { left = f rect.left; right = f rect.right; top = f rect.top; bottom = f rect.bottom; } let map2 f r1 r2 = { left = f r1.left r2.left; right = f r1.right r2.right; top = f r1.top r2.top; bottom = f r1.bottom r2.bottom; } let zip_size size f rect = { left = f rect.left size.Size.width; right = f rect.right size.Size.width; top = f rect.top size.height; bottom = f rect.bottom size.height; } (* Component extraction *) let horizontal_components rect = Line.{ start = rect.left; end_ = rect.right } let vertical_components rect = Line.{ start = rect.top; end_ = rect.bottom } (* Comparison and string functions *) let compare cmp a b = let cmp_left = cmp a.left b.left in if cmp_left <> 0 then cmp_left else let cmp_right = cmp a.right b.right in if cmp_right <> 0 then cmp_right else let cmp_top = cmp a.top b.top in if cmp_top <> 0 then cmp_top else cmp a.bottom b.bottom let equal eq a b = eq a.left b.left && eq a.right b.right && eq a.top b.top && eq a.bottom b.bottom let to_string f rect = Printf.sprintf "{ left: %s; right: %s; top: %s; bottom: %s }" (f rect.left) (f rect.right) (f rect.top) (f rect.bottom) let pp f fmt rect = Format.fprintf fmt "{ left: %a; right: %a; top: %a; bottom: %a }" f rect.left f rect.right f rect.top f rect.bottom
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>