pub enum Command {
Show 18 variants
Move {
id: ShapeId,
by: Delta,
},
Resize {
id: ShapeId,
by: Delta,
},
RotateLine {
id: ShapeId,
},
SetStroke {
id: ShapeId,
stroke: Stroke,
},
SetText {
id: ShapeId,
text: Option<Text>,
},
InvertTerminals {
id: ShapeId,
},
MoveEndpoint {
id: ShapeId,
end: End,
by: Delta,
out: i16,
},
ResetEndpoint {
id: ShapeId,
end: End,
},
SetEndpointTerminal {
id: ShapeId,
end: End,
terminal: Terminal,
},
DetachEndpoint {
id: ShapeId,
end: End,
},
SetEndpointLeaving {
id: ShapeId,
end: End,
leaving: Direction,
},
Hang {
id: ShapeId,
end: End,
target: ShapeId,
anchor: Anchor,
},
Forward {
id: ShapeId,
},
Backward {
id: ShapeId,
},
ToFront {
id: ShapeId,
},
ToBack {
id: ShapeId,
},
Add {
shape: Shape,
},
Remove {
id: ShapeId,
},
}Expand description
One thing a caller means to do to a diagram.
It carries the meaning and not the finished figure, and each one says which of the diagram’s
seven operations it becomes. Replace(ShapeId, Shape) would restate the diagram’s own
operation and throw away what the caller knew — a delta is what a person reading a list of
these recognizes, and what a line of a script has to be written in either way — and the
decision of which operation a meaning becomes is the work of this layer rather than of every
caller that has one.
The set is open and a command added to it is additive. A session already does whatever a command says, so one more meaning is one more arm here and nothing else. The set below is what the callers so far needed and is no promise that its size is final.
The identities are compared by value, so one issued by another diagram is a well-formed value
matching nothing here — the same answer the diagram gives everything that names a figure it
does not hold. A command that changes nothing is not a step (#285): the session records one only for
the diagram a command leaves, so one naming a figure the diagram does not hold, and one
whose change gives the figure back, leave the history where it was. See
Session and §5 of the model.
Variants§
Move
The figure goes by, along each axis.
Fields
Resize
The figure becomes so much wider and taller, or a line longer or shorter along its orientation.
Fields
RotateLine
The line’s orientation is toggled between horizontal and vertical.
SetStroke
The figure’s stroke is replaced with stroke.
SetText
The box’s text is replaced with text, or taken out when it is None.
Fields
InvertTerminals
The connector’s terminals are swapped.
MoveEndpoint
The connector’s endpoint specified by end goes by and adjusts standoff by out.
Fields
ResetEndpoint
The connector’s endpoint specified by end has its offset and standoff reset to zero.
Fields
SetEndpointTerminal
The connector’s endpoint specified by end has its terminal replaced by terminal.
Fields
DetachEndpoint
The connector’s endpoint specified by end is detached into an absolute canvas position.
Fields
SetEndpointLeaving
The connector’s detached endpoint specified by end has its departure direction set to leaving.
Fields
Hang
One end of a connector hangs from one of target’s four sides.
Fields
Forward
The figure goes one place toward the front of the order.
Backward
The figure goes one place toward the back of the order.
ToFront
The figure goes to the front of the order.
ToBack
The figure goes to the back of the order.
Add
The figure is added to the front of the drawing order.
Remove
The figure is taken out.