Glide

com.alecdorrington.laminarcomponents.Glide
object Glide

Slides the elements a change moves from where they were drawn into their new places, rather than letting them jump there: where each stood is read before the change and again once it is laid out, and each that moved is drawn from where it stood and slid home. Elements are matched by keys of the caller's, so that one drawn afresh slides as the one it replaced. A block slides by transform; an inline element, which takes none, by its offsets, so it must be position: relative. Nothing slides for a reader who would rather nothing moved of itself.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Glide.type

Members list

Type members

Types

opaque type Drawn

Where keyed elements stood on the page, as drawn.

Where keyed elements stood on the page, as drawn.

Attributes

Value members

Concrete methods

def apply(root: Element, keyed: Element => Iterable[(String, Element)])(change: () => Unit): Unit

Makes a change, then slides the elements keyed finds within root into their new places once it is laid out, in the next frame.

Makes a change, then slides the elements keyed finds within root into their new places once it is laid out, in the next frame.

Value parameters

change

The change.

keyed

The elements within the root that may move, each under its key.

root

The element holding those that may move.

Attributes

def drawn(elements: Iterable[(String, Element)]): Drawn

Reads where elements stand now.

Reads where elements stand now.

Value parameters

elements

The elements, each under its key.

Attributes

Returns

Where each stands.

def settle(before: Drawn, elements: Iterable[(String, Element)], slides: (Double, Double) => Boolean = ...): Boolean

Slides each of the given elements that stood elsewhere before from there into its place, saying whether any did. Only those moved by as much as slides accepts, across and down, slide; the rest stand where they now lie at once.

Slides each of the given elements that stood elsewhere before from there into its place, saying whether any did. Only those moved by as much as slides accepts, across and down, slide; the rest stand where they now lie at once.

Value parameters

before

Where the elements stood before the change.

elements

The elements as they now are, each under its key.

slides

Whether an element moved so far across and down slides.

Attributes

Returns

Whether any element slid.

Concrete fields

val duration: Double

How long a slide takes, in milliseconds.

How long a slide takes, in milliseconds.

Attributes