editorFocus.svelte#
Classes#
EditorFocus#
Defined in: arranger/src/editorFocus.svelte.ts:41
The editor focus of one canvas. Made while the canvas initialises: it follows the store from then on.
Constructors#
Constructor#
new EditorFocus(
host):EditorFocus
Defined in: arranger/src/editorFocus.svelte.ts:59
Parameters#
host#
Returns#
Methods#
focusOn()#
focusOn(
target):Promise<void>
Defined in: arranger/src/editorFocus.svelte.ts:136
Centre the edited element target in the canvas, once the page has
settled: the inspector may open with the editor, and the canvas, which
lies left of it, is measured after it has. Its width is therefore the
area left of the drawer, and no drawer width is taken off. A group whose
frame has elided ancestor cards behind it is zoomed out until they fit
on both sides of the frame’s centre (elidedReach); in the Full view
the frame alone decides and the cards may run past the edges. The flow
editor’s card is centred with its pane below it (FocusHost.below). A target
that is not drawn (a hidden element) leaves the view where it is.
Parameters#
target#
Returns#
Promise<void>
follow()#
follow(
store,next):void
Defined in: arranger/src/editorFocus.svelte.ts:105
Follow the editing path next of store: an editor opening pushes the
viewport and moves the view to the edited element; an editor
closing pops the viewport its level was entered from and moves the
view back there. A level entered while the view is still moving to the
level below returns to where that move was heading, which is where the
level below is shown. A store of its own starts with no viewports to go
back to.
Parameters#
store#
next#
readonly OpenEditor[]
Returns#
void
moved()#
moved():
void
Defined in: arranger/src/editorFocus.svelte.ts:80
The view was moved from outside the focus (the user’s pan or zoom, a
toolbar, a test): no smooth move is under way any more, and the view
stays where it was moved when the pane settles (settled).
Returns#
void
moveTo()#
moveTo(
next):void
Defined in: arranger/src/editorFocus.svelte.ts:85
Move the view to next, smoothly unless the reader prefers reduced motion.
Parameters#
next#
Viewport
Returns#
void
resized()#
resized():
void
Defined in: arranger/src/editorFocus.svelte.ts:183
The canvas has changed size (the inspector drawer opening or closing beside it, the window resized): with an editor open, its element is centred again to fill the new area, as on entering. A size the view was already focused at moves nothing, so the measurement that follows an editor’s opening (and the drawer opening with it) does not move the view a second time. The viewport an editor returns to on Done stays the one it was entered from.
Returns#
void
settled()#
settled():
void
Defined in: arranger/src/editorFocus.svelte.ts:165
The pane has settled at a new size, PANE_SETTLE after the canvas
last changed size, and every drawing is drawn again for it (an ancestor
card’s automatic proportion reads the pane): the centring done when the
canvas changed size measured the drawing of the size before. With an
editor open and the view still where it was last centred (or heading
there), the edited element is centred again on its new drawing; a view
moved since, also by the user during that move, is left where it is.
Returns#
void
Interfaces#
FocusHost#
Defined in: arranger/src/editorFocus.svelte.ts:19
What the focus reads from the canvas and does through it.
Methods#
below()#
below():
number
Defined in: arranger/src/editorFocus.svelte.ts:37
How far, in canvas units, what the innermost editor shows reaches below its element: the flow editor’s pane under its card; 0 for every other editor.
Returns#
number
metrics()#
metrics():
FontMetrics
Defined in: arranger/src/editorFocus.svelte.ts:26
Returns#
FontMetrics
nodes()#
nodes():
ReadonlyMap<string,BlockNode>
Defined in: arranger/src/editorFocus.svelte.ts:25
The projected nodes by block id.
Returns#
ReadonlyMap<string, BlockNode>
pane()#
pane():
PaneSource
Defined in: arranger/src/editorFocus.svelte.ts:30
The pane the canvas’s drawings are fitted to, read in a reaction to follow it settling.
Returns#
reducedMotion()#
reducedMotion():
boolean
Defined in: arranger/src/editorFocus.svelte.ts:31
Returns#
boolean
root()#
root():
HTMLElement|undefined
Defined in: arranger/src/editorFocus.svelte.ts:28
The canvas’s element, measured for the area an edited element is centred in.
Returns#
HTMLElement | undefined
show()#
show(
next,duration?):void
Defined in: arranger/src/editorFocus.svelte.ts:23
Show next, over duration milliseconds (at once without one).
Parameters#
next#
Viewport
duration?#
number
Returns#
void
store()#
store():
Store
Defined in: arranger/src/editorFocus.svelte.ts:20
Returns#
viewport()#
viewport():
Viewport
Defined in: arranger/src/editorFocus.svelte.ts:21
Returns#
Viewport