semagrams.util
A package for useful non-Semagrams-specific functionality
Attributes
Members list
Type members
Classlikes
A class representing a complex number
A class representing a complex number
We use complex numbers for two-dimensional geometry because they can represent either:
- A point
- A vector
- A translation
- A rotation/scaling
Instead of having to remember APIs for all of these, you can just use familiar arithmetic operations.
The operations here are the standard mathematical ones for the complex numbers.
Attributes
- Companion:
- object
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- CustomAttr.type
A view of a variable. Uses a lens to forward gets and sets to an underlying
UndoableVar
.
A view of a variable. Uses a lens to forward gets and sets to an underlying
UndoableVar
.
Note: this is specialized to UndoableVar
right now because there isn't an
informative superclass of both UndoableVar
and Var
. At some point we
should fix this.
Maybe we should send a PR with UndoableVar
and LensedVar
to Laminar?
Attributes
- Todo:
implement more of the
Var
api.- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass Any
- Self type
- NoneError.type
Represents an affine transformation of the 2d plane
Represents an affine transformation of the 2d plane
Attributes
- w
the translation factor Note: scaling is applied before translation.
- z
the scaling/twisting factor
- Companion:
- object
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
The internal state of an UndoableVar, implemented as a cursor into a list.
The internal state of an UndoableVar, implemented as a cursor into a list.
Attributes
- future
states that we have undone (for redo). This goes away once you start editing from a state in the past; we don't have undo trees yet.
- past
previous states (for undoing)
- present
current state
- recording
indicator for whether we should record updates or not
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
A class similar to Var
but with support for undo and redo.
A class similar to Var
but with support for undo and redo.
Attributes
- Graph
- Supertypes
- trait Sink[A]trait SignalSource[A]trait Source[A]class Objecttrait Matchableclass Any
Custom laminar attributes for using complex numbers with svg more easily
Custom laminar attributes for using complex numbers with svg more easily
These can be used both
- with signals, i.e.
xy <-- z
, - with values, i.e.
xy := z
.
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- complexattrs.type
Value members
Concrete methods
Returns the dimensions of the bounding box for text
at fontSize
Returns the dimensions of the bounding box for text
at fontSize
This caches computations, so that repeated queries are fast.
Attributes
- Todo:
we hardcode most of the style for this; we should make this more flexible.
Create the declarations for a sequence of input ports. Include a shape
string to make the ports visible.
Create the declarations for a sequence of input ports. Include a shape
string to make the ports visible.
Attributes
Convert strings to Tikz labels by converting "\n" to "\"
Convert strings to Tikz labels by converting "\n" to "\"
Attributes
Create the declaration of a Tikz node.
Create the declaration of a Tikz node.
Attributes
Create the declarations for a sequence of input ports. Include a shape
string to make the ports visible.
Create the declarations for a sequence of input ports. Include a shape
string to make the ports visible.
Attributes
Create the declaration for a single node along a path.
Create the declaration for a single node along a path.
Attributes
Create the declarations for a sequence of nodes along a path from start
to
stop
. Include a shape
string to make the nodes visible.
Create the declarations for a sequence of nodes along a path from start
to
stop
. Include a shape
string to make the nodes visible.
Attributes
Wrap tikz declarations in the surrounding LaTeX
Wrap tikz declarations in the surrounding LaTeX
Attributes
Make an SVG element containing the html object.
Make an SVG element containing the html object.
We have to specify manually the dimensions and position of the html, because SVG does not have automatic layout (unlike html).
One way of getting "automatic layout" is to make an html element which takes up the entire semagrams window but is transparent and doesn't intercept mouse actions, and then doing layout within that.
Attributes
Extensions
Extensions
Perform fin
if the action is cancelled or errors.
Perform fin
if the action is cancelled or errors.
Note that if the action is cancelled, it never returns, so we only get the
result of fin
if it errors.
Attributes
Convert a possibly erroring IO action to one that safely returns an Option
Convert a possibly erroring IO action to one that safely returns an Option
Attributes
Produce an SVG string representing a whole path. Used in the d
attribute.
Produce an SVG string representing a whole path. Used in the d
attribute.
Attributes
Multiplication by a complex implictly converts to complex
Multiplication by a complex implictly converts to complex
Attributes
Exponentiation as an infix operator
Exponentiation as an infix operator
Attributes
Get the value of an option, throwing an error in a monad if the option is None. The advantage of throwing the error in the monad is that its more easily catchable.
Get the value of an option, throwing an error in a monad if the option is None. The advantage of throwing the error in the monad is that its more easily catchable.
Attributes
Implicits
Exports
Defined exports
A custom svg attribute for setting cx
and cy
from one complex number
A custom svg attribute for setting cx
and cy
from one complex number
Attributes
A custom svg attribute for setting d
(the svg element for describing a
path) from a sequence of Path.Element.
A custom svg attribute for setting d
(the svg element for describing a
path) from a sequence of Path.Element.
Attributes
A custom svg attribute for setting points
from a sequence of complex
numbers
A custom svg attribute for setting points
from a sequence of complex
numbers
Attributes
A custom svg attribute for setting w
and h
from one complex number
A custom svg attribute for setting w
and h
from one complex number
Attributes
A custom svg attribute for setting x
and y
from one complex number
A custom svg attribute for setting x
and y
from one complex number
Attributes
A custom svg attribute for setting x1
and y1
from a complex number
A custom svg attribute for setting x1
and y1
from a complex number
Attributes
A custom svg attribute for setting x2
and y2
from a complex number
A custom svg attribute for setting x2
and y2
from a complex number