miso-flow
LicenseBSD3-style (see the file LICENSE)
Safe HaskellNone
LanguageHaskell2010

Miso.Flow.Changes

Description

Applying NodeChange / EdgeChange lists to your model, plus selection-change helpers. The change types themselves live in Miso.Flow.Types (port of types/changes.ts); the application logic follows the framework packages' applyChanges.

Synopsis

Documentation

applyNodeChanges :: [NodeChange n] -> [Node n] -> [Node n] Source #

Apply a list of node changes to a node array; mirrors applyNodeChanges from the framework packages.

applyEdgeChanges :: [EdgeChange e] -> [Edge e] -> [Edge e] Source #

Apply a list of edge changes to an edge array; mirrors applyEdgeChanges from the framework packages.

nodeChangeId :: NodeChange n -> NodeId Source #

The node id a change refers to (the new item's id for adds).

edgeChangeId :: EdgeChange e -> EdgeId Source #

The edge id a change refers to (the new item's id for adds).

getSelectionChanges Source #

Arguments

:: [(NodeId, Bool)]

(id, currently selected) for every element

-> Set NodeId

ids that should be selected

-> [NodeChange n] 

Selection changes needed to make exactly the given ids selected; mirrors getSelectionChanges.

selectNodes :: Set NodeId -> [Node n] -> [Node n] Source #

Mark exactly the given node ids as selected.

unselectNodesAndEdges :: Maybe [NodeId] -> Maybe [EdgeId] -> ([Node n], [Edge e]) -> ([Node n], [Edge e]) Source #

Deselect all (or the given) nodes and edges; mirrors unselectNodesAndEdges.