@tsdraw/core 0.7.0 → 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 +65 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +65 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -63,6 +63,7 @@ interface TsdrawSessionStateSnapshot {
|
|
|
63
63
|
x: number;
|
|
64
64
|
y: number;
|
|
65
65
|
zoom: number;
|
|
66
|
+
rotation?: number;
|
|
66
67
|
};
|
|
67
68
|
currentToolId: string;
|
|
68
69
|
drawStyle: {
|
|
@@ -221,6 +222,7 @@ interface Viewport {
|
|
|
221
222
|
x: number;
|
|
222
223
|
y: number;
|
|
223
224
|
zoom: number;
|
|
225
|
+
rotation: number;
|
|
224
226
|
}
|
|
225
227
|
declare function createViewport(): Viewport;
|
|
226
228
|
declare function screenToPage(viewport: Viewport, screenX: number, screenY: number): {
|
|
@@ -235,9 +237,11 @@ declare function setViewport(viewport: Viewport, updater: {
|
|
|
235
237
|
x?: number;
|
|
236
238
|
y?: number;
|
|
237
239
|
zoom?: number;
|
|
240
|
+
rotation?: number;
|
|
238
241
|
}): Viewport;
|
|
239
242
|
declare function panViewport(viewport: Viewport, dx: number, dy: number): Viewport;
|
|
240
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;
|
|
241
245
|
|
|
242
246
|
type TsdrawRenderTheme = 'light' | 'dark';
|
|
243
247
|
declare function resolveThemeColor(colorStyle: string, theme: TsdrawRenderTheme): string;
|
|
@@ -343,6 +347,9 @@ declare class Editor {
|
|
|
343
347
|
}>): void;
|
|
344
348
|
setViewport(partial: Partial<Viewport>): void;
|
|
345
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;
|
|
346
353
|
getDocumentSnapshot(): TsdrawDocumentSnapshot;
|
|
347
354
|
loadDocumentSnapshot(snapshot: TsdrawDocumentSnapshot): void;
|
|
348
355
|
getSessionStateSnapshot(args?: {
|
|
@@ -628,4 +635,4 @@ declare function decodePathToPoints(segments: {
|
|
|
628
635
|
y: number;
|
|
629
636
|
}[];
|
|
630
637
|
|
|
631
|
-
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, 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
|
@@ -63,6 +63,7 @@ interface TsdrawSessionStateSnapshot {
|
|
|
63
63
|
x: number;
|
|
64
64
|
y: number;
|
|
65
65
|
zoom: number;
|
|
66
|
+
rotation?: number;
|
|
66
67
|
};
|
|
67
68
|
currentToolId: string;
|
|
68
69
|
drawStyle: {
|
|
@@ -221,6 +222,7 @@ interface Viewport {
|
|
|
221
222
|
x: number;
|
|
222
223
|
y: number;
|
|
223
224
|
zoom: number;
|
|
225
|
+
rotation: number;
|
|
224
226
|
}
|
|
225
227
|
declare function createViewport(): Viewport;
|
|
226
228
|
declare function screenToPage(viewport: Viewport, screenX: number, screenY: number): {
|
|
@@ -235,9 +237,11 @@ declare function setViewport(viewport: Viewport, updater: {
|
|
|
235
237
|
x?: number;
|
|
236
238
|
y?: number;
|
|
237
239
|
zoom?: number;
|
|
240
|
+
rotation?: number;
|
|
238
241
|
}): Viewport;
|
|
239
242
|
declare function panViewport(viewport: Viewport, dx: number, dy: number): Viewport;
|
|
240
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;
|
|
241
245
|
|
|
242
246
|
type TsdrawRenderTheme = 'light' | 'dark';
|
|
243
247
|
declare function resolveThemeColor(colorStyle: string, theme: TsdrawRenderTheme): string;
|
|
@@ -343,6 +347,9 @@ declare class Editor {
|
|
|
343
347
|
}>): void;
|
|
344
348
|
setViewport(partial: Partial<Viewport>): void;
|
|
345
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;
|
|
346
353
|
getDocumentSnapshot(): TsdrawDocumentSnapshot;
|
|
347
354
|
loadDocumentSnapshot(snapshot: TsdrawDocumentSnapshot): void;
|
|
348
355
|
getSessionStateSnapshot(args?: {
|
|
@@ -628,4 +635,4 @@ declare function decodePathToPoints(segments: {
|
|
|
628
635
|
y: number;
|
|
629
636
|
}[];
|
|
630
637
|
|
|
631
|
-
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, 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.js
CHANGED
|
@@ -223,25 +223,34 @@ var StateNode = class {
|
|
|
223
223
|
|
|
224
224
|
// src/canvas/viewport.ts
|
|
225
225
|
function createViewport() {
|
|
226
|
-
return { x: 0, y: 0, zoom: 1 };
|
|
226
|
+
return { x: 0, y: 0, zoom: 1, rotation: 0 };
|
|
227
227
|
}
|
|
228
228
|
function screenToPage(viewport, screenX, screenY) {
|
|
229
|
+
const tx = screenX - viewport.x;
|
|
230
|
+
const ty = screenY - viewport.y;
|
|
231
|
+
const cos = Math.cos(viewport.rotation);
|
|
232
|
+
const sin = Math.sin(viewport.rotation);
|
|
229
233
|
return {
|
|
230
|
-
x: (
|
|
231
|
-
y: (
|
|
234
|
+
x: (tx * cos + ty * sin) / viewport.zoom,
|
|
235
|
+
y: (-tx * sin + ty * cos) / viewport.zoom
|
|
232
236
|
};
|
|
233
237
|
}
|
|
234
238
|
function pageToScreen(viewport, pageX, pageY) {
|
|
239
|
+
const scaledX = pageX * viewport.zoom;
|
|
240
|
+
const scaledY = pageY * viewport.zoom;
|
|
241
|
+
const cos = Math.cos(viewport.rotation);
|
|
242
|
+
const sin = Math.sin(viewport.rotation);
|
|
235
243
|
return {
|
|
236
|
-
x:
|
|
237
|
-
y:
|
|
244
|
+
x: scaledX * cos - scaledY * sin + viewport.x,
|
|
245
|
+
y: scaledX * sin + scaledY * cos + viewport.y
|
|
238
246
|
};
|
|
239
247
|
}
|
|
240
248
|
function setViewport(viewport, updater) {
|
|
241
249
|
return {
|
|
242
250
|
x: updater.x ?? viewport.x,
|
|
243
251
|
y: updater.y ?? viewport.y,
|
|
244
|
-
zoom: updater.zoom ?? viewport.zoom
|
|
252
|
+
zoom: updater.zoom ?? viewport.zoom,
|
|
253
|
+
rotation: updater.rotation ?? viewport.rotation
|
|
245
254
|
};
|
|
246
255
|
}
|
|
247
256
|
function panViewport(viewport, dx, dy) {
|
|
@@ -253,9 +262,23 @@ function zoomViewport(viewport, factor, centerX, centerY) {
|
|
|
253
262
|
return { ...viewport, zoom };
|
|
254
263
|
}
|
|
255
264
|
const pageBefore = screenToPage(viewport, centerX, centerY);
|
|
256
|
-
const
|
|
257
|
-
const
|
|
258
|
-
|
|
265
|
+
const cos = Math.cos(viewport.rotation);
|
|
266
|
+
const sin = Math.sin(viewport.rotation);
|
|
267
|
+
const x = centerX - (pageBefore.x * zoom * cos - pageBefore.y * zoom * sin);
|
|
268
|
+
const y = centerY - (pageBefore.x * zoom * sin + pageBefore.y * zoom * cos);
|
|
269
|
+
return { x, y, zoom, rotation: viewport.rotation };
|
|
270
|
+
}
|
|
271
|
+
function rotateViewport(viewport, delta, centerX, centerY) {
|
|
272
|
+
const rotation = viewport.rotation + delta;
|
|
273
|
+
if (centerX == null || centerY == null) {
|
|
274
|
+
return { ...viewport, rotation };
|
|
275
|
+
}
|
|
276
|
+
const pageBefore = screenToPage(viewport, centerX, centerY);
|
|
277
|
+
const cos = Math.cos(rotation);
|
|
278
|
+
const sin = Math.sin(rotation);
|
|
279
|
+
const x = centerX - (pageBefore.x * viewport.zoom * cos - pageBefore.y * viewport.zoom * sin);
|
|
280
|
+
const y = centerY - (pageBefore.x * viewport.zoom * sin + pageBefore.y * viewport.zoom * cos);
|
|
281
|
+
return { x, y, zoom: viewport.zoom, rotation };
|
|
259
282
|
}
|
|
260
283
|
|
|
261
284
|
// src/utils/colors.ts
|
|
@@ -288,6 +311,7 @@ var CanvasRenderer = class {
|
|
|
288
311
|
render(ctx, viewport, shapes) {
|
|
289
312
|
ctx.save();
|
|
290
313
|
ctx.translate(viewport.x, viewport.y);
|
|
314
|
+
ctx.rotate(viewport.rotation);
|
|
291
315
|
ctx.scale(viewport.zoom, viewport.zoom);
|
|
292
316
|
for (const shape of shapes) {
|
|
293
317
|
if (shape.type === "draw") {
|
|
@@ -448,9 +472,6 @@ function flattenSegments(shape) {
|
|
|
448
472
|
}
|
|
449
473
|
out.push(D);
|
|
450
474
|
}
|
|
451
|
-
if (out.length > 0 && !shape.props.isPen) {
|
|
452
|
-
for (const p of out) p.pressure = 0.5;
|
|
453
|
-
}
|
|
454
475
|
return out;
|
|
455
476
|
}
|
|
456
477
|
function getLineDash(dash, width) {
|
|
@@ -781,8 +802,8 @@ var PenDrawingState = class extends StateNode {
|
|
|
781
802
|
const penActive = inputs.getIsPen();
|
|
782
803
|
const z = this._startInfo?.point?.z ?? 0.5;
|
|
783
804
|
this._isPenDevice = penActive;
|
|
784
|
-
this._hasPressure = penActive
|
|
785
|
-
const pressure = this._hasPressure ? toFixed(z
|
|
805
|
+
this._hasPressure = penActive || z !== 0.5;
|
|
806
|
+
const pressure = this._hasPressure ? toFixed(z) : 0.5;
|
|
786
807
|
this._phase = inputs.getShiftKey() ? "straight" : "free";
|
|
787
808
|
this._extending = false;
|
|
788
809
|
this._lastSample = { ...origin };
|
|
@@ -877,8 +898,15 @@ var PenDrawingState = class extends StateNode {
|
|
|
877
898
|
const { id, props: { size, scale } } = target;
|
|
878
899
|
const { segments } = shape.props;
|
|
879
900
|
const curPt = inputs.getCurrentPagePoint();
|
|
901
|
+
if (!this._hasPressure) {
|
|
902
|
+
const liveZ = curPt.z ?? 0.5;
|
|
903
|
+
if (liveZ !== 0.5 || inputs.getIsPen()) {
|
|
904
|
+
this._hasPressure = true;
|
|
905
|
+
this.editor.updateShapes([{ id, type: "draw", props: { isPen: true } }]);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
880
908
|
const local = this.editor.getPointInShapeSpace(shape, curPt);
|
|
881
|
-
const pressure = this._hasPressure ? toFixed(
|
|
909
|
+
const pressure = this._hasPressure ? toFixed(curPt.z ?? 0.5) : 0.5;
|
|
882
910
|
const pt = { x: toFixed(local.x), y: toFixed(local.y), z: pressure };
|
|
883
911
|
switch (this._phase) {
|
|
884
912
|
case "starting_straight": {
|
|
@@ -1024,7 +1052,7 @@ var PenDrawingState = class extends StateNode {
|
|
|
1024
1052
|
const firstPt = {
|
|
1025
1053
|
x: 0,
|
|
1026
1054
|
y: 0,
|
|
1027
|
-
z: this._hasPressure ? toFixed(
|
|
1055
|
+
z: this._hasPressure ? toFixed(curPage.z ?? 0.5) : 0.5
|
|
1028
1056
|
};
|
|
1029
1057
|
this._activePts = [firstPt];
|
|
1030
1058
|
this.editor.createShape({
|
|
@@ -1734,7 +1762,8 @@ var Editor = class {
|
|
|
1734
1762
|
this.viewport = {
|
|
1735
1763
|
x: partial.x ?? this.viewport.x,
|
|
1736
1764
|
y: partial.y ?? this.viewport.y,
|
|
1737
|
-
zoom: Math.max(0.1, Math.min(4, rawZoom))
|
|
1765
|
+
zoom: Math.max(0.1, Math.min(4, rawZoom)),
|
|
1766
|
+
rotation: partial.rotation ?? this.viewport.rotation
|
|
1738
1767
|
};
|
|
1739
1768
|
this.emitChange();
|
|
1740
1769
|
}
|
|
@@ -1744,6 +1773,18 @@ var Editor = class {
|
|
|
1744
1773
|
y: this.viewport.y + dy
|
|
1745
1774
|
});
|
|
1746
1775
|
}
|
|
1776
|
+
zoomAt(factor, screenX, screenY) {
|
|
1777
|
+
this.viewport = zoomViewport(this.viewport, factor, screenX, screenY);
|
|
1778
|
+
this.emitChange();
|
|
1779
|
+
}
|
|
1780
|
+
rotateAt(delta, screenX, screenY) {
|
|
1781
|
+
this.viewport = rotateViewport(this.viewport, delta, screenX, screenY);
|
|
1782
|
+
this.emitChange();
|
|
1783
|
+
}
|
|
1784
|
+
deleteShapes(ids) {
|
|
1785
|
+
if (ids.length === 0) return;
|
|
1786
|
+
this.store.deleteShapes(ids);
|
|
1787
|
+
}
|
|
1747
1788
|
getDocumentSnapshot() {
|
|
1748
1789
|
return {
|
|
1749
1790
|
records: documentSnapshotToRecords(this.store.getSnapshot())
|
|
@@ -1762,7 +1803,8 @@ var Editor = class {
|
|
|
1762
1803
|
viewport: {
|
|
1763
1804
|
x: this.viewport.x,
|
|
1764
1805
|
y: this.viewport.y,
|
|
1765
|
-
zoom: this.viewport.zoom
|
|
1806
|
+
zoom: this.viewport.zoom,
|
|
1807
|
+
rotation: this.viewport.rotation
|
|
1766
1808
|
},
|
|
1767
1809
|
currentToolId: this.getCurrentToolId(),
|
|
1768
1810
|
drawStyle: this.getCurrentDrawStyle(),
|
|
@@ -1770,7 +1812,10 @@ var Editor = class {
|
|
|
1770
1812
|
};
|
|
1771
1813
|
}
|
|
1772
1814
|
loadSessionStateSnapshot(snapshot) {
|
|
1773
|
-
this.setViewport(
|
|
1815
|
+
this.setViewport({
|
|
1816
|
+
...snapshot.viewport,
|
|
1817
|
+
rotation: snapshot.viewport.rotation ?? 0
|
|
1818
|
+
});
|
|
1774
1819
|
this.setCurrentDrawStyle({
|
|
1775
1820
|
color: snapshot.drawStyle.color,
|
|
1776
1821
|
dash: snapshot.drawStyle.dash,
|
|
@@ -2157,6 +2202,6 @@ function applyResize(editor, handle, startBounds, startShapes, pointer, lockAspe
|
|
|
2157
2202
|
}
|
|
2158
2203
|
}
|
|
2159
2204
|
|
|
2160
|
-
export { CanvasRenderer, CircleDrawingState, CircleIdleState, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, DocumentStore, ERASER_MARGIN, Editor, EraserErasingState, EraserIdleState, EraserPointingState, HandDraggingState, HandIdleState, InputManager, MAX_POINTS_PER_SHAPE, PenDrawingState, PenIdleState, STROKE_WIDTHS, SelectIdleState, SquareDrawingState, SquareIdleState, StateNode, ToolManager, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds2 as getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|
|
2205
|
+
export { CanvasRenderer, CircleDrawingState, CircleIdleState, DEFAULT_COLORS, DRAG_DISTANCE_SQUARED, DocumentStore, ERASER_MARGIN, Editor, EraserErasingState, EraserIdleState, EraserPointingState, HandDraggingState, HandIdleState, InputManager, MAX_POINTS_PER_SHAPE, PenDrawingState, PenIdleState, STROKE_WIDTHS, SelectIdleState, SquareDrawingState, SquareIdleState, StateNode, ToolManager, applyMove, applyResize, applyRotation, boundsContainPoint, boundsIntersect, boundsOf, buildStartPositions, buildTransformSnapshots, closestOnSegment, createViewport, decodeFirstPoint, decodeLastPoint, decodePathToPoints, decodePoints, distance, documentSnapshotToRecords, encodePoints, getSelectionBoundsPage, getShapeBounds2 as getShapeBounds, getShapesInBounds, getTopShapeAtPoint, isSelectTool, minDistanceToPolyline, normalizeSelectionBounds, padBounds, pageToScreen, panViewport, pointHitsShape, recordsToDocumentSnapshot, resolveThemeColor, rotatePoint, rotateViewport, screenToPage, segmentHitsShape, segmentTouchesPolyline, setViewport, shapePagePoints, sqDistance, zoomViewport };
|
|
2161
2206
|
//# sourceMappingURL=index.js.map
|
|
2162
2207
|
//# sourceMappingURL=index.js.map
|