@widgetic/canvas 0.5.43 → 0.5.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/DomCanvas.svelte +56 -3
- package/dist/canvas/DomCanvas.svelte.d.ts +59 -28
- package/dist/canvas/autosaveScheduler.js +89 -37
- package/dist/canvas/boardFrame.js +1 -1
- package/dist/canvas/boardSurface.js +1 -1
- package/dist/canvas/canvasLogger.js +19 -7
- package/dist/canvas/chromeLayout.js +21 -19
- package/dist/canvas/eventScope.js +14 -10
- package/dist/canvas/host/CanvasHost.d.ts +87 -2
- package/dist/canvas/host/CanvasHost.js +1948 -1394
- package/dist/canvas/host/CanvasHostApi.d.ts +2 -2
- package/dist/canvas/host/CanvasHostApi.js +32 -5
- package/dist/canvas/host/boardFiles.d.ts +90 -0
- package/dist/canvas/host/boardFiles.js +155 -0
- package/dist/canvas/host/browserServices.d.ts +17 -0
- package/dist/canvas/host/browserServices.js +211 -65
- package/dist/canvas/host/conversion.js +170 -82
- package/dist/canvas/host/hostObject.js +7 -7
- package/dist/canvas/host/nearCards.js +21 -18
- package/dist/canvas/host/pageEvents.js +5 -5
- package/dist/canvas/host/pictureSaves.js +11 -9
- package/dist/canvas/host/screenRects.js +31 -28
- package/dist/canvas/host/storedPictures.js +243 -149
- package/dist/canvas/host/strokeSnap.js +143 -88
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/openMarks.js +2 -2
- package/dist/canvas/outsideClickDeselect.js +7 -6
- package/dist/canvas/panZoomPosition.js +2 -2
- package/dist/canvas/preferredTextFont.js +25 -13
- package/dist/canvas/shapes/ShapeLibrary.js +148 -138
- package/dist/canvas/shapes/shapeImageStore.js +4 -4
- package/dist/canvas/shapes/strokeShapeSnap.js +233 -188
- package/dist/canvas/toolbarPosition.js +2 -2
- package/dist/canvas/types.d.ts +17 -0
- package/dist/canvas/ui/CanvasContextMenu.svelte +7 -0
- package/dist/canvas/ui/CanvasToolbar.svelte +4 -1
- package/dist/canvas/ui/CanvasToolbar.svelte.d.ts +2 -0
- package/dist/canvas/ui/ColorField.svelte +7 -2
- package/dist/canvas/ui/SelectionPanel.svelte +105 -42
- package/dist/canvas/ui/ShapesMenu.svelte +65 -31
- package/dist/canvas/ui/ShapesMenu.svelte.d.ts +2 -0
- package/dist/canvas/ui/ShortcutTooltip.svelte +64 -0
- package/dist/canvas/ui/ShortcutTooltip.svelte.d.ts +24 -0
- package/dist/canvas/ui/ToolButton.svelte +35 -54
- package/dist/canvas/ui/ToolButton.svelte.d.ts +4 -1
- package/dist/canvas/ui/colorModel.js +32 -21
- package/dist/canvas/ui/colorPickerMessages.js +5 -5
- package/dist/canvas/ui/floatingCard.d.ts +26 -4
- package/dist/canvas/ui/floatingCard.js +43 -21
- package/dist/canvas/ui/floatingLayer.js +6 -5
- package/dist/canvas/ui/icons.d.ts +1 -1
- package/dist/canvas/ui/icons.js +1 -1
- package/dist/canvas/ui/keyHints.js +11 -9
- package/dist/canvas/ui/popoverSide.js +3 -2
- package/dist/canvas/ui/selectionTraits.d.ts +12 -0
- package/dist/canvas/ui/selectionTraits.js +66 -35
- package/dist/canvas/ui/sizeLabelVisibility.d.ts +4 -2
- package/dist/canvas/ui/sizeLabelVisibility.js +5 -5
- package/dist/canvas/view/CanvasStage.svelte +7 -2
- package/dist/canvas/view/CanvasStage.svelte.d.ts +2 -0
- package/dist/canvas/view/SelectionOverlay.svelte +17 -10
- package/dist/canvas/view/WidgetChromeLayer.svelte +15 -3
- package/dist/canvas/view/erasingMarks.js +7 -7
- package/dist/canvas/view/geometry.d.ts +1 -1
- package/dist/canvas/view/geometry.js +90 -71
- package/dist/canvas/view/liftedScene.js +36 -24
- package/dist/canvas/view/mountedScene.js +79 -76
- package/dist/components/CanvasBoardPoster.svelte +206 -0
- package/dist/components/CanvasBoardPoster.svelte.d.ts +17 -0
- package/dist/components/CanvasToolbarPlaceholder.svelte +115 -0
- package/dist/components/CanvasToolbarPlaceholder.svelte.d.ts +9 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +8 -0
- package/dist/components/preferenceStorage.js +2 -2
- package/dist/engine/EngineCore.d.ts +111 -2
- package/dist/engine/EngineCore.js +1013 -707
- package/dist/engine/codec/canvasDocument.d.ts +7 -0
- package/dist/engine/codec/canvasDocument.js +172 -186
- package/dist/engine/codec/hostReadableKeys.js +1 -1
- package/dist/engine/core/arrange.js +38 -26
- package/dist/engine/core/arrow.d.ts +18 -8
- package/dist/engine/core/arrow.js +109 -84
- package/dist/engine/core/arrowBinding.d.ts +1 -1
- package/dist/engine/core/arrowBinding.js +126 -101
- package/dist/engine/core/arrowBindingRecords.d.ts +9 -3
- package/dist/engine/core/arrowBindingRecords.js +48 -29
- package/dist/engine/core/brush.d.ts +8 -0
- package/dist/engine/core/brush.js +98 -78
- package/dist/engine/core/cameraMove.d.ts +73 -0
- package/dist/engine/core/cameraMove.js +172 -0
- package/dist/engine/core/defaults.js +51 -90
- package/dist/engine/core/freehand.js +163 -147
- package/dist/engine/core/geometry.js +54 -47
- package/dist/engine/core/history.js +55 -38
- package/dist/engine/core/hitTest.js +81 -68
- package/dist/engine/core/matrix.js +20 -18
- package/dist/engine/core/pathData.js +210 -183
- package/dist/engine/core/rotationReset.js +6 -5
- package/dist/engine/core/scene.d.ts +22 -0
- package/dist/engine/core/scene.js +288 -139
- package/dist/engine/core/scribble.js +84 -59
- package/dist/engine/core/shapePaths.js +15 -12
- package/dist/engine/core/shapeTools.js +63 -72
- package/dist/engine/core/snapping.js +117 -65
- package/dist/engine/core/style.d.ts +10 -0
- package/dist/engine/core/style.js +82 -33
- package/dist/engine/core/transform.d.ts +6 -0
- package/dist/engine/core/transform.js +103 -83
- package/dist/engine/core/types.d.ts +7 -0
- package/dist/engine/core/types.js +4 -4
- package/dist/engine/core/viewport.js +36 -23
- package/dist/engine/input/PointerController.d.ts +15 -1
- package/dist/engine/input/PointerController.js +549 -466
- package/dist/engine/input/arrowHandles.js +12 -12
- package/dist/engine/input/gestures.d.ts +3 -1
- package/dist/engine/input/gestures.js +340 -266
- package/dist/engine/input/hoverCursor.js +1 -1
- package/dist/engine/input/keyboard.d.ts +22 -3
- package/dist/engine/input/keyboard.js +131 -32
- package/dist/engine/input/selectionHandles.js +50 -45
- package/dist/engine/input/types.d.ts +7 -0
- package/dist/engine/input/types.js +1 -1
- package/dist/engine/render/rasterize.js +158 -86
- package/dist/engine/state.d.ts +18 -0
- package/dist/engine/state.js +25 -4
- package/dist/engine/text/layoutText.js +62 -43
- package/dist/engine/text/textMetrics.js +10 -8
- package/dist/engine/widgets.js +137 -101
- package/dist/fonts/interFont.js +83 -30
- package/dist/fonts/workspaceFonts.d.ts +6 -0
- package/dist/fonts/workspaceFonts.js +108 -34
- package/dist/i18n/labels.js +4 -4
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/language.js +4 -4
- package/dist/i18n/messages.d.ts +6 -0
- package/dist/i18n/messages.js +7 -1
- package/dist/i18n/shortcuts.d.ts +6 -4
- package/dist/i18n/shortcuts.js +30 -26
- package/dist/index.d.ts +2 -1
- package/dist/poster/boardPlacement.d.ts +80 -0
- package/dist/poster/boardPlacement.js +140 -0
- package/dist/poster/boardPoster.d.ts +80 -0
- package/dist/poster/boardPoster.js +251 -0
- package/dist/poster/paintBoardPoster.d.ts +49 -0
- package/dist/poster/paintBoardPoster.js +112 -0
- package/dist/poster/posterPictures.d.ts +32 -0
- package/dist/poster/posterPictures.js +138 -0
- package/dist/settings/workspaceToolSettings.d.ts +6 -0
- package/dist/settings/workspaceToolSettings.js +58 -34
- package/dist/tools/components/catalog.js +74 -64
- package/dist/tools/components/grouping.js +28 -6
- package/dist/tools/definitions.js +31 -9
- package/dist/tools/executors.js +214 -106
- package/dist/tools/hostAdapter.d.ts +5 -1
- package/dist/tools/hostAdapter.js +15 -11
- package/dist/tools/sceneSummary.js +57 -43
- package/dist/tools/sketchIntent.js +21 -13
- package/dist/tools/styleArguments.d.ts +35 -0
- package/dist/tools/styleArguments.js +93 -0
- package/dist/tools/types.d.ts +26 -1
- package/dist/tools/types.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** Where the toolbar stands: one of the eight places of `toolbarPosition` (anything else is the bottom centre, as in the canvas). */
|
|
3
|
+
toolbarPosition?: string | null;
|
|
4
|
+
/** The same option the canvas has: false draws nothing, as the canvas draws no toolbar then. */
|
|
5
|
+
showDrawingTools?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const CanvasToolbarPlaceholder: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CanvasToolbarPlaceholder = ReturnType<typeof CanvasToolbarPlaceholder>;
|
|
9
|
+
export default CanvasToolbarPlaceholder;
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
7
7
|
export { default as CanvasBoardPlaceholder, CANVAS_BOARD_BACKGROUND } from './CanvasBoardPlaceholder.svelte';
|
|
8
|
+
export { default as CanvasToolbarPlaceholder } from './CanvasToolbarPlaceholder.svelte';
|
|
9
|
+
export { default as CanvasBoardPoster } from './CanvasBoardPoster.svelte';
|
|
10
|
+
export { createBoardPoster, parseBoardPoster, boardPostersMatch, BOARD_POSTER_VERSION, BOARD_POSTER_STORAGE_KIND, DEFAULT_POSTER_SURFACE } from '../poster/boardPoster.js';
|
|
11
|
+
export type { BoardPoster, BoardPosterOptions, ParsedBoardPoster } from '../poster/boardPoster.js';
|
|
12
|
+
export type { PosterPictureResolver } from '../poster/posterPictures.js';
|
|
13
|
+
export { BOARD_PLACEMENT_STORAGE_KEY, boardLayoutOf, measureBoardPlacement, rememberBoardPlacement, recallBoardPlacement } from '../poster/boardPlacement.js';
|
|
14
|
+
export type { BoardPlacement, BoardPlacementDetails, BoardLayoutClass } from '../poster/boardPlacement.js';
|
|
8
15
|
export { setCanvasPreferenceStorage, getCanvasPreferenceStorage } from './preferenceStorage';
|
|
9
16
|
export type { CanvasPreferenceStorage } from './preferenceStorage';
|
|
10
17
|
export { default as ColorIC } from './input-controls/ColorIC.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
8
8
|
// The empty board: shown while the canvas code downloads
|
|
9
9
|
export { default as CanvasBoardPlaceholder, CANVAS_BOARD_BACKGROUND } from './CanvasBoardPlaceholder.svelte';
|
|
10
|
+
// The drawing toolbar as it stands before the canvas is there: a host draws it next to the empty board so the bar is there at first paint
|
|
11
|
+
export { default as CanvasToolbarPlaceholder } from './CanvasToolbarPlaceholder.svelte';
|
|
12
|
+
// The poster of the board: the objects of the saved view, drawn from the first frame while the canvas code is on its way.
|
|
13
|
+
// A host keeps one with `createBoardPoster` at every save, reads it back with `parseBoardPoster`, and draws it with <CanvasBoardPoster>.
|
|
14
|
+
export { default as CanvasBoardPoster } from './CanvasBoardPoster.svelte';
|
|
15
|
+
export { createBoardPoster, parseBoardPoster, boardPostersMatch, BOARD_POSTER_VERSION, BOARD_POSTER_STORAGE_KIND, DEFAULT_POSTER_SURFACE } from '../poster/boardPoster.js';
|
|
16
|
+
// Where the board stands in its host's page, remembered so the next visit draws the poster and the toolbar in place at first paint
|
|
17
|
+
export { BOARD_PLACEMENT_STORAGE_KEY, boardLayoutOf, measureBoardPlacement, rememberBoardPlacement, recallBoardPlacement } from '../poster/boardPlacement.js';
|
|
10
18
|
// Where the canvas keeps a visitor's choices (the host can install a store of its own)
|
|
11
19
|
export { setCanvasPreferenceStorage, getCanvasPreferenceStorage } from './preferenceStorage';
|
|
12
20
|
// Input Controllers
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* is written into the page's storage and a browser that several visitors share does not pass one visitor's choices on
|
|
7
7
|
* to the next. The host does this once, before the canvas is shown.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
var installedStorage = null;
|
|
10
10
|
/** Installs the store the canvas keeps the visitor's choices in; `null` goes back to the browser's `localStorage`. */
|
|
11
11
|
export function setCanvasPreferenceStorage(storage) {
|
|
12
12
|
installedStorage = storage;
|
|
@@ -18,7 +18,7 @@ export function getCanvasPreferenceStorage() {
|
|
|
18
18
|
try {
|
|
19
19
|
return typeof localStorage === 'undefined' ? null : localStorage;
|
|
20
20
|
}
|
|
21
|
-
catch {
|
|
21
|
+
catch (_a) {
|
|
22
22
|
// Reading `localStorage` itself throws where the browser blocks storage for the page.
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* end, so one gesture is one undo step. The pointer controller drives them; everything else (the menus, the
|
|
11
11
|
* keyboard, the host's own calls) uses the commands below, each of which is one step.
|
|
12
12
|
*/
|
|
13
|
+
import type { CameraPathShape } from './core/cameraMove.js';
|
|
13
14
|
import type { ParsedCanvas, SerializeOptions } from './codec/canvasDocument.js';
|
|
14
15
|
import type { AlignMode, DistributeAxis } from './core/arrange.js';
|
|
15
16
|
import type { ArrowHandleId } from './core/arrow.js';
|
|
@@ -17,7 +18,7 @@ import type { ReorderMode, Scene } from './core/scene.js';
|
|
|
17
18
|
import type { StylePatch } from './core/style.js';
|
|
18
19
|
import type { SelectionFrame } from './core/transform.js';
|
|
19
20
|
import type { ObjectId, Point, Rect, RectObject, SceneObject, ShapeObject, Size, TextObject, Viewport, WidgetObject } from './core/types.js';
|
|
20
|
-
import type { EngineOverlay, EngineState, PendingWidgetState, ToolId, WidgetRuntime } from './state.js';
|
|
21
|
+
import type { EngineOverlay, EngineState, PendingWidgetState, PenStyle, ToolId, WidgetRuntime } from './state.js';
|
|
21
22
|
import type { MeasureText } from './text/layoutText.js';
|
|
22
23
|
/** How many undo steps the board keeps (as the canvas it replaces did). */
|
|
23
24
|
export declare const HISTORY_LIMIT = 50;
|
|
@@ -40,6 +41,60 @@ export interface EngineServices {
|
|
|
40
41
|
random?: () => number;
|
|
41
42
|
/** Schedules an animation frame; returns a function that cancels it (tests pass a manual clock). */
|
|
42
43
|
requestAnimationFrame?: (callback: (time: number) => void) => () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the person asked their system for less motion (the browser's `prefers-reduced-motion` in the app, `false` in
|
|
46
|
+
* tests unless a test says otherwise). A move of the view (`flyTo` and the other `flyTo…` calls) then puts the view
|
|
47
|
+
* in its place at once instead of easing it there.
|
|
48
|
+
*/
|
|
49
|
+
prefersReducedMotion?: () => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Says something worth following about what the person did (once per action, never per frame): the canvas passes its console
|
|
52
|
+
* logger. The engine says nothing when no function is given, as in the tests.
|
|
53
|
+
*/
|
|
54
|
+
log?: (message: string, details?: Record<string, unknown>) => void;
|
|
55
|
+
}
|
|
56
|
+
/** A place to look at: the point of the world that goes to the middle of the board element, and the zoom to arrive at. */
|
|
57
|
+
export interface ViewTarget {
|
|
58
|
+
center: Point;
|
|
59
|
+
/** The zoom to arrive at (1 is 100%). Left out: the zoom stays what it is. */
|
|
60
|
+
zoom?: number;
|
|
61
|
+
}
|
|
62
|
+
/** How a move of the view goes (`flyTo` and the other `flyTo…` calls). */
|
|
63
|
+
export interface ViewMoveOptions {
|
|
64
|
+
/** How long the move takes, in milliseconds. Left out: worked out from how far the view goes, and always under a second. */
|
|
65
|
+
duration?: number;
|
|
66
|
+
/**
|
|
67
|
+
* How much of the worked-out time the move takes: 0.5 is twice as quick, 2 is twice as slow. Only used when `duration` is left
|
|
68
|
+
* out (a duration that is given is the time of the move, exactly). A value that is not above 0 is taken for 1.
|
|
69
|
+
*/
|
|
70
|
+
durationScale?: number;
|
|
71
|
+
/**
|
|
72
|
+
* The shape of the move: how much of the way is done (0 to 1) when this much of the time has passed (0 to 1), for the
|
|
73
|
+
* position and the zoom together. Left out: slow start, quick middle, slow end.
|
|
74
|
+
*/
|
|
75
|
+
easing?: (progress: number) => number;
|
|
76
|
+
/**
|
|
77
|
+
* The way the view travels. `'ease'` (the default): the position and the zoom ease together, on the one `easing`, and arrive at
|
|
78
|
+
* the same moment; the zoom never goes beyond its two ends. `'fly'`: the path of van Wijk and Nuij, which for a long way zooms out
|
|
79
|
+
* on the way and in again at the end so the person keeps sight of where the view goes (it suits a jump across a big board); the
|
|
80
|
+
* zoom then changes at another rate than the position. Any other value is taken for `'ease'`. The time of the move does not depend
|
|
81
|
+
* on it.
|
|
82
|
+
*/
|
|
83
|
+
path?: CameraPathShape;
|
|
84
|
+
/**
|
|
85
|
+
* Called once when the move is over, with `true` when the view arrived at the place and `false` when somebody else took the
|
|
86
|
+
* view first (the person pressed on the board, scrolled or pinched it; another move or a new board started). Also called, with
|
|
87
|
+
* `true`, when there was nothing to move because the view was there already.
|
|
88
|
+
*/
|
|
89
|
+
onEnd?: (arrived: boolean) => void;
|
|
90
|
+
}
|
|
91
|
+
/** A move of the view to some objects. */
|
|
92
|
+
export interface ViewObjectsMoveOptions extends ViewMoveOptions {
|
|
93
|
+
/**
|
|
94
|
+
* The zoom to arrive at: a number (1 is 100%), `'fit'` (the objects fill the board with room around them, never past 200%,
|
|
95
|
+
* as "zoom to selection" does) or `'keep'` (the zoom the board has). Left out: `'fit'`.
|
|
96
|
+
*/
|
|
97
|
+
zoom?: number | 'fit' | 'keep';
|
|
43
98
|
}
|
|
44
99
|
/** What the engine tells the host shell. Every hook is optional and read at the moment it is needed. */
|
|
45
100
|
export interface EngineHooks {
|
|
@@ -58,6 +113,8 @@ export interface EngineHooks {
|
|
|
58
113
|
onSelectionChange?: (selectedIds: readonly ObjectId[]) => void;
|
|
59
114
|
/** Widget cards are about to be deleted: one question per widget, and one `false` cancels the whole delete. */
|
|
60
115
|
confirmWidgetDeletion?: ((widgetId: string) => Promise<boolean> | boolean) | null;
|
|
116
|
+
/** Whether widget cards may be duplicated/pasted on the board. Defaults to true. */
|
|
117
|
+
canDuplicateWidget?: () => boolean;
|
|
61
118
|
/** A widget card was duplicated or pasted: the host makes a copy of the widget and links it with `linkObjectToWidget`. */
|
|
62
119
|
onWidgetDuplicated?: ((sourceWidgetId: string, clone: WidgetObject) => void) | null;
|
|
63
120
|
/** Something went wrong in a hook the host supplied. */
|
|
@@ -206,6 +263,7 @@ export declare class EngineCore {
|
|
|
206
263
|
force?: boolean;
|
|
207
264
|
}): void;
|
|
208
265
|
setStickyTool(sticky: boolean): void;
|
|
266
|
+
/** Puts the view where it is asked at once. A move of the view that was on its way (see `flyTo`) is over: the view is the person's. */
|
|
209
267
|
setViewport(viewport: Viewport): void;
|
|
210
268
|
panBy(deltaX: number, deltaY: number): void;
|
|
211
269
|
/** Zooms and keeps the world point under `screenPoint` where it is. */
|
|
@@ -220,6 +278,34 @@ export declare class EngineCore {
|
|
|
220
278
|
zoomToFit(): void;
|
|
221
279
|
/** Shows the selection, or everything when nothing is selected. */
|
|
222
280
|
zoomToSelection(): void;
|
|
281
|
+
/** Whether the view is on its way to a place (a move started by `flyTo` or one of the other `flyTo…` calls has not ended). */
|
|
282
|
+
get isViewMoving(): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Eases the view to a place: the point that ends in the middle of the board and the zoom change together, on one progress,
|
|
285
|
+
* so the move is a single motion and not a pan followed by a zoom, and both arrive at the same moment. With `options.path` set
|
|
286
|
+
* to `'fly'` a long way zooms out on the way and in again at the end instead (see `core/cameraMove.ts`). The view ends exactly
|
|
287
|
+
* on the place, and the size of the board is read at every frame, so a board that is resized on the way still ends with the
|
|
288
|
+
* place in its middle.
|
|
289
|
+
*
|
|
290
|
+
* Any other change of the view ends the move where the view is: a press on the board, a scroll, a pinch, `setViewport` or a new
|
|
291
|
+
* board, so the person is never fought for the view. With "reduce motion" on in the system, the view goes there at once.
|
|
292
|
+
*
|
|
293
|
+
* Returns whether the view moved (or jumped); false when it is there already or the place is not a place.
|
|
294
|
+
*/
|
|
295
|
+
flyTo(target: ViewTarget, options?: ViewMoveOptions): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Eases the view to some objects (groups count as one, as in a selection): the middle of the objects goes to the middle of the
|
|
298
|
+
* board while the zoom changes to what `options.zoom` asks (the objects fill the board unless it says otherwise).
|
|
299
|
+
* False when none of the ids is an object of the board.
|
|
300
|
+
*/
|
|
301
|
+
flyToObjects(ids: readonly ObjectId[], options?: ViewObjectsMoveOptions): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Eases the view back to 100% with the middle of everything that is drawn in the middle of the board (a double click on the
|
|
304
|
+
* empty board does this). An empty board goes back to where a new board starts.
|
|
305
|
+
*/
|
|
306
|
+
flyToContent(options?: ViewMoveOptions): boolean;
|
|
307
|
+
/** Ends a move of the view where it is (the view keeps the place it had reached) and tells its `onEnd` that it did not arrive. */
|
|
308
|
+
cancelViewportMove(): void;
|
|
223
309
|
/** The rectangle of the world that is on screen. */
|
|
224
310
|
visibleRect(): Rect;
|
|
225
311
|
/** The point of the world at a point of the board element. */
|
|
@@ -234,13 +320,26 @@ export declare class EngineCore {
|
|
|
234
320
|
text?: Partial<Pick<TextObject, 'fontFamily' | 'fontSize' | 'fontWeight' | 'fontStyle' | 'color' | 'align' | 'underline'>> | null;
|
|
235
321
|
paint?: Partial<Pick<RectObject, 'fill' | 'stroke' | 'strokeWidth' | 'strokeStyle' | 'opacity' | 'roundness'>> | null;
|
|
236
322
|
}): void;
|
|
323
|
+
/**
|
|
324
|
+
* Changes how the Draw tool draws: the lines drawn from now on take the colour, the width and the opacity that are asked for. A key
|
|
325
|
+
* that is left out stays as it was; a value that cannot be a line's (a width under 1 or above 200, an opacity out of range, a
|
|
326
|
+
* colour that is not a word, a number that is not a number) is brought to what a line can be, or ignored when it is not a value
|
|
327
|
+
* at all. Nothing on the board changes (that is `setStyle`, for the selection), and nothing is added to the history. Returns
|
|
328
|
+
* whether the pen came out different.
|
|
329
|
+
*/
|
|
330
|
+
setPenStyle(patch: Partial<PenStyle>): boolean;
|
|
237
331
|
workspacePaintForNewShape(wireframe: boolean): Partial<RectObject>;
|
|
238
332
|
/**
|
|
239
333
|
* Makes a text object, puts it on the board and starts editing it. A click makes a label whose width follows its
|
|
240
334
|
* text; a width makes a box whose lines wrap. Nothing is recorded until the editing ends with text in it.
|
|
335
|
+
*
|
|
336
|
+
* `placeholder: true` is the text the Text tool puts on the board the moment it is chosen: its box (as wide as the placeholder
|
|
337
|
+
* prompt) is centred on `point` instead of starting there, and a press elsewhere on the board while it is still empty keeps the
|
|
338
|
+
* tool, so that press (or drag) places the text there (see `endTextEdit`).
|
|
241
339
|
*/
|
|
242
340
|
createText(point: Point, options?: {
|
|
243
341
|
width?: number;
|
|
342
|
+
placeholder?: boolean;
|
|
244
343
|
}): ObjectId;
|
|
245
344
|
/** Starts editing the text of an existing text object. */
|
|
246
345
|
beginTextEdit(id: ObjectId): boolean;
|
|
@@ -249,8 +348,14 @@ export declare class EngineCore {
|
|
|
249
348
|
/**
|
|
250
349
|
* Finishes the edit. An empty text is removed (a new one leaves nothing behind, not even an undo step);
|
|
251
350
|
* otherwise creation and typing together are one undo step.
|
|
351
|
+
*
|
|
352
|
+
* `keepPlaceholderTool` is for a press on the board that ends the edit: when what ends is the empty placeholder the Text tool
|
|
353
|
+
* put on the board (see `createText`), the tool is not left, so the press goes on to be a press of the Text tool and puts the
|
|
354
|
+
* text where the person pressed. Any other end of the edit leaves the Text tool, as before.
|
|
252
355
|
*/
|
|
253
|
-
endTextEdit(
|
|
356
|
+
endTextEdit(options?: {
|
|
357
|
+
keepPlaceholderTool?: boolean;
|
|
358
|
+
}): ObjectId | null;
|
|
254
359
|
/** Changes how the selection looks. `commit: false` is for a slider that is still being dragged: call `commit()` when it ends. */
|
|
255
360
|
setStyle(patch: StylePatch, options?: {
|
|
256
361
|
commit?: boolean;
|
|
@@ -269,6 +374,10 @@ export declare class EngineCore {
|
|
|
269
374
|
nudgeSelection(deltaX: number, deltaY: number): boolean;
|
|
270
375
|
alignSelection(mode: AlignMode): boolean;
|
|
271
376
|
distributeSelection(axis: DistributeAxis): boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Puts the selection in front of or behind the others (`front` and `back` all the way, `forward` and `backward` one step).
|
|
379
|
+
* Shapes that arrows tie together are one diagram: what is joined to the selection by arrows, at any distance, goes with it.
|
|
380
|
+
*/
|
|
272
381
|
reorderSelection(mode: ReorderMode): boolean;
|
|
273
382
|
/** Puts the selected units in a group, which becomes the selection. */
|
|
274
383
|
groupSelection(): boolean;
|