blockDrag#
Classes#
BlockDrag#
Defined in: arranger/src/blockDrag.ts:156
The arranger’s block drag over Svelte Flow’s: the dragged nodes snap to
the grid and to the other blocks, fixed for one gesture; the release
stores one move, or shows the projection again when nothing is stored.
Dragging a block that is not selected selects it, unless the selection
lies inside it. On an arranged canvas nothing snaps: the leading block
follows the pointer while the others are shown at their places in the
order its drop gives (arrangedDrop), and the release stores that order
as one new index of the leading block (blockIndexCommand).
Constructors#
Constructor#
new BlockDrag(
host):BlockDrag
Defined in: arranger/src/blockDrag.ts:162
Parameters#
host#
Returns#
Methods#
drag()#
drag(
__namedParameters):void
Defined in: arranger/src/blockDrag.ts:180
Parameters#
__namedParameters#
Returns#
void
start()#
start(
__namedParameters):void
Defined in: arranger/src/blockDrag.ts:166
Parameters#
__namedParameters#
Returns#
void
stop()#
stop(
__namedParameters):void
Defined in: arranger/src/blockDrag.ts:211
Parameters#
__namedParameters#
Returns#
void
Interfaces#
ArrangedDrop#
Defined in: arranger/src/blockDrag.ts:80
Where a block dragged on an arranged canvas drops: the blocks’ new order and their places in it.
Properties#
order#
readonlyorder: readonlystring[]
Defined in: arranger/src/blockDrag.ts:82
Every block’s id in the new order.
places#
readonlyplaces:ReadonlyMap<string, {x:number;y:number; }>
Defined in: arranger/src/blockDrag.ts:84
Where each block lies in that order.
DragHost#
Defined in: arranger/src/blockDrag.ts:118
What a block drag reads from the canvas and does through it.
Methods#
arranged()#
arranged():
Arranged|null
Defined in: arranger/src/blockDrag.ts:133
How the canvas’s blocks are arranged (arrangedOf); null where they lie at their places.
Returns#
Arranged | null
dispatch()#
dispatch(
command):boolean
Defined in: arranger/src/blockDrag.ts:135
Runs a command; whether the store accepted it.
Parameters#
command#
Returns#
boolean
guides()#
guides(
guides):void
Defined in: arranger/src/blockDrag.ts:131
Parameters#
guides#
readonly Guide[]
Returns#
void
metrics()#
metrics():
FontMetrics
Defined in: arranger/src/blockDrag.ts:120
Returns#
FontMetrics
pane()#
pane():
PaneSource|undefined
Defined in: arranger/src/blockDrag.ts:122
The pane the canvas’s drawings are fitted to (Pane.view).
Returns#
PaneSource | undefined
projected()#
projected(): readonly
BlockNode[]
Defined in: arranger/src/blockDrag.ts:125
The projected nodes, which a drag snaps to and falls back on.
Returns#
readonly BlockNode[]
report()#
report(
placement):void
Defined in: arranger/src/blockDrag.ts:137
The placement of the one block under drag, as shown; null once the drag ends.
Parameters#
placement#
LivePlacement | null
Returns#
void
select()#
select(
next):void
Defined in: arranger/src/blockDrag.ts:130
Parameters#
next#
Returns#
void
selection()#
selection():
Selection
Defined in: arranger/src/blockDrag.ts:129
Returns#
show()#
show(
nodes):void
Defined in: arranger/src/blockDrag.ts:128
Parameters#
nodes#
Returns#
void
shown()#
shown():
BlockNode[]
Defined in: arranger/src/blockDrag.ts:127
The nodes Svelte Flow shows, which a snap moves.
Returns#
view()#
view():
View
Defined in: arranger/src/blockDrag.ts:119
Returns#
zoom()#
zoom():
number
Defined in: arranger/src/blockDrag.ts:123
Returns#
number
NodeDrag#
Defined in: arranger/src/blockDrag.ts:141
Svelte Flow’s node drag event.
Properties#
nodes#
readonlynodes:BlockNode[]
Defined in: arranger/src/blockDrag.ts:143
targetNode#
readonlytargetNode:BlockNode|null
Defined in: arranger/src/blockDrag.ts:142
Variables#
SNAP_TOLERANCE#
constSNAP_TOLERANCE:6=6
Defined in: arranger/src/blockDrag.ts:23
How close, in screen pixels, a dragged block snaps to another block’s edge or origin.
Functions#
anchors()#
anchors(
nodes,dragged):Box[]
Defined in: arranger/src/blockDrag.ts:44
The boxes the dragged blocks dragged snap to, fixed for one gesture: every other block’s.
Parameters#
nodes#
readonly BlockNode[]
dragged#
ReadonlySet<string>
Returns#
Box[]
arrangedDrop()#
arrangedDrop(
projected,dragged,position,arranged):ArrangedDrop
Defined in: arranger/src/blockDrag.ts:96
Where the block dragged, shown at position, drops on a canvas arranged
arranged whose blocks projected shows (in index order, at their packed
places): the order orderAt gives at the middle of its node, read
against the places before the drop, and the places of every block packed
in that order (arrangedPlaces) from the top left of every block’s
stated place (packingOrigin of their nodePositions), as the canvas
packs them once the order is stored.
Parameters#
projected#
readonly BlockNode[]
dragged#
position#
x#
number
y#
number
arranged#
Returns#
nodeBox()#
nodeBox(
node,position?):Box
Defined in: arranger/src/blockDrag.ts:30
The box of node on the canvas at position (its own by default): its
node’s rectangle, and as its origin the abscissa where the first root
line drawn starts, the node’s left edge where none is drawn.
Parameters#
node#
position?#
XYPosition = node.position
Returns#
snapOffset()#
snapOffset(
lead,boxes,grid,zoom):object
Defined in: arranger/src/blockDrag.ts:53
The offset that snaps the dragged nodes, from where Svelte Flow put the
leading one lead, and the guides the snap shows; zoom turns the
tolerance into canvas units.
Parameters#
lead#
boxes#
readonly Box[]
grid#
size#
number
snap#
boolean
zoom#
number
Returns#
object
dx#
dx:
number
dy#
dy:
number
guides#
guides: readonly
Guide[]