HoverController

semagrams.controllers.HoverController
See theHoverController companion object
class HoverController() extends Controller

A bit of global state that keeps track of the entity that is currently hovered.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def apply(_es: EditorState, _elt: SvgElement): Unit

Does nothing

Does nothing

Required because HoverController is a Controller, but we don't actually need to hook up any part of the EditorState.

Attributes

def hoverable(ent: Entity): List[EventListener[MouseEvent, MouseEvent]]

Returns a list of binders that can be applied to an svg element in order to make that svg element update the HoverController on mouseenter and mouseleave events.

Returns a list of binders that can be applied to an svg element in order to make that svg element update the HoverController on mouseenter and mouseleave events.

Example use:

svg.rect(
 hover.hoverable(ent)
)

Attributes

ent

the Entity which should be recorded as being hovered

def switchState[A](ent: Entity, caseHovered: A, caseUnhovered: A): Signal[A]

Returns a laminar.Signal that either has the state caseHovered or caseUnhovered depending on whether ent is hovered or not.

Returns a laminar.Signal that either has the state caseHovered or caseUnhovered depending on whether ent is hovered or not.

Attributes

caseHovered

the value the signal should have when ent is hovered

caseUnhovered

the value the signal should have when ent is not hovered

ent

the entity we care about

Concrete fields

val $state: Var[State]