Module

Hylograph.Flow.Render.Reshape

Package
purescript-hylograph-flow-render
Repository
afcondon/purescript-hylograph-flow-render

A layout with its boxes moved, its ribbons following; and two layouts of one projection blended (0.6).

Both are for showing a layout on the way to being another: a transition between two cuts (Hylograph.Flow.Render.Transition), and a node drawn quiet (Hylograph.Flow.Render.Present). Neither places anything: the boxes are the caller's, and a route goes with its two ends.

WHAT IS KEPT. A route's start goes with the side of its source that it leaves by and its end with the side of its target that it enters by (the far side and the near side along the flow), each by exactly as much as that side moved; what is between goes by as much as its place along the route says, from the one to the other. So a ribbon stands where it stood on each node's side, as broad as it was: if widths were carried before (Laws.Carried), they are carried after, exactly, and every route still meets its nodes (Laws.Routed). A route keeps its pieces, so the layout before and the layout after can be blended piece by piece. What is not kept: boxes may overlap, a ribbon may cross a node, and an outline is wherever the caller put it. These are pictures of a layout in motion, not layouts an engine would make.

#Reshaping Source

type Reshaping = { height :: Number, node :: PlacedNode -> Box, outline :: PlacedOutline -> Box, width :: Number }

Where each node's box is to be, and each outline's; and how large the picture then is.

#reshaped Source

reshaped :: forall wire. Reshaping -> Layout wire -> Layout wire

A layout with every box where the reshaping puts it and every route gone with its ends; see the module's header.

#blend Source

blend :: forall wire. Layout wire -> Layout wire -> Number -> Layout wire

A layout part of the way from one to another of the same shape (sameShape): every number of the first gone that part of the way to the second's (0 is the first, 1 the second). A route whose pieces are not the other's is the first's until half way and the second's after; an outline that only one of them has is drawn while that one is nearer. Where both carry widths and their ribbons stand alike on their nodes, so does every blend of them: a ribbon's end goes with its node's side.

#sameShape Source

sameShape :: forall wire. Layout wire -> Layout wire -> Boolean

Whether two layouts are of one projection, piece for piece: the same nodes in order, the same edges, and every route of the same pieces. Two such layouts can be blended.