peterszerzo / elm-arborist / Arborist.Settings

Various settings for the editor, defined at the time of initialization, or added at any time later in the program. Includes various geometric settings such as canvas dimensions and the gutter between nodes, and, in a later version of this package, more functional settings such as hiding placeholder nodes.

Geometry

nodeWidth : Basics.Int -> Internals.Settings.Setting node

Sets the width of node.

nodeHeight : Basics.Int -> Internals.Settings.Setting node

Sets the width of node.

canvasWidth : Basics.Int -> Internals.Settings.Setting node

Sets the width of the canvas.

canvasHeight : Basics.Int -> Internals.Settings.Setting node

Sets the height of the canvas.

level : Basics.Int -> Internals.Settings.Setting node

Vertical distance between the bottom of a parent node and the top of its child.

gutter : Basics.Int -> Internals.Settings.Setting node

Horizontal gutter between nodes.

centerOffset : Basics.Int -> Basics.Int -> Internals.Settings.Setting node

When a node is activated, the interface centers it automatically. Sometimes, though, it is useful to move it somewhere other than the center, e.g. to accommodate a large pop-up underneath. With this configuration option, you can specify this offset, horizontal first, vertical second.

connectorStroke : String -> Internals.Settings.Setting node

Stroke color of the lines connecting siblings.

connectorStrokeWidth : String -> Internals.Settings.Setting node

Stroke width of the lines connecting siblings.

Features

dragAndDrop : Basics.Bool -> Internals.Settings.Setting node

Enable or disable drag and drop with this boolean flag (True is enabled, which is the default value). Note that the tree can still be panned if drag and drop is disabled.

keyboardNavigation : Basics.Bool -> Internals.Settings.Setting node

Enable or disable keyboard navigation, which traverses and activates nodes using the arrow keys

keyboardNavigationOutside : String -> Basics.Bool -> Internals.Settings.Setting node

Similar to keyboardNavigation, but only works if the event is recorded outside a DOM element with the specified ID. Use this to disable keyboard navigation if the user types inside an input.

defaultNode : node -> Internals.Settings.Setting node

Sets a default node to be created automatically when a child placeholder is clicked. If none is specified, the placeholder is activated so that a new node may be added manually.

showPlaceholderLeaves : Basics.Bool -> Internals.Settings.Setting node

Set whether placeholder leaves should be displayed.

showPlaceholderLeavesAdvanced : ({ node : node, parent : Maybe node, children : List node, siblings : List node } -> Basics.Bool) -> Internals.Settings.Setting node

A fine-grained control version of showPlaceholderLeaves, allowing control on the display of placeholder leaves based on the contents of the node, as well as its parent and children.

isNodeClustered : (node -> Basics.Bool) -> Internals.Settings.Setting node

Tells arborist which nodes should be clustered. Clustered nodes do not render their children, making the tree easier to understand. Use e.g. setActive to toggle clustered state on and off.

extendConnectorsBy : Basics.Int -> Internals.Settings.Setting node

Specifies whether node connectors should extend a certain distance at root- or leaf nodes to connect to peripheral UI elements

extendConnectorsByAdvanced : ({ node : Maybe node, parent : Maybe node, children : List node, siblings : List node } -> Maybe Basics.Int) -> Internals.Settings.Setting node

A fine-grained control version of showPlaceholderLeaves, allowing control on the display of placeholder leaves based on the contents of the node, as well as its parent and children.

checksum : String -> Internals.Settings.Setting node

A checksum value for settings, allowing the layout algorithm to know when the settings have not meaningfully changed and that a previous computed tree layout can be re-used.

This is necessary because some settings are functions which cannot be compared directly.