Liking cljdoc? Tell your friends :D

hive-emacs.olympus

Pure Clojure core for Olympus grid view layout calculation.

Layout algorithm: n=1: {:rows 1 :cols 1} ; full screen n=2: {:rows 1 :cols 2} ; side-by-side n=3: {:rows 2 :cols 2 :empty #{[1 1]}} ; 2+1 n=4: {:rows 2 :cols 2} ; 2x2 n=5+: {:tabs (ceil n/4) :per-tab 4} ; tabbed

Pure Clojure core for Olympus grid view layout calculation.


Layout algorithm:
n=1: {:rows 1 :cols 1}           ; full screen
n=2: {:rows 1 :cols 2}           ; side-by-side
n=3: {:rows 2 :cols 2 :empty #{[1 1]}}  ; 2+1
n=4: {:rows 2 :cols 2}           ; 2x2
n=5+: {:tabs (ceil n/4) :per-tab 4}  ; tabbed
raw docstring

assign-positionsclj

(assign-positions lings layout)

Assign lings to grid positions based on layout.

Arguments:

  • lings: Sequence of ling maps with :slave/id
  • layout: Layout specification from calculate-layout

Returns: Map of {ling-id -> {:row R :col C :tab T}}

Assign lings to grid positions based on layout.

Arguments:
- lings: Sequence of ling maps with :slave/id
- layout: Layout specification from calculate-layout

Returns: Map of {ling-id -> {:row R :col C :tab T}}
sourceraw docstring

calculate-layoutclj

(calculate-layout n)

Calculate optimal grid layout for n lings.

Returns layout spec:

  • n=0: {:rows 0 :cols 0}
  • n=1: {:rows 1 :cols 1}
  • n=2: {:rows 1 :cols 2}
  • n=3: {:rows 2 :cols 2 :empty-cells #{[1 1]}}
  • n=4: {:rows 2 :cols 2}
  • n=5+: {:tabs (ceil n/4) :per-tab 4}

Arguments:

  • n: Number of lings to layout

Returns: Layout specification map

Calculate optimal grid layout for n lings.

Returns layout spec:
- n=0: {:rows 0 :cols 0}
- n=1: {:rows 1 :cols 1}
- n=2: {:rows 1 :cols 2}
- n=3: {:rows 2 :cols 2 :empty-cells #{[1 1]}}
- n=4: {:rows 2 :cols 2}
- n=5+: {:tabs (ceil n/4) :per-tab 4}

Arguments:
- n: Number of lings to layout

Returns: Layout specification map
sourceraw docstring

grid-capacityclj

(grid-capacity layout)

Calculate total capacity of a layout.

Arguments:

  • layout: Layout specification

Returns: Maximum lings that fit in layout

Calculate total capacity of a layout.

Arguments:
- layout: Layout specification

Returns: Maximum lings that fit in layout
sourceraw docstring

position-for-cellclj

(position-for-cell positions row col tab)

Get the ling at a specific grid cell.

Arguments:

  • positions: Position map from assign-positions
  • row: Row index (0-based)
  • col: Column index (0-based)
  • tab: Optional tab index (nil for non-tabbed)

Returns: Ling ID or nil

Get the ling at a specific grid cell.

Arguments:
- positions: Position map from assign-positions
- row: Row index (0-based)
- col: Column index (0-based)
- tab: Optional tab index (nil for non-tabbed)

Returns: Ling ID or nil
sourceraw docstring

tabbed?clj

(tabbed? layout)

Check if layout uses tabs.

Arguments:

  • layout: Layout specification

Returns: Boolean

Check if layout uses tabs.

Arguments:
- layout: Layout specification

Returns: Boolean
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close