Actions

semagrams.Actions
case class Actions(es: EditorState, m: UndoableVar[ACSet], ui: UIState)

This class bundles the common arguments to many actions one might want to do in a binding so that you don't have to pass them in every time, and then provides a bunch of commonly used actions as methods.

Attributes

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

Members list

Concise view

Value members

Concrete methods

def add(p: Part, ob: Ob, props: PropMap): IO[Part]

Add and return a part to the acset at p of type ob with properties props

Add and return a part to the acset at p of type ob with properties props

Attributes

def add(p: Part, ob: Ob, init: ACSet): IO[Part]

Add and return a part to the acset at p of type ob with properties props

Add and return a part to the acset at p of type ob with properties props

Attributes

def addAtMouse(ob: Ob, init: ACSet): IO[Part]

Add and return a part to the model with type Ob and subacset given by init, and set the Center of that new part to be the current mouse position

Add and return a part to the model with type Ob and subacset given by init, and set the Center of that new part to be the current mouse position

Attributes

def addAtMouse(ob: Ob): IO[Part]

Add and return a part to the model with type Ob and Center the current mouse position.

Add and return a part to the model with type Ob and Center the current mouse position.

Attributes

def addAtMouse_(ob: Ob, init: ACSet): IO[Unit]

addAtMouse without returning the part

addAtMouse without returning the part

Attributes

def addAtMouse_(ob: Ob): IO[Unit]

addAtMouse without returning the part

addAtMouse without returning the part

Attributes

def add_(p: Part, ob: Ob, props: PropMap | ACSet): IO[Unit]

add without returning the part

add without returning the part

Attributes

def die[A]: IO[A]
def doAll[A](fs: Seq[IO[A]]): IO[Seq[A]]
def drag[Memo, Return](start: (z: Complex) => IO[Memo], during: (Memo, Complex) => Unit, after: Memo => IO[Return])(s: Part): IO[Return]

A generalized drag action

A generalized drag action

At the beginning, compute a value memo of type Memo from the mouse position.

While the drag is happening, execute during with memo and the mouse position of the drag.

Finally, call after with memo to get the return value.

If the drag is canceled, this resets the state.

Attributes

Todo:
  • It seems like we do not use the parameter s anywhere; we may want to remove it
  • during executes for side-effects, which could be anything! But we are assuming that all it does is change m. We should express this explicitly by having during return a function ACSet => ACset, and then hook that into modifying m.
  • Is drag the best name for this?
def dragEdge[WType](ob: Ob, src: Hom, tgt: Hom, lift: (Part, Complex) => Seq[(Ob, Int)], eqTypes: (Part, Part) => IO[Unit])(s: Part): IO[Part]

Drag to construct an edge between two parts

Drag to construct an edge between two parts

Returns the part corresponding to the edge that was constructed.

Attributes

eqTypes

Optional action when attaching src and tgt (e.g., equating port and wire types)

lift

Optionally create/move a part (e.g., new port on a box) based on the initiating part s and the mouse location

ob

The type of the new edge

s

The part initiating the drag action

src

The source mapping for the edge type

tgt

The target mapping for the edge type

def dragMove(i: Part): IO[Unit]

Drag to move a part around

Drag to move a part around

Attributes

def edit(p: Property { type Value = String; }, multiline: Boolean)(i: Part): IO[Unit]

Edit the content of the part i, using popup text box

Edit the content of the part i, using popup text box

Attributes

def exportTikz(obs: Seq[Ob], hide: Seq[Ob]): IO[Unit]

Bring up a textbox that can be used to export a tikz serialization

Bring up a textbox that can be used to export a tikz serialization

Attributes

def importExport: IO[Unit]

Bring up a textbox that can be used for copy/pasting the serialized version of the current state

Bring up a textbox that can be used for copy/pasting the serialized version of the current state

Attributes

def liftTo(p: Part, ext: Seq[(Ob, Int)]): IO[Part]
def remove(p: Part, f: Property): IO[Unit]

Unset the value of the property f of the part p

Unset the value of the property f of the part p

Attributes

def remove(p: Part): IO[Unit]

Remove the part p

Remove the part p

Attributes

def set(p: Part, f: Property, v: Value, check: Boolean): IO[Unit]

Set the value of the property f at the part p to be v

Set the value of the property f at the part p to be v

Attributes

def tryBBox(b: Part): Option[BoundingBox]

Try to get the bounding box of b as it is currently displayed on the screen

Try to get the bounding box of b as it is currently displayed on the screen

Attributes

def unplug(p: Part, w: Part, src: Hom, tgt: Hom, lift: (Part, Complex) => Seq[(Ob, Int)], eqTypes: (Part, Part) => IO[Unit]): IO[Part]

Like dragEdge, but begins by removing an existing port assignment.

Like dragEdge, but begins by removing an existing port assignment.

Attributes

def zoomIn(b: Part, layout: (sz: Complex, acset: ACSet) => ACSet, esources: EditorState => Seq[EntitySource[ACSet]]): IO[EntitySourceViewport[ACSet]]

Display the internal ACSet of b in the main viewport.

Display the internal ACSet of b in the main viewport.

First layout the ACSet, then use esources sprites to produce the svg

Attributes

def zoomOut(layout: (sz: Complex, acset: ACSet) => ACSet, esources: EditorState => Seq[EntitySource[ACSet]]): IO[EntitySourceViewport[ACSet]]

Display the internal ACSet that the current view is contained in.

Display the internal ACSet that the current view is contained in.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

val debug: IO[Unit]
val del: IO[Unit]

Remove the part currently hovered

Remove the part currently hovered

Attributes