@tsdraw/core 0.6.2 → 0.8.0
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/index.cjs +338 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -2
- package/dist/index.d.ts +87 -2
- package/dist/index.js +334 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,7 @@ interface DrawSegment {
|
|
|
11
11
|
}
|
|
12
12
|
type SizeStyle = 's' | 'm' | 'l' | 'xl';
|
|
13
13
|
type DashStyle = 'draw' | 'solid' | 'dashed' | 'dotted';
|
|
14
|
+
type FillStyle = 'none' | 'semi' | 'solid' | 'blank';
|
|
14
15
|
type ColorStyle = string;
|
|
15
16
|
interface DrawShape {
|
|
16
17
|
id: ShapeId;
|
|
@@ -20,6 +21,7 @@ interface DrawShape {
|
|
|
20
21
|
props: {
|
|
21
22
|
color: ColorStyle;
|
|
22
23
|
dash: DashStyle;
|
|
24
|
+
fill?: FillStyle;
|
|
23
25
|
size: SizeStyle;
|
|
24
26
|
scale: number;
|
|
25
27
|
isPen: boolean;
|
|
@@ -61,11 +63,13 @@ interface TsdrawSessionStateSnapshot {
|
|
|
61
63
|
x: number;
|
|
62
64
|
y: number;
|
|
63
65
|
zoom: number;
|
|
66
|
+
rotation?: number;
|
|
64
67
|
};
|
|
65
68
|
currentToolId: string;
|
|
66
69
|
drawStyle: {
|
|
67
70
|
color: ColorStyle;
|
|
68
71
|
dash: DashStyle;
|
|
72
|
+
fill?: FillStyle;
|
|
69
73
|
size: SizeStyle;
|
|
70
74
|
};
|
|
71
75
|
selectedShapeIds: ShapeId[];
|
|
@@ -168,11 +172,13 @@ interface IEditor {
|
|
|
168
172
|
getCurrentDrawStyle(): {
|
|
169
173
|
color: ColorStyle;
|
|
170
174
|
dash: DashStyle;
|
|
175
|
+
fill: FillStyle;
|
|
171
176
|
size: SizeStyle;
|
|
172
177
|
};
|
|
173
178
|
setCurrentDrawStyle(partial: Partial<{
|
|
174
179
|
color: ColorStyle;
|
|
175
180
|
dash: DashStyle;
|
|
181
|
+
fill: FillStyle;
|
|
176
182
|
size: SizeStyle;
|
|
177
183
|
}>): void;
|
|
178
184
|
panBy(dx: number, dy: number): void;
|
|
@@ -216,6 +222,7 @@ interface Viewport {
|
|
|
216
222
|
x: number;
|
|
217
223
|
y: number;
|
|
218
224
|
zoom: number;
|
|
225
|
+
rotation: number;
|
|
219
226
|
}
|
|
220
227
|
declare function createViewport(): Viewport;
|
|
221
228
|
declare function screenToPage(viewport: Viewport, screenX: number, screenY: number): {
|
|
@@ -230,9 +237,11 @@ declare function setViewport(viewport: Viewport, updater: {
|
|
|
230
237
|
x?: number;
|
|
231
238
|
y?: number;
|
|
232
239
|
zoom?: number;
|
|
240
|
+
rotation?: number;
|
|
233
241
|
}): Viewport;
|
|
234
242
|
declare function panViewport(viewport: Viewport, dx: number, dy: number): Viewport;
|
|
235
243
|
declare function zoomViewport(viewport: Viewport, factor: number, centerX?: number, centerY?: number): Viewport;
|
|
244
|
+
declare function rotateViewport(viewport: Viewport, delta: number, centerX?: number, centerY?: number): Viewport;
|
|
236
245
|
|
|
237
246
|
type TsdrawRenderTheme = 'light' | 'dark';
|
|
238
247
|
declare function resolveThemeColor(colorStyle: string, theme: TsdrawRenderTheme): string;
|
|
@@ -246,9 +255,10 @@ declare class CanvasRenderer implements ICanvasRenderer {
|
|
|
246
255
|
render(ctx: CanvasRenderingContext2D, viewport: Viewport, shapes: Shape[]): void;
|
|
247
256
|
private paintStroke;
|
|
248
257
|
private paintDashedStroke;
|
|
258
|
+
private paintClosedShapeFill;
|
|
249
259
|
}
|
|
250
260
|
|
|
251
|
-
type DefaultToolId = 'pen' | 'eraser' | 'select' | 'hand';
|
|
261
|
+
type DefaultToolId = 'pen' | 'eraser' | 'select' | 'hand' | 'square' | 'circle';
|
|
252
262
|
type ToolId = DefaultToolId | (string & {});
|
|
253
263
|
interface ToolDefinition {
|
|
254
264
|
id: ToolId;
|
|
@@ -326,15 +336,20 @@ declare class Editor {
|
|
|
326
336
|
getCurrentDrawStyle(): {
|
|
327
337
|
color: ColorStyle;
|
|
328
338
|
dash: DashStyle;
|
|
339
|
+
fill: FillStyle;
|
|
329
340
|
size: SizeStyle;
|
|
330
341
|
};
|
|
331
342
|
setCurrentDrawStyle(partial: Partial<{
|
|
332
343
|
color: ColorStyle;
|
|
333
344
|
dash: DashStyle;
|
|
345
|
+
fill: FillStyle;
|
|
334
346
|
size: SizeStyle;
|
|
335
347
|
}>): void;
|
|
336
348
|
setViewport(partial: Partial<Viewport>): void;
|
|
337
349
|
panBy(dx: number, dy: number): void;
|
|
350
|
+
zoomAt(factor: number, screenX: number, screenY: number): void;
|
|
351
|
+
rotateAt(delta: number, screenX: number, screenY: number): void;
|
|
352
|
+
deleteShapes(ids: ShapeId[]): void;
|
|
338
353
|
getDocumentSnapshot(): TsdrawDocumentSnapshot;
|
|
339
354
|
loadDocumentSnapshot(snapshot: TsdrawDocumentSnapshot): void;
|
|
340
355
|
getSessionStateSnapshot(args?: {
|
|
@@ -401,6 +416,76 @@ declare class PenDrawingState extends StateNode {
|
|
|
401
416
|
private endStroke;
|
|
402
417
|
}
|
|
403
418
|
|
|
419
|
+
declare class SquareIdleState extends StateNode {
|
|
420
|
+
static id: string;
|
|
421
|
+
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface ShapeBounds {
|
|
425
|
+
x: number;
|
|
426
|
+
y: number;
|
|
427
|
+
width: number;
|
|
428
|
+
height: number;
|
|
429
|
+
}
|
|
430
|
+
declare function buildSquareBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
431
|
+
declare function buildRectangleBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
432
|
+
declare function buildDefaultCenteredRectangleBounds(centerX: number, centerY: number): ShapeBounds;
|
|
433
|
+
declare function buildRectangleSegments(width: number, height: number): DrawSegment[];
|
|
434
|
+
declare function buildCircleBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
435
|
+
declare function buildEllipseBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
436
|
+
declare function buildDefaultCenteredEllipseBounds(centerX: number, centerY: number): ShapeBounds;
|
|
437
|
+
declare function buildEllipseSegments(width: number, height: number): DrawSegment[];
|
|
438
|
+
|
|
439
|
+
interface GeometricDrawingStateConfig {
|
|
440
|
+
idleStateId: string;
|
|
441
|
+
buildConstrainedBounds: (anchorX: number, anchorY: number, cursorX: number, cursorY: number) => ShapeBounds;
|
|
442
|
+
buildUnconstrainedBounds: (anchorX: number, anchorY: number, cursorX: number, cursorY: number) => ShapeBounds;
|
|
443
|
+
buildDefaultBounds: (centerX: number, centerY: number) => ShapeBounds;
|
|
444
|
+
buildSegments: (width: number, height: number) => DrawSegment[];
|
|
445
|
+
}
|
|
446
|
+
declare abstract class GeometricDrawingState extends StateNode {
|
|
447
|
+
private currentShapeId;
|
|
448
|
+
private startedAt;
|
|
449
|
+
protected abstract getConfig(): GeometricDrawingStateConfig;
|
|
450
|
+
onEnter(info?: ToolPointerDownInfo): void;
|
|
451
|
+
onPointerMove(): void;
|
|
452
|
+
onPointerUp(): void;
|
|
453
|
+
onCancel(): void;
|
|
454
|
+
onInterrupt(): void;
|
|
455
|
+
onKeyDown(): void;
|
|
456
|
+
onKeyUp(): void;
|
|
457
|
+
private completeShape;
|
|
458
|
+
private removeCurrentShape;
|
|
459
|
+
private getActiveShape;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class SquareDrawingState extends GeometricDrawingState {
|
|
463
|
+
static id: string;
|
|
464
|
+
protected getConfig(): {
|
|
465
|
+
idleStateId: string;
|
|
466
|
+
buildConstrainedBounds: typeof buildSquareBounds;
|
|
467
|
+
buildUnconstrainedBounds: typeof buildRectangleBounds;
|
|
468
|
+
buildDefaultBounds: typeof buildDefaultCenteredRectangleBounds;
|
|
469
|
+
buildSegments: typeof buildRectangleSegments;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
declare class CircleIdleState extends StateNode {
|
|
474
|
+
static id: string;
|
|
475
|
+
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare class CircleDrawingState extends GeometricDrawingState {
|
|
479
|
+
static id: string;
|
|
480
|
+
protected getConfig(): {
|
|
481
|
+
idleStateId: string;
|
|
482
|
+
buildConstrainedBounds: typeof buildCircleBounds;
|
|
483
|
+
buildUnconstrainedBounds: typeof buildEllipseBounds;
|
|
484
|
+
buildDefaultBounds: typeof buildDefaultCenteredEllipseBounds;
|
|
485
|
+
buildSegments: typeof buildEllipseSegments;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
404
489
|
declare class EraserIdleState extends StateNode {
|
|
405
490
|
static id: string;
|
|
406
491
|
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
@@ -550,4 +635,4 @@ declare function decodePathToPoints(segments: {
|
|
|
550
635
|
y: number;
|
|
551
636
|
}[];
|
|
552
637
|
|
|
553
|
-
export { type Bounds, CanvasRenderer, type ColorStyle, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, type DashStyle, type DefaultToolId, DocumentStore, type DocumentStoreSnapshot, type DrawSegment, type DrawShape, ERASER_MARGIN, Editor, type EditorOptions, EraserErasingState, EraserIdleState, EraserPointingState, HandDraggingState, HandIdleState, type ICanvasRenderer, type IEditor, InputManager, MAX_POINTS_PER_SHAPE, type PageState, PenDrawingState, PenIdleState, type PointerInput, type ResizeHandle, STROKE_WIDTHS, type SegmentType, SelectIdleState, type SelectionBounds, type Shape, type ShapeId, type SizeStyle, StateNode, type StateNodeConstructor, type ToolDefinition, type ToolId, type ToolKeyInfo, ToolManager, type ToolPointerDownInfo, type ToolPointerMoveInfo, type ToolStateContext, type ToolStateTransitionInfo, type TransformSnapshot, type TsdrawDocumentSnapshot, type TsdrawEditorSnapshot, type TsdrawHistorySnapshot, type TsdrawPageRecord, type TsdrawPersistedRecord, type TsdrawRenderTheme, type TsdrawSessionStateSnapshot, type TsdrawShapeRecord, type Vec3, type Viewport, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|
|
638
|
+
export { type Bounds, CanvasRenderer, CircleDrawingState, CircleIdleState, type ColorStyle, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, type DashStyle, type DefaultToolId, DocumentStore, type DocumentStoreSnapshot, type DrawSegment, type DrawShape, ERASER_MARGIN, Editor, type EditorOptions, EraserErasingState, EraserIdleState, EraserPointingState, type FillStyle, HandDraggingState, HandIdleState, type ICanvasRenderer, type IEditor, InputManager, MAX_POINTS_PER_SHAPE, type PageState, PenDrawingState, PenIdleState, type PointerInput, type ResizeHandle, STROKE_WIDTHS, type SegmentType, SelectIdleState, type SelectionBounds, type Shape, type ShapeId, type SizeStyle, SquareDrawingState, SquareIdleState, StateNode, type StateNodeConstructor, type ToolDefinition, type ToolId, type ToolKeyInfo, ToolManager, type ToolPointerDownInfo, type ToolPointerMoveInfo, type ToolStateContext, type ToolStateTransitionInfo, type TransformSnapshot, type TsdrawDocumentSnapshot, type TsdrawEditorSnapshot, type TsdrawHistorySnapshot, type TsdrawPageRecord, type TsdrawPersistedRecord, type TsdrawRenderTheme, type TsdrawSessionStateSnapshot, type TsdrawShapeRecord, type Vec3, type Viewport, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, rotateViewport, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface DrawSegment {
|
|
|
11
11
|
}
|
|
12
12
|
type SizeStyle = 's' | 'm' | 'l' | 'xl';
|
|
13
13
|
type DashStyle = 'draw' | 'solid' | 'dashed' | 'dotted';
|
|
14
|
+
type FillStyle = 'none' | 'semi' | 'solid' | 'blank';
|
|
14
15
|
type ColorStyle = string;
|
|
15
16
|
interface DrawShape {
|
|
16
17
|
id: ShapeId;
|
|
@@ -20,6 +21,7 @@ interface DrawShape {
|
|
|
20
21
|
props: {
|
|
21
22
|
color: ColorStyle;
|
|
22
23
|
dash: DashStyle;
|
|
24
|
+
fill?: FillStyle;
|
|
23
25
|
size: SizeStyle;
|
|
24
26
|
scale: number;
|
|
25
27
|
isPen: boolean;
|
|
@@ -61,11 +63,13 @@ interface TsdrawSessionStateSnapshot {
|
|
|
61
63
|
x: number;
|
|
62
64
|
y: number;
|
|
63
65
|
zoom: number;
|
|
66
|
+
rotation?: number;
|
|
64
67
|
};
|
|
65
68
|
currentToolId: string;
|
|
66
69
|
drawStyle: {
|
|
67
70
|
color: ColorStyle;
|
|
68
71
|
dash: DashStyle;
|
|
72
|
+
fill?: FillStyle;
|
|
69
73
|
size: SizeStyle;
|
|
70
74
|
};
|
|
71
75
|
selectedShapeIds: ShapeId[];
|
|
@@ -168,11 +172,13 @@ interface IEditor {
|
|
|
168
172
|
getCurrentDrawStyle(): {
|
|
169
173
|
color: ColorStyle;
|
|
170
174
|
dash: DashStyle;
|
|
175
|
+
fill: FillStyle;
|
|
171
176
|
size: SizeStyle;
|
|
172
177
|
};
|
|
173
178
|
setCurrentDrawStyle(partial: Partial<{
|
|
174
179
|
color: ColorStyle;
|
|
175
180
|
dash: DashStyle;
|
|
181
|
+
fill: FillStyle;
|
|
176
182
|
size: SizeStyle;
|
|
177
183
|
}>): void;
|
|
178
184
|
panBy(dx: number, dy: number): void;
|
|
@@ -216,6 +222,7 @@ interface Viewport {
|
|
|
216
222
|
x: number;
|
|
217
223
|
y: number;
|
|
218
224
|
zoom: number;
|
|
225
|
+
rotation: number;
|
|
219
226
|
}
|
|
220
227
|
declare function createViewport(): Viewport;
|
|
221
228
|
declare function screenToPage(viewport: Viewport, screenX: number, screenY: number): {
|
|
@@ -230,9 +237,11 @@ declare function setViewport(viewport: Viewport, updater: {
|
|
|
230
237
|
x?: number;
|
|
231
238
|
y?: number;
|
|
232
239
|
zoom?: number;
|
|
240
|
+
rotation?: number;
|
|
233
241
|
}): Viewport;
|
|
234
242
|
declare function panViewport(viewport: Viewport, dx: number, dy: number): Viewport;
|
|
235
243
|
declare function zoomViewport(viewport: Viewport, factor: number, centerX?: number, centerY?: number): Viewport;
|
|
244
|
+
declare function rotateViewport(viewport: Viewport, delta: number, centerX?: number, centerY?: number): Viewport;
|
|
236
245
|
|
|
237
246
|
type TsdrawRenderTheme = 'light' | 'dark';
|
|
238
247
|
declare function resolveThemeColor(colorStyle: string, theme: TsdrawRenderTheme): string;
|
|
@@ -246,9 +255,10 @@ declare class CanvasRenderer implements ICanvasRenderer {
|
|
|
246
255
|
render(ctx: CanvasRenderingContext2D, viewport: Viewport, shapes: Shape[]): void;
|
|
247
256
|
private paintStroke;
|
|
248
257
|
private paintDashedStroke;
|
|
258
|
+
private paintClosedShapeFill;
|
|
249
259
|
}
|
|
250
260
|
|
|
251
|
-
type DefaultToolId = 'pen' | 'eraser' | 'select' | 'hand';
|
|
261
|
+
type DefaultToolId = 'pen' | 'eraser' | 'select' | 'hand' | 'square' | 'circle';
|
|
252
262
|
type ToolId = DefaultToolId | (string & {});
|
|
253
263
|
interface ToolDefinition {
|
|
254
264
|
id: ToolId;
|
|
@@ -326,15 +336,20 @@ declare class Editor {
|
|
|
326
336
|
getCurrentDrawStyle(): {
|
|
327
337
|
color: ColorStyle;
|
|
328
338
|
dash: DashStyle;
|
|
339
|
+
fill: FillStyle;
|
|
329
340
|
size: SizeStyle;
|
|
330
341
|
};
|
|
331
342
|
setCurrentDrawStyle(partial: Partial<{
|
|
332
343
|
color: ColorStyle;
|
|
333
344
|
dash: DashStyle;
|
|
345
|
+
fill: FillStyle;
|
|
334
346
|
size: SizeStyle;
|
|
335
347
|
}>): void;
|
|
336
348
|
setViewport(partial: Partial<Viewport>): void;
|
|
337
349
|
panBy(dx: number, dy: number): void;
|
|
350
|
+
zoomAt(factor: number, screenX: number, screenY: number): void;
|
|
351
|
+
rotateAt(delta: number, screenX: number, screenY: number): void;
|
|
352
|
+
deleteShapes(ids: ShapeId[]): void;
|
|
338
353
|
getDocumentSnapshot(): TsdrawDocumentSnapshot;
|
|
339
354
|
loadDocumentSnapshot(snapshot: TsdrawDocumentSnapshot): void;
|
|
340
355
|
getSessionStateSnapshot(args?: {
|
|
@@ -401,6 +416,76 @@ declare class PenDrawingState extends StateNode {
|
|
|
401
416
|
private endStroke;
|
|
402
417
|
}
|
|
403
418
|
|
|
419
|
+
declare class SquareIdleState extends StateNode {
|
|
420
|
+
static id: string;
|
|
421
|
+
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface ShapeBounds {
|
|
425
|
+
x: number;
|
|
426
|
+
y: number;
|
|
427
|
+
width: number;
|
|
428
|
+
height: number;
|
|
429
|
+
}
|
|
430
|
+
declare function buildSquareBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
431
|
+
declare function buildRectangleBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
432
|
+
declare function buildDefaultCenteredRectangleBounds(centerX: number, centerY: number): ShapeBounds;
|
|
433
|
+
declare function buildRectangleSegments(width: number, height: number): DrawSegment[];
|
|
434
|
+
declare function buildCircleBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
435
|
+
declare function buildEllipseBounds(anchorX: number, anchorY: number, cursorX: number, cursorY: number): ShapeBounds;
|
|
436
|
+
declare function buildDefaultCenteredEllipseBounds(centerX: number, centerY: number): ShapeBounds;
|
|
437
|
+
declare function buildEllipseSegments(width: number, height: number): DrawSegment[];
|
|
438
|
+
|
|
439
|
+
interface GeometricDrawingStateConfig {
|
|
440
|
+
idleStateId: string;
|
|
441
|
+
buildConstrainedBounds: (anchorX: number, anchorY: number, cursorX: number, cursorY: number) => ShapeBounds;
|
|
442
|
+
buildUnconstrainedBounds: (anchorX: number, anchorY: number, cursorX: number, cursorY: number) => ShapeBounds;
|
|
443
|
+
buildDefaultBounds: (centerX: number, centerY: number) => ShapeBounds;
|
|
444
|
+
buildSegments: (width: number, height: number) => DrawSegment[];
|
|
445
|
+
}
|
|
446
|
+
declare abstract class GeometricDrawingState extends StateNode {
|
|
447
|
+
private currentShapeId;
|
|
448
|
+
private startedAt;
|
|
449
|
+
protected abstract getConfig(): GeometricDrawingStateConfig;
|
|
450
|
+
onEnter(info?: ToolPointerDownInfo): void;
|
|
451
|
+
onPointerMove(): void;
|
|
452
|
+
onPointerUp(): void;
|
|
453
|
+
onCancel(): void;
|
|
454
|
+
onInterrupt(): void;
|
|
455
|
+
onKeyDown(): void;
|
|
456
|
+
onKeyUp(): void;
|
|
457
|
+
private completeShape;
|
|
458
|
+
private removeCurrentShape;
|
|
459
|
+
private getActiveShape;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class SquareDrawingState extends GeometricDrawingState {
|
|
463
|
+
static id: string;
|
|
464
|
+
protected getConfig(): {
|
|
465
|
+
idleStateId: string;
|
|
466
|
+
buildConstrainedBounds: typeof buildSquareBounds;
|
|
467
|
+
buildUnconstrainedBounds: typeof buildRectangleBounds;
|
|
468
|
+
buildDefaultBounds: typeof buildDefaultCenteredRectangleBounds;
|
|
469
|
+
buildSegments: typeof buildRectangleSegments;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
declare class CircleIdleState extends StateNode {
|
|
474
|
+
static id: string;
|
|
475
|
+
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare class CircleDrawingState extends GeometricDrawingState {
|
|
479
|
+
static id: string;
|
|
480
|
+
protected getConfig(): {
|
|
481
|
+
idleStateId: string;
|
|
482
|
+
buildConstrainedBounds: typeof buildCircleBounds;
|
|
483
|
+
buildUnconstrainedBounds: typeof buildEllipseBounds;
|
|
484
|
+
buildDefaultBounds: typeof buildDefaultCenteredEllipseBounds;
|
|
485
|
+
buildSegments: typeof buildEllipseSegments;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
404
489
|
declare class EraserIdleState extends StateNode {
|
|
405
490
|
static id: string;
|
|
406
491
|
onPointerDown(info?: ToolPointerDownInfo): void;
|
|
@@ -550,4 +635,4 @@ declare function decodePathToPoints(segments: {
|
|
|
550
635
|
y: number;
|
|
551
636
|
}[];
|
|
552
637
|
|
|
553
|
-
export { type Bounds, CanvasRenderer, type ColorStyle, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, type DashStyle, type DefaultToolId, DocumentStore, type DocumentStoreSnapshot, type DrawSegment, type DrawShape, ERASER_MARGIN, Editor, type EditorOptions, EraserErasingState, EraserIdleState, EraserPointingState, HandDraggingState, HandIdleState, type ICanvasRenderer, type IEditor, InputManager, MAX_POINTS_PER_SHAPE, type PageState, PenDrawingState, PenIdleState, type PointerInput, type ResizeHandle, STROKE_WIDTHS, type SegmentType, SelectIdleState, type SelectionBounds, type Shape, type ShapeId, type SizeStyle, StateNode, type StateNodeConstructor, type ToolDefinition, type ToolId, type ToolKeyInfo, ToolManager, type ToolPointerDownInfo, type ToolPointerMoveInfo, type ToolStateContext, type ToolStateTransitionInfo, type TransformSnapshot, type TsdrawDocumentSnapshot, type TsdrawEditorSnapshot, type TsdrawHistorySnapshot, type TsdrawPageRecord, type TsdrawPersistedRecord, type TsdrawRenderTheme, type TsdrawSessionStateSnapshot, type TsdrawShapeRecord, type Vec3, type Viewport, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|
|
638
|
+
export { type Bounds, CanvasRenderer, CircleDrawingState, CircleIdleState, type ColorStyle, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, type DashStyle, type DefaultToolId, DocumentStore, type DocumentStoreSnapshot, type DrawSegment, type DrawShape, ERASER_MARGIN, Editor, type EditorOptions, EraserErasingState, EraserIdleState, EraserPointingState, type FillStyle, HandDraggingState, HandIdleState, type ICanvasRenderer, type IEditor, InputManager, MAX_POINTS_PER_SHAPE, type PageState, PenDrawingState, PenIdleState, type PointerInput, type ResizeHandle, STROKE_WIDTHS, type SegmentType, SelectIdleState, type SelectionBounds, type Shape, type ShapeId, type SizeStyle, SquareDrawingState, SquareIdleState, StateNode, type StateNodeConstructor, type ToolDefinition, type ToolId, type ToolKeyInfo, ToolManager, type ToolPointerDownInfo, type ToolPointerMoveInfo, type ToolStateContext, type ToolStateTransitionInfo, type TransformSnapshot, type TsdrawDocumentSnapshot, type TsdrawEditorSnapshot, type TsdrawHistorySnapshot, type TsdrawPageRecord, type TsdrawPersistedRecord, type TsdrawRenderTheme, type TsdrawSessionStateSnapshot, type TsdrawShapeRecord, type Vec3, type Viewport, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, rotateViewport, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|