items#
Classes#
Stretch#
Defined in: arranger/src/items.ts:353
A stretch of one frame or card of a block on one axis, as a function of
the factor’s value (length along time, spacing or margin
vertically), built from one drawing of the block before the stretch and
memoized per value, so a search and the changes it settles on draw each
value once.
At a value, the factor is stated on its key (a held card stretches its
group’s length and its own spacing or margin, resizingOf), and every stated
size of the boxes stretched follows its own content by kept, keeping its
proportion to it: along time the widths of the item and of the cards its
frame holds, so the members’ lines keep one length and every margin
stretches with them; vertically the heights of a frame and its cards, or
of a held card and its frame; the cards first, since the item’s content
holds them. Where the level pins the frame’s width
(frameWidthPinned), a stretch along time keeps the frame at its drawn
width while the content, the cards’ widths following, fits in it (its
width stated at that width), and lets the frame follow the content once
the content is wider (its width unstated), so a stretch shrinks the
members inside the frame and grows the frame with them. Sizes are in item
coordinates.
Constructors#
Constructor#
new Stretch(
view,block,box,level,factor,metrics,pane?):Stretch
Defined in: arranger/src/items.ts:376
Parameters#
view#
block#
string
box#
level#
factor#
Factor
metrics#
FontMetrics
pane?#
Returns#
Properties#
pinned#
readonlypinned:number|null
Defined in: arranger/src/items.ts:357
The frame’s width kept along time while the content fits in it; null where it adapts.
start#
readonlystart:number
Defined in: arranger/src/items.ts:355
The factor’s value before the stretch.
Methods#
changes()#
changes(
value):PlaceChanges
Defined in: arranger/src/items.ts:446
The places a Stretch to value writes.
Parameters#
value#
number
Returns#
content()#
content(
value):number
Defined in: arranger/src/items.ts:436
The holding item’s content on the axis at value, its own stated size left out.
Parameters#
value#
number
Returns#
number
drawn()#
drawn(
value):number
Defined in: arranger/src/items.ts:441
The stretched box’s drawn size on the axis at value.
Parameters#
value#
number
Returns#
number
Interfaces#
PlacedValues#
Defined in: arranger/src/items.ts:64
The values a gesture sets on the place under key.
Properties#
key#
readonlykey:PlaceKey
Defined in: arranger/src/items.ts:65
values#
readonlyvalues:PlaceValues
Defined in: arranger/src/items.ts:66
Type Aliases#
PlaceChanges#
PlaceChanges =
ReadonlyMap<string,PlacedValues>
Defined in: arranger/src/items.ts:70
The places a gesture sets, each with its values, in order, by placeKeyText.
PlaceValues#
PlaceValues = { -readonly [member in keyof ItemPlace]?: number | null }
Defined in: arranger/src/items.ts:61
Members of a place to set: a number states the member, null unstates it.
ShownValues#
ShownValues =
{ readonly [property in PlaceProperty]?: number }
Defined in: arranger/src/items.ts:672
The value of each place member a frame or a card shows.
Functions#
itemHandlesFor()#
itemHandlesFor(
mode,box,level): readonlyHandle[]
Defined in: arranger/src/items.ts:131
The handles box, a frame or a card, offers in mode at level. A frame
or a block-held card offers a block’s: the corners to scale, all eight to
size or stretch its box; where the level pins the frame’s width
(frameWidthPinned), its stretch leaves out the left edge and the left
corners. A held card never moves its top left corner, which its frame
decides: it scales from its bottom right corner, and sizes and stretches
its box from its right and bottom edges.
Parameters#
mode#
box#
level#
Returns#
readonly Handle[]
itemMoveCommand()#
itemMoveCommand(
view,block,key,x,y,metrics,together?,pane?):SetCommand|null
Defined in: arranger/src/items.ts:263
The set that moves the item key of block block to the place
position x, y (in the drawing’s units, measured from the place origin,
quantized to GRID_FREE) and every item of together by the same travel,
so that each keeps its offset to key, stating the drawn position of
every other item that states none (the bundle editor’s rule,
placeCommand). null when the item would stay where it is drawn.
Parameters#
view#
block#
string
key#
x#
number
y#
number
metrics#
FontMetrics
together?#
readonly PlaceKey[] = []
pane?#
Returns#
SetCommand | null
itemResizeCommand()#
itemResizeCommand(
view,block,places,level,metrics,pane?):SetCommand|null
Defined in: arranger/src/items.ts:292
The set storing a resize’s places (itemResizeValues), made at
level, stating the drawn position of every other item that states none
where the level’s items lie freely (itemsFree, placeCommand). null
when every value is the one its place states already.
Parameters#
view#
block#
string
places#
level#
metrics#
FontMetrics
pane?#
Returns#
SetCommand | null
itemResizeValues()#
itemResizeValues(
view,block,box,level,mode,handle,delta,metrics,pane?):PlaceChanges
Defined in: arranger/src/items.ts:535
The places that resize box, a frame or a card of block block, by
dragging handle by delta (canvas units, as for a block) at level:
each key of places with its values, in order. Every position is in the
drawing’s units, measured from the place origin; every size in the item’s
own coordinates, before its scale, so the pointer’s travel is divided by
the block’s scale and the item’s; every number is quantized to
GRID_FREE. The dragged edge or corner ends under the pointer and the
opposite one stays exactly where it is drawn: for a left or top handle the
stated x or y is the opposite edge less the achieved drawn size.
scale(corners only) sets the item’sscaleto its scale times the larger of the two axis ratios of the dragged corner’s distance from the fixed corner after and before the drag, floored atMIN_SCALE; scale 1, the default, unstates it. On a held card the fixed corner is its frame’s top left and the dragged corner the card’s bottom right, and the scale is the group’s.boxsetswidthandheight; a request at or below the box’s own content storesnull. On a held card they are the card’s own.stretchsetslengthfrom a left or right handle and, from a top or bottom one,spacing, ormarginfor a container with exactly one content (verticalStretchOf), both from a corner: the largest value whose box does not pass the pointer, floored atMIN_LENGTHand at 0, the places being what aStretchto it writes. Vertically a frame’sspacingis the gap between its cards and a box-held card’s the gap between its rows and bands, a margin the empty space above its one content and below it, and a value the search leaves where it was drawn is not stated; a held card stretches its group along time, the card’s own box following the pointer, and only its own card’sspacingormarginvertically. Where the frame keeps its width (Stretch), a stretch along time makes the frame’s content follow the pointer, whichever box is dragged; vertically the frame adapts.
Parameters#
view#
block#
string
box#
level#
mode#
handle#
delta#
metrics#
FontMetrics
pane?#
Returns#
itemsMovedWith()#
itemsMovedWith(
manifest,drawing,selected,key):PlaceKey[] |null
Defined in: arranger/src/items.ts:225
The other items of drawing, the drawing of manifest, that a drag of
the item key moves with it: every other item in the selection
selected (the block’s selected element addresses, by their keys), in
the drawing’s order and possibly none, when key is in it; null when it
is not. A selected frame puts in the selection only itself, a selected
card every item drawing it (the card itself, a held card’s frame, each
frame of a member of several groups); any other selected address puts
there every item containing it by core’s contains, its key naming the
group or the ungrouped root, wherever the address is drawn.
Parameters#
manifest#
drawing#
selected#
ReadonlyMap<string, ElementAddress>
key#
Returns#
PlaceKey[] | null
placeChanges()#
placeChanges(
entries):Map<string,PlacedValues>
Defined in: arranger/src/items.ts:73
The place changes entries gives, each place once, its values merged in order.
Parameters#
entries#
Iterable<readonly [PlaceKey, PlaceValues]>
Returns#
Map<string, PlacedValues>
placeCommand()#
placeCommand(
block,drawing,places,others):SetCommand
Defined in: arranger/src/items.ts:186
One set of places, the values of each key’s place in their order, and
with others, the drawn x and y of every other item of drawing that
does not state them, each stated once, so that no other item moves when the
defaults would place it anew (an item below another follows its bottom
edge unless it states its y). The frame holding an edited held card is
no other item: a card’s size never moves its frame’s top left corner.
Parameters#
block#
drawing#
places#
others#
boolean
Returns#
placeEdit()#
placeEdit(
view,selection,property,value,editing,metrics,pane?):SetCommand|Problem|null
Defined in: arranger/src/items.ts:731
The one set the inspector dispatches for a typed or stepped property:
property of every block, frame or card the selection names (core’s
resolver, resolveSelection where editing, the innermost open editor,
works: a part of a group or of a timeline drawn in a card names that
frame or card; bands are left out) given value, or
value(current), current being the element’s shown value (stated, else
drawn). A block sets its own member; a frame or a card a member of the
place its resizing writes (resizingOf: a held card’s scale and length
are its group’s), each place once, with the first element’s value. A
length, spacing or margin writes what a Stretch to it writes (Stretch),
each element’s stretch starting from what the ones before it wrote; and
where the level’s items lie freely (itemsFree), the same set states
the drawn position of every other item that states none
(placeCommand). null when every element stores that value already.
Refused (CommandError): a selection naming no block, frame or card
(unknown_target when nothing resolves, wrong_target_kind for an
element with no geometry of its own, elements in several blocks, or
blocks mixed with frames or cards), a position of a held card
(unknown_property), and a value that is not finite or, except a
width or height, empty (invalid_value).
Parameters#
view#
selection#
property#
"length" | "width" | "height" | "x" | "y" | "scale" | "spacing" | "margin"
value#
number | ((current) => number | null) | null
editing#
Editing | null
metrics#
FontMetrics
pane?#
Returns#
SetCommand | Problem | null
shownValues()#
shownValues(
drawing,box):ShownValues
Defined in: arranger/src/items.ts:680
What box of drawing shows for each of its place members: stated, else
drawn. An item shows every member of its place; a card a frame holds its
own spacing, margin and size, and the scale and length of its frame,
which its group’s members share.