EditorState

semagrams.EditorState
class EditorState(val elt: SvgElement, dispatcher: Dispatcher[IO], val eventQueue: Queue[IO, Event])

This is the main state for Semagrams.

Even though we call this "state", notice that everything here is actually immutable. The state itself is all stored in Laminar stuff, like Vars and EventBuses.

We pass in dispatcher and eventQueue because this constructor can't run in IO, and thus can't make them itself. It can however use the dispatcher to attach the EventBus of events to the queue.

Attributes

dispatcher

An IO dispatcher, used to bind the EventBus of events to eventQueue.

elt

The main svg element of the semagram.

eventQueue

A queue to use for events. We might also throw things into this queue for testing purposes.

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Classlikes

The viewports used in the editor

The viewports used in the editor

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

Get the current background part

Get the current background part

Attributes

def bgPlus(p: Part): Part

Extend the current background part by p

Extend the current background part by p

Attributes

def bind[A](bindings: Seq[Binding[A]]): IO[Option[A]]

Same thing as bindNoCatch, except it handles any errors and returns None when there is one.

Same thing as bindNoCatch, except it handles any errors and returns None when there is one.

Attributes

def bindForever[A](bindings: Seq[Binding[A]]): IO[Nothing]

Run the bindings forever, ignoring any errors

Run the bindings forever, ignoring any errors

Attributes

def bindNoCatch[A](bindings: Seq[Binding[A]]): IO[A]

Get the next event that matches one of the bindings, and then execute the action that is associated to it.

Get the next event that matches one of the bindings, and then execute the action that is associated to it.

Attributes

def bindUntilFail[A](bindings: Seq[Binding[A]]): IO[Unit]

Run the bindings repeatedly until there is an error, and then stop

Run the bindings repeatedly until there is an error, and then stop

Attributes

def deregister(vname: ViewportID): Unit

Deregister a viewport, which has the side effect of removing its main element from elt

Deregister a viewport, which has the side effect of removing its main element from elt

Attributes

Deprecated in favor of size

Deprecated in favor of size

Attributes

def hovered: IO[Option[Entity]]

An IO action that when run, returns the current hovered entity

An IO action that when run, returns the current hovered entity

Attributes

def hoveredEntity(ty: EntityType): IO[Option[Entity]]

An IO action that filters hovered for entities of a certain type.

An IO action that filters hovered for entities of a certain type.

Attributes

def hoveredPart: IO[Option[Part]]

An IO action that filters hovered for just Parts and converts None the background part (e.g., ROOT)

An IO action that filters hovered for just Parts and converts None the background part (e.g., ROOT)

Attributes

def hoveredPart(ty: PartType): IO[Option[Part]]

An IO action that filters hovered for just Parts of a certain type.

An IO action that filters hovered for just Parts of a certain type.

Attributes

def hoveredPart(tys: Seq[PartType]): IO[Option[Part]]

An IO action that filters hovered for just Parts that are one of several types.

An IO action that filters hovered for just Parts that are one of several types.

Attributes

def makeMenu(ui: UIState, entries: Seq[(String, Part => IO[Unit])])(i: Part): IO[Unit]

Constructs a menu at the current mouse position indexed by part i

Constructs a menu at the current mouse position indexed by part i

Attributes

def makeUI(): IO[UIState]

Make a new UIState object and register its viewport

Make a new UIState object and register its viewport

Attributes

def makeViewport[A](vpname: ViewportID, state: Signal[A], sources: Seq[EntitySource[A]]): IO[EntitySourceViewport[A]]

Construct a new viewport

Construct a new viewport

Attributes

sources

the viewport has entities extracted using these EntitySources

state

the viewport is a view on this signal

def mousePos: IO[Complex]

An IO action that when run, returns the current mouse position

An IO action that when run, returns the current mouse position

Attributes

def register(vpname: ViewportID, v: Viewport): SvgElement

Register a viewport.

Register a viewport.

This adds the viewport to viewports, which has the side-effect of attaching its main element to this.elt while the viewport is still in viewports

Attributes

Concrete fields

all of the controllers

all of the controllers

Attributes

val currentView: Var[Part]

The current part shown in the viewport. Used for nested diagrams (zooming).

The current part shown in the viewport. Used for nested diagrams (zooming).

Attributes

val elt: SvgElement

All the entities in all of the viewports, and their associated sprites.

All the entities in all of the viewports, and their associated sprites.

Attributes

val eventQueue: Queue[IO, Event]
val events: EventBus[Event]

The main event bus for Semagrams.

The main event bus for Semagrams.

Attributes

val size: Var[Complex]

The current size of the main element. Kept in sync by another line later.

The current size of the main element. Kept in sync by another line later.

Attributes

val viewports: Var[Map[ViewportID, Viewport]]

The viewports in current use

The viewports in current use

Attributes