semagrams.sprites

Contains a variety of Sprites for displaying parts of a Semagram

Attributes

Members list

Concise view

Type members

Classlikes

case class Arrow(props: PropMap) extends Sprite

A basic sprite used for edges, which looks up the Start and End properties to see where to start and end, has an arrow head pointing towards the end, and curves according to Bend.

A basic sprite used for edges, which looks up the Start and End properties to see where to start and end, has an arrow head pointing towards the end, and curves according to Bend.

It also has an invisible "handle", which is thicker than the arrow and used for mouse events, because otherwise it would be very annoying to mouse over the arrow.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
object Arrow

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Arrow.type
case class Clickable(mouse: MouseController) extends Middleware

A Middleware that attaches click handlers to a sprite

A Middleware that attaches click handlers to a sprite

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
case class DPBox(boxSprite: Sprite, inPortSprite: Sprite, outPortSprite: Sprite, inPort: Ob, outPort: Ob, portStyle: (ACSet, Part) => PropMap) extends Sprite

A Sprite that is a box with ports on both sides.

A Sprite that is a box with ports on both sides.

Attributes

`boxSprite`

the sprite to use for the box

`inPortSprite`

the sprite to use for the left hand ports

`inPort`

the object in the subschema to query for the list of in ports

`outPortSprite`

the sprite to use for the right hand ports

`outPort`

the object in the subschema to query for the list of out ports

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
object DPBox

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
DPBox.type
case class Disc(props: PropMap) extends Sprite

A Sprite for a geometric Disc shape.

A Sprite for a geometric Disc shape.

Auto-resizes based on the content inside.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
object Disc

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Disc.type
case class GenericHTMLSprite(build: () => HtmlElement, globalSize: Signal[Complex]) extends Sprite

A sprite that wraps an HTML element for use inside the SVG.

A sprite that wraps an HTML element for use inside the SVG.

We wrap inside an invisible div that takes up the whole window, so that we can use CSS logic for the actual positioning.

Attributes

build

Constructor for a new HtmlElement

globalSize

A reference to the size of the overall window

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
case class Hoverable(hover: HoverController) extends Middleware

Middleware that attaches mouseover and mouseout handlers that update a global hover state

Middleware that attaches mouseover and mouseout handlers that update a global hover state

Attributes

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

Mixins that can be used to modify Sprites, by updating the data passed in and by updating the function passed in that attaches handlers.

Mixins that can be used to modify Sprites, by updating the data passed in and by updating the function passed in that attaches handlers.

We pass a function that attaches handlers so that the underlying Sprite can decide where those handlers are attached.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Clickable
class Hoverable
case class Rect(props: PropMap) extends Sprite

A sprite for geometric rectangles

A sprite for geometric rectangles

Resizes automatically corresponding to its content.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
object Rect

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Rect.type
case class Wire() extends Sprite

A sprite used for wires. Similar to Arrow, except this one is a spline where the beginning and the end are both horizontal, and it has no arrowhead.

A sprite used for wires. Similar to Arrow, except this one is a spline where the beginning and the end are both horizontal, and it has no arrowhead.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
enum WireProp[T] extends Property

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Property
class Object
trait Matchable
class Any
case class WireStub(defaults: PropMap, dir: Complex) extends Sprite

A sprite for ports which shows the port as a stub of a wire.

A sprite for ports which shows the port as a stub of a wire.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Sprite
class Object
trait Matchable
class Any
case class WithMiddleware(s: Sprite, middleware: Seq[Middleware]) extends Sprite

A wrapper around a Sprite that adds middleware.

A wrapper around a Sprite that adds middleware.

Attributes

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

Value members

Concrete methods

def ACSetEdgeSource(ob: Ob, src: Hom, tgt: Hom, sprite: Sprite): EntitySource[ACSet]

Like ACSetEntitySource, but then also computes the edge properties using edgeProps

Like ACSetEntitySource, but then also computes the edge properties using edgeProps

Attributes

An EntitySource that extracts all parts of type ob from an ACSet and pairs them with sprite along with their subacset

An EntitySource that extracts all parts of type ob from an ACSet and pairs them with sprite along with their subacset

Attributes

def AltDPBox(inPort: Ob, outPort: Ob, portStyle: (ACSet, Part) => PropMap)(es: EditorState): DPBox
def BasicDPBox(inPort: Ob, outPort: Ob, portStyle: (ACSet, Part) => PropMap)(es: EditorState): DPBox
def BasicWireStub(extend: Double): EditorState => WithMiddleware

Adds hover and click handlers to a sprite

Adds hover and click handlers to a sprite

Attributes

An EntitySource that just returns a fixed list of entities.

An EntitySource that just returns a fixed list of entities.

Attributes

def edgeProps(src: Hom, tgt: Hom)(_e: Entity, acs: ACSet, m: EntityMap): PropMap

Compute the properties (i.e. Start and End) for an edge, using the top-level properties in acs and the other sprites in m.

Compute the properties (i.e. Start and End) for an edge, using the top-level properties in acs and the other sprites in m.

If Start/End are already set, it uses those, otherwise it looks up a point on the boundary of the sprite corresponding to the src/tgt of the edge.

Need to update this to look up the sprite for just the first part of src/tgt, and then pass the rest of the path of the part into a method on that sprite.

Attributes

def findBoundary(p: Part, m: EntityMap, dir: Complex): Option[Complex]

Find the point on the boundary in direction dir of the sprite corresponding to p, by looking up the sprite/data in m

Find the point on the boundary in direction dir of the sprite corresponding to p, by looking up the sprite/data in m

Attributes

def findCenter(p: Part, m: EntityMap): Option[Complex]

Find the center of the sprite corresponding to p, by looking up the sprite/data in m

Find the center of the sprite corresponding to p, by looking up the sprite/data in m

Attributes

def wireProps(src: Hom, tgt: Hom, typeProps: (ACSet, Part) => PropMap, dir: Part => Complex, bg: => Part)(_e: Entity, acs: ACSet, m: EntityMap): PropMap

Similar to edgeProps. Computes the position and direction for the ends of a wire from the ports it is connected to, using the top-level properties in acs and the other sprites in m.

Similar to edgeProps. Computes the position and direction for the ends of a wire from the ports it is connected to, using the top-level properties in acs and the other sprites in m.

If src/tgt are present, it uses those, otherwise it looks up an explicit Start/End value in acs

Takes an optional callback argument bg: => Part to relativize the lookup to a variable background for zooming in and out.

Attributes

Extensions

Extensions

extension [A, B](s: Signal[(A, B)])
def splitTuple: (Signal[A], Signal[B])
extension [A](s: Signal[Seq[A]])
def splitWithIndexAndLength[B, C](f: A => B)(g: (B, A, Signal[A], Signal[(Int, Int)]) => C): Signal[Seq[C]]