tldraw 4.3.0-next.a10a6b62725c → 4.3.0-next.bad71ed2ab6a
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-cjs/index.d.ts +14 -5
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/bindings/arrow/ArrowBindingUtil.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/elbow/elbowArrowSnapLines.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/shared.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/bookmark/bookmarks.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +2 -2
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeTool.js.map +1 -1
- package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/line/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/note/noteHelpers.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/crop.js +1 -0
- package/dist-cjs/lib/shapes/shared/crop.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditableRichText.js.map +2 -2
- package/dist-cjs/lib/shapes/text/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +1 -4
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/ui/components/EditLinkDialog.js +11 -1
- package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +1 -2
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +8 -0
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/export/exportAs.js.map +2 -2
- package/dist-cjs/lib/utils/frames/frames.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +14 -5
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/bindings/arrow/ArrowBindingUtil.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/elbow/elbowArrowSnapLines.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/shared.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/bookmark/bookmarks.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs.map +1 -1
- package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/noteHelpers.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/crop.mjs +1 -0
- package/dist-esm/lib/shapes/shared/crop.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditableRichText.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +1 -4
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +1 -4
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs +1 -4
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs +11 -1
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +1 -4
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +1 -2
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs +1 -4
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +8 -0
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/export/exportAs.mjs +1 -3
- package/dist-esm/lib/utils/export/exportAs.mjs.map +2 -2
- package/dist-esm/lib/utils/frames/frames.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +10 -10
- package/src/lib/bindings/arrow/ArrowBindingUtil.ts +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +4 -9
- package/src/lib/defaultExternalContentHandlers.ts +3 -4
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +2 -2
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +1 -1
- package/src/lib/shapes/arrow/arrowLabel.ts +1 -1
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -1
- package/src/lib/shapes/arrow/elbow/elbowArrowSnapLines.tsx +3 -3
- package/src/lib/shapes/arrow/shared.ts +4 -4
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
- package/src/lib/shapes/bookmark/bookmarks.ts +3 -3
- package/src/lib/shapes/draw/toolStates/Drawing.ts +4 -4
- package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
- package/src/lib/shapes/frame/FrameShapeTool.ts +1 -1
- package/src/lib/shapes/geo/GeoShapeUtil.test.tsx +10 -2
- package/src/lib/shapes/geo/toolStates/Pointing.ts +3 -3
- package/src/lib/shapes/line/LineShapeTool.test.ts +6 -6
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +5 -5
- package/src/lib/shapes/line/toolStates/Pointing.ts +1 -1
- package/src/lib/shapes/note/NoteShapeTool.test.ts +2 -1
- package/src/lib/shapes/note/noteHelpers.ts +2 -2
- package/src/lib/shapes/shared/PlainTextLabel.tsx +2 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +2 -1
- package/src/lib/shapes/shared/crop.ts +1 -0
- package/src/lib/shapes/shared/useEditablePlainText.ts +7 -3
- package/src/lib/shapes/shared/useEditableRichText.ts +7 -3
- package/src/lib/shapes/text/TextShapeTool.test.ts +4 -4
- package/src/lib/shapes/text/toolStates/Pointing.ts +1 -1
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +3 -5
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +3 -16
- package/src/lib/tools/SelectTool/DragAndDropManager.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Brushing.ts +2 -6
- package/src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts +2 -3
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +4 -7
- package/src/lib/tools/SelectTool/childStates/EditingShape.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Idle.ts +6 -10
- package/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +1 -1
- package/src/lib/tools/SelectTool/childStates/PointingHandle.ts +4 -12
- package/src/lib/tools/SelectTool/childStates/PointingSelection.ts +2 -2
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/ScribbleBrushing.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -3
- package/src/lib/ui/components/EditLinkDialog.tsx +16 -6
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -2
- package/src/lib/ui/components/menu-items.tsx +6 -14
- package/src/lib/ui/context/actions.tsx +9 -13
- package/src/lib/ui/hooks/menu-hooks.ts +9 -19
- package/src/lib/ui/hooks/useFlatten.ts +1 -2
- package/src/lib/ui/hooks/useTools.tsx +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +8 -0
- package/src/lib/utils/export/exportAs.ts +2 -9
- package/src/lib/utils/frames/frames.ts +1 -1
- package/src/lib/utils/tldr/buildFromV1Document.ts +12 -17
- package/src/test/Editor.test.tsx +38 -12
- package/src/test/SelectTool.test.ts +11 -19
- package/src/test/TestEditor.ts +1 -4
- package/src/test/TldrawEditor.test.tsx +18 -16
- package/src/test/bindings.test.tsx +29 -25
- package/src/test/bindingsIndex.test.tsx +4 -4
- package/src/test/commands/createShape.test.ts +64 -0
- package/src/test/commands/createShapes.test.ts +15 -1
- package/src/test/commands/getSvgString.test.ts +2 -2
- package/src/test/commands/isShapeOfType.test.ts +44 -0
- package/src/test/commands/putContent.test.ts +1 -0
- package/src/test/commands/updateShape.test.ts +67 -0
- package/src/test/commands/updateShapes.test.ts +21 -5
- package/src/test/custom-clipping.test.ts +36 -35
- package/src/test/customSnapping.test.tsx +77 -62
- package/src/test/duplicate.test.ts +1 -1
- package/src/test/frames.test.ts +2 -2
- package/src/test/getCulledShapes.test.tsx +11 -3
- package/src/test/getShapeAtPoint.test.ts +2 -2
- package/src/test/groups.test.tsx +6 -3
- package/src/test/resizing.test.ts +9 -13
- package/src/test/selection-omnibus.test.ts +11 -11
- package/src/test/shapeutils.test.ts +1 -1
- package/src/test/styles2.test.tsx +1 -1
- package/src/test/styles3.test.ts +5 -5
- package/src/test/test-jsx.tsx +69 -57
- package/src/test/text.test.ts +15 -17
- package/src/test/translating.test.ts +6 -8
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
resizeBox,
|
|
9
9
|
StateNode,
|
|
10
10
|
T,
|
|
11
|
-
TLBaseShape,
|
|
12
11
|
TLEventHandlers,
|
|
13
12
|
TLGeoShape,
|
|
14
13
|
TLResizeInfo,
|
|
@@ -19,19 +18,21 @@ import {
|
|
|
19
18
|
} from '@tldraw/editor'
|
|
20
19
|
import { TestEditor } from './TestEditor'
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
w: number
|
|
27
|
-
h: number
|
|
21
|
+
const CIRCLE_CLIP_TYPE = 'circle-clip'
|
|
22
|
+
|
|
23
|
+
declare module '@tldraw/tlschema' {
|
|
24
|
+
export interface TLGlobalShapePropsMap {
|
|
25
|
+
[CIRCLE_CLIP_TYPE]: { w: number; h: number }
|
|
28
26
|
}
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Custom Circle Clip Shape Definition
|
|
30
|
+
export type CircleClipShape = TLShape<typeof CIRCLE_CLIP_TYPE>
|
|
30
31
|
|
|
31
32
|
export const isClippingEnabled$ = atom('isClippingEnabled', true)
|
|
32
33
|
|
|
33
34
|
export class CircleClipShapeUtil extends BaseBoxShapeUtil<CircleClipShape> {
|
|
34
|
-
static override type =
|
|
35
|
+
static override type = CIRCLE_CLIP_TYPE
|
|
35
36
|
static override props: RecordProps<CircleClipShape> = {
|
|
36
37
|
w: T.number,
|
|
37
38
|
h: T.number,
|
|
@@ -113,8 +114,8 @@ export class CircleClipShapeTool extends StateNode {
|
|
|
113
114
|
if (info.target === 'canvas') {
|
|
114
115
|
const { originPagePoint } = this.editor.inputs
|
|
115
116
|
|
|
116
|
-
this.editor.createShape
|
|
117
|
-
type:
|
|
117
|
+
this.editor.createShape({
|
|
118
|
+
type: CIRCLE_CLIP_TYPE,
|
|
118
119
|
x: originPagePoint.x - 100,
|
|
119
120
|
y: originPagePoint.y - 100,
|
|
120
121
|
props: {
|
|
@@ -153,9 +154,9 @@ beforeEach(() => {
|
|
|
153
154
|
describe('CircleClipShapeUtil', () => {
|
|
154
155
|
describe('shape creation and properties', () => {
|
|
155
156
|
it('should create a circle clip shape with default properties', () => {
|
|
156
|
-
editor.createShape
|
|
157
|
+
editor.createShape({
|
|
157
158
|
id: ids.circleClip1,
|
|
158
|
-
type:
|
|
159
|
+
type: CIRCLE_CLIP_TYPE,
|
|
159
160
|
x: 100,
|
|
160
161
|
y: 100,
|
|
161
162
|
props: {
|
|
@@ -172,9 +173,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
172
173
|
})
|
|
173
174
|
|
|
174
175
|
it('should use default props when not specified', () => {
|
|
175
|
-
editor.createShape
|
|
176
|
+
editor.createShape({
|
|
176
177
|
id: ids.circleClip1,
|
|
177
|
-
type:
|
|
178
|
+
type: CIRCLE_CLIP_TYPE,
|
|
178
179
|
x: 100,
|
|
179
180
|
y: 100,
|
|
180
181
|
props: {},
|
|
@@ -188,9 +189,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
188
189
|
|
|
189
190
|
describe('geometry and clipping', () => {
|
|
190
191
|
it('should generate correct circle geometry', () => {
|
|
191
|
-
editor.createShape
|
|
192
|
+
editor.createShape({
|
|
192
193
|
id: ids.circleClip1,
|
|
193
|
-
type:
|
|
194
|
+
type: CIRCLE_CLIP_TYPE,
|
|
194
195
|
x: 100,
|
|
195
196
|
y: 100,
|
|
196
197
|
props: {
|
|
@@ -210,9 +211,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
210
211
|
})
|
|
211
212
|
|
|
212
213
|
it('should generate clip path for circle', () => {
|
|
213
|
-
editor.createShape
|
|
214
|
+
editor.createShape({
|
|
214
215
|
id: ids.circleClip1,
|
|
215
|
-
type:
|
|
216
|
+
type: CIRCLE_CLIP_TYPE,
|
|
216
217
|
x: 100,
|
|
217
218
|
y: 100,
|
|
218
219
|
props: {
|
|
@@ -245,9 +246,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
245
246
|
|
|
246
247
|
describe('child clipping behavior', () => {
|
|
247
248
|
it('should clip children when clipping is enabled', () => {
|
|
248
|
-
editor.createShape
|
|
249
|
+
editor.createShape({
|
|
249
250
|
id: ids.circleClip1,
|
|
250
|
-
type:
|
|
251
|
+
type: CIRCLE_CLIP_TYPE,
|
|
251
252
|
x: 100,
|
|
252
253
|
y: 100,
|
|
253
254
|
props: {
|
|
@@ -256,7 +257,7 @@ describe('CircleClipShapeUtil', () => {
|
|
|
256
257
|
},
|
|
257
258
|
})
|
|
258
259
|
|
|
259
|
-
editor.createShape
|
|
260
|
+
editor.createShape({
|
|
260
261
|
id: ids.text1,
|
|
261
262
|
type: 'text',
|
|
262
263
|
x: 0,
|
|
@@ -279,9 +280,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
279
280
|
it('should not clip children when clipping is disabled', () => {
|
|
280
281
|
isClippingEnabled$.set(false)
|
|
281
282
|
|
|
282
|
-
editor.createShape
|
|
283
|
+
editor.createShape({
|
|
283
284
|
id: ids.circleClip1,
|
|
284
|
-
type:
|
|
285
|
+
type: CIRCLE_CLIP_TYPE,
|
|
285
286
|
x: 100,
|
|
286
287
|
y: 100,
|
|
287
288
|
props: {
|
|
@@ -290,7 +291,7 @@ describe('CircleClipShapeUtil', () => {
|
|
|
290
291
|
},
|
|
291
292
|
})
|
|
292
293
|
|
|
293
|
-
editor.createShape
|
|
294
|
+
editor.createShape({
|
|
294
295
|
id: ids.text1,
|
|
295
296
|
type: 'text',
|
|
296
297
|
x: 0,
|
|
@@ -314,9 +315,9 @@ describe('CircleClipShapeUtil', () => {
|
|
|
314
315
|
describe('Integration tests', () => {
|
|
315
316
|
it('should create and manage circle clip shapes with children', () => {
|
|
316
317
|
// Create circle clip shape
|
|
317
|
-
editor.createShape
|
|
318
|
+
editor.createShape({
|
|
318
319
|
id: ids.circleClip1,
|
|
319
|
-
type:
|
|
320
|
+
type: CIRCLE_CLIP_TYPE,
|
|
320
321
|
x: 100,
|
|
321
322
|
y: 100,
|
|
322
323
|
props: {
|
|
@@ -326,7 +327,7 @@ describe('Integration tests', () => {
|
|
|
326
327
|
})
|
|
327
328
|
|
|
328
329
|
// Add text child
|
|
329
|
-
editor.createShape
|
|
330
|
+
editor.createShape({
|
|
330
331
|
id: ids.text1,
|
|
331
332
|
type: 'text',
|
|
332
333
|
x: 50,
|
|
@@ -338,7 +339,7 @@ describe('Integration tests', () => {
|
|
|
338
339
|
})
|
|
339
340
|
|
|
340
341
|
// Add geo child
|
|
341
|
-
editor.createShape
|
|
342
|
+
editor.createShape({
|
|
342
343
|
id: ids.geo1,
|
|
343
344
|
type: 'geo',
|
|
344
345
|
x: 150,
|
|
@@ -375,9 +376,9 @@ describe('Integration tests', () => {
|
|
|
375
376
|
|
|
376
377
|
it('should handle multiple circle clip shapes independently', () => {
|
|
377
378
|
// Create two circle clip shapes
|
|
378
|
-
editor.createShape
|
|
379
|
+
editor.createShape({
|
|
379
380
|
id: ids.circleClip1,
|
|
380
|
-
type:
|
|
381
|
+
type: CIRCLE_CLIP_TYPE,
|
|
381
382
|
x: 100,
|
|
382
383
|
y: 100,
|
|
383
384
|
props: {
|
|
@@ -386,9 +387,9 @@ describe('Integration tests', () => {
|
|
|
386
387
|
},
|
|
387
388
|
})
|
|
388
389
|
|
|
389
|
-
editor.createShape
|
|
390
|
+
editor.createShape({
|
|
390
391
|
id: ids.circleClip2,
|
|
391
|
-
type:
|
|
392
|
+
type: CIRCLE_CLIP_TYPE,
|
|
392
393
|
x: 400,
|
|
393
394
|
y: 100,
|
|
394
395
|
props: {
|
|
@@ -398,7 +399,7 @@ describe('Integration tests', () => {
|
|
|
398
399
|
})
|
|
399
400
|
|
|
400
401
|
// Add children to both
|
|
401
|
-
editor.createShape
|
|
402
|
+
editor.createShape({
|
|
402
403
|
id: ids.text1,
|
|
403
404
|
type: 'text',
|
|
404
405
|
x: 0,
|
|
@@ -409,7 +410,7 @@ describe('Integration tests', () => {
|
|
|
409
410
|
},
|
|
410
411
|
})
|
|
411
412
|
|
|
412
|
-
editor.createShape
|
|
413
|
+
editor.createShape({
|
|
413
414
|
id: ids.geo1,
|
|
414
415
|
type: 'text',
|
|
415
416
|
x: 0,
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
Polyline2d,
|
|
5
5
|
ShapeUtil,
|
|
6
6
|
TLAnyShapeUtilConstructor,
|
|
7
|
-
TLBaseShape,
|
|
8
7
|
TLHandle,
|
|
9
8
|
TLHandleDragInfo,
|
|
10
9
|
TLLineShape,
|
|
10
|
+
TLShape,
|
|
11
11
|
TLShapeId,
|
|
12
12
|
Vec,
|
|
13
13
|
VecModel,
|
|
@@ -16,13 +16,19 @@ import {
|
|
|
16
16
|
import { TestEditor } from './TestEditor'
|
|
17
17
|
import { TL } from './test-jsx'
|
|
18
18
|
|
|
19
|
+
const TEST1_TYPE = 'test1'
|
|
20
|
+
|
|
21
|
+
declare module '@tldraw/tlschema' {
|
|
22
|
+
export interface TLGlobalShapePropsMap {
|
|
23
|
+
[TEST1_TYPE]: { w: number; h: number; boundsSnapPoints: VecModel[] | null }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type Test1Shape = TLShape<typeof TEST1_TYPE>
|
|
28
|
+
|
|
19
29
|
describe('custom shape bounds snapping - translate', () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{ w: number; h: number; boundsSnapPoints: VecModel[] | null }
|
|
23
|
-
>
|
|
24
|
-
class TestShapeUtil extends BaseBoxShapeUtil<TestShape> {
|
|
25
|
-
static override type = 'test'
|
|
30
|
+
class TestShapeUtil extends BaseBoxShapeUtil<Test1Shape> {
|
|
31
|
+
static override type = TEST1_TYPE
|
|
26
32
|
override getDefaultProps() {
|
|
27
33
|
return { w: 100, h: 100, boundsSnapPoints: null }
|
|
28
34
|
}
|
|
@@ -32,7 +38,7 @@ describe('custom shape bounds snapping - translate', () => {
|
|
|
32
38
|
override indicator() {
|
|
33
39
|
throw new Error('Method not implemented.')
|
|
34
40
|
}
|
|
35
|
-
override getBoundsSnapGeometry(shape:
|
|
41
|
+
override getBoundsSnapGeometry(shape: Test1Shape) {
|
|
36
42
|
return {
|
|
37
43
|
points: shape.props.boundsSnapPoints ?? undefined,
|
|
38
44
|
}
|
|
@@ -46,14 +52,14 @@ describe('custom shape bounds snapping - translate', () => {
|
|
|
46
52
|
editor = new TestEditor({ shapeUtils })
|
|
47
53
|
ids = editor.createShapesFromJsx([
|
|
48
54
|
<TL.geo ref="box" x={0} y={0} w={100} h={100} />,
|
|
49
|
-
<TL.
|
|
55
|
+
<TL.test1 ref="test1" x={200} y={200} w={100} h={100} boundsSnapPoints={null} />,
|
|
50
56
|
])
|
|
51
57
|
})
|
|
52
58
|
|
|
53
59
|
describe('with default boundSnapPoints', () => {
|
|
54
60
|
test('normal snapping works with default boundSnapPoints when moving test shape', () => {
|
|
55
61
|
// start translating the test shape
|
|
56
|
-
editor.setSelectedShapes([ids.
|
|
62
|
+
editor.setSelectedShapes([ids.test1]).pointerDown(250, 250)
|
|
57
63
|
|
|
58
64
|
// move the left edge of the test shape to the right edge of the box shape - it should snap
|
|
59
65
|
editor.pointerMove(155, 250, undefined, { ctrlKey: true })
|
|
@@ -84,15 +90,15 @@ describe('custom shape bounds snapping - translate', () => {
|
|
|
84
90
|
|
|
85
91
|
describe('with only the center in boundSnapPoints', () => {
|
|
86
92
|
beforeEach(() => {
|
|
87
|
-
editor.updateShape
|
|
88
|
-
id: ids.
|
|
89
|
-
type:
|
|
93
|
+
editor.updateShape({
|
|
94
|
+
id: ids.test1,
|
|
95
|
+
type: TEST1_TYPE,
|
|
90
96
|
props: { boundsSnapPoints: [{ x: 50, y: 50 }] },
|
|
91
97
|
})
|
|
92
98
|
})
|
|
93
99
|
|
|
94
100
|
describe('when moving the test shape', () => {
|
|
95
|
-
beforeEach(() => editor.select(ids.
|
|
101
|
+
beforeEach(() => editor.select(ids.test1).pointerDown(250, 250))
|
|
96
102
|
|
|
97
103
|
test('does not snap its edges to the box edges', () => {
|
|
98
104
|
editor.pointerMove(155, 250, undefined, { ctrlKey: true })
|
|
@@ -126,15 +132,15 @@ describe('custom shape bounds snapping - translate', () => {
|
|
|
126
132
|
|
|
127
133
|
describe('with empty boundSnapPoints', () => {
|
|
128
134
|
beforeEach(() => {
|
|
129
|
-
editor.updateShape
|
|
130
|
-
id: ids.
|
|
131
|
-
type:
|
|
135
|
+
editor.updateShape({
|
|
136
|
+
id: ids.test1,
|
|
137
|
+
type: TEST1_TYPE,
|
|
132
138
|
props: { boundsSnapPoints: [] },
|
|
133
139
|
})
|
|
134
140
|
})
|
|
135
141
|
|
|
136
142
|
test('test shape does not snap to anything', () => {
|
|
137
|
-
editor.select(ids.
|
|
143
|
+
editor.select(ids.test1).pointerDown(250, 250)
|
|
138
144
|
|
|
139
145
|
// try to snap our left edge to the right edge of the box shape - it should not snap
|
|
140
146
|
editor.pointerMove(155, 250, undefined, { ctrlKey: true })
|
|
@@ -163,10 +169,11 @@ describe('custom shape bounds snapping - translate', () => {
|
|
|
163
169
|
})
|
|
164
170
|
})
|
|
165
171
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
const TEST2_TYPE = 'test2'
|
|
173
|
+
|
|
174
|
+
declare module '@tldraw/tlschema' {
|
|
175
|
+
export interface TLGlobalShapePropsMap {
|
|
176
|
+
[TEST2_TYPE]: {
|
|
170
177
|
w: number
|
|
171
178
|
h: number
|
|
172
179
|
ownHandle: VecModel
|
|
@@ -176,10 +183,15 @@ describe('custom handle snapping', () => {
|
|
|
176
183
|
selfSnapPoints: VecModel[] | 'default'
|
|
177
184
|
handleSnapType?: 'point' | 'align'
|
|
178
185
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type Test2Shape = TLShape<typeof TEST2_TYPE>
|
|
190
|
+
|
|
191
|
+
describe('custom handle snapping', () => {
|
|
192
|
+
class TestShapeUtil extends BaseBoxShapeUtil<Test2Shape> {
|
|
193
|
+
static override type = TEST2_TYPE
|
|
194
|
+
override getDefaultProps(): Test2Shape['props'] {
|
|
183
195
|
return {
|
|
184
196
|
w: 100,
|
|
185
197
|
h: 100,
|
|
@@ -196,7 +208,7 @@ describe('custom handle snapping', () => {
|
|
|
196
208
|
override indicator() {
|
|
197
209
|
throw new Error('Method not implemented.')
|
|
198
210
|
}
|
|
199
|
-
override getHandleSnapGeometry(shape:
|
|
211
|
+
override getHandleSnapGeometry(shape: Test2Shape) {
|
|
200
212
|
const { handleOutline, handlePoints, selfSnapOutline, selfSnapPoints } = shape.props
|
|
201
213
|
return {
|
|
202
214
|
outline:
|
|
@@ -214,7 +226,7 @@ describe('custom handle snapping', () => {
|
|
|
214
226
|
getSelfSnapPoints: selfSnapPoints === 'default' ? undefined : () => selfSnapPoints,
|
|
215
227
|
}
|
|
216
228
|
}
|
|
217
|
-
override getHandles(shape:
|
|
229
|
+
override getHandles(shape: Test2Shape): TLHandle[] {
|
|
218
230
|
const handle: TLHandle = {
|
|
219
231
|
id: 'handle',
|
|
220
232
|
label: 'handle',
|
|
@@ -233,7 +245,7 @@ describe('custom handle snapping', () => {
|
|
|
233
245
|
|
|
234
246
|
return [handle]
|
|
235
247
|
}
|
|
236
|
-
override onHandleDrag(shape:
|
|
248
|
+
override onHandleDrag(shape: Test2Shape, { handle }: TLHandleDragInfo<Test2Shape>) {
|
|
237
249
|
return { ...shape, props: { ...shape.props, ownHandle: { x: handle.x, y: handle.y } } }
|
|
238
250
|
}
|
|
239
251
|
}
|
|
@@ -253,7 +265,7 @@ describe('custom handle snapping', () => {
|
|
|
253
265
|
a2: { id: 'a2', index: 'a2' as IndexKey, x: 100, y: 100 },
|
|
254
266
|
}}
|
|
255
267
|
/>,
|
|
256
|
-
<TL.
|
|
268
|
+
<TL.test2 ref="test2" x={200} y={200} w={100} h={100} />,
|
|
257
269
|
])
|
|
258
270
|
})
|
|
259
271
|
|
|
@@ -296,9 +308,9 @@ describe('custom handle snapping', () => {
|
|
|
296
308
|
|
|
297
309
|
describe('with empty handleSnapGeometry.outline', () => {
|
|
298
310
|
beforeEach(() => {
|
|
299
|
-
editor.updateShape
|
|
300
|
-
id: ids.
|
|
301
|
-
type:
|
|
311
|
+
editor.updateShape({
|
|
312
|
+
id: ids.test2,
|
|
313
|
+
type: TEST2_TYPE,
|
|
302
314
|
props: { handleOutline: null },
|
|
303
315
|
})
|
|
304
316
|
})
|
|
@@ -313,9 +325,9 @@ describe('custom handle snapping', () => {
|
|
|
313
325
|
|
|
314
326
|
describe('with custom handleSnapGeometry.outline', () => {
|
|
315
327
|
beforeEach(() => {
|
|
316
|
-
editor.updateShape
|
|
317
|
-
id: ids.
|
|
318
|
-
type:
|
|
328
|
+
editor.updateShape({
|
|
329
|
+
id: ids.test2,
|
|
330
|
+
type: TEST2_TYPE,
|
|
319
331
|
props: {
|
|
320
332
|
// a diagonal line from the top left to the bottom right
|
|
321
333
|
handleOutline: [
|
|
@@ -360,9 +372,9 @@ describe('custom handle snapping', () => {
|
|
|
360
372
|
|
|
361
373
|
describe('with custom handleSnapGeometry.points', () => {
|
|
362
374
|
beforeEach(() => {
|
|
363
|
-
editor.updateShape
|
|
364
|
-
id: ids.
|
|
365
|
-
type:
|
|
375
|
+
editor.updateShape({
|
|
376
|
+
id: ids.test2,
|
|
377
|
+
type: TEST2_TYPE,
|
|
366
378
|
props: {
|
|
367
379
|
handlePoints: [
|
|
368
380
|
{ x: 30, y: 30 },
|
|
@@ -387,12 +399,12 @@ describe('custom handle snapping', () => {
|
|
|
387
399
|
|
|
388
400
|
describe('with custom handleSnapGeometry.points along the outline', () => {
|
|
389
401
|
beforeEach(() => {
|
|
390
|
-
editor.updateShape
|
|
391
|
-
id: ids.
|
|
392
|
-
type:
|
|
402
|
+
editor.updateShape({
|
|
403
|
+
id: ids.test2,
|
|
404
|
+
type: TEST2_TYPE,
|
|
393
405
|
props: {
|
|
394
406
|
handlePoints: editor
|
|
395
|
-
.getShapeGeometry(ids.
|
|
407
|
+
.getShapeGeometry(ids.test2)
|
|
396
408
|
.bounds.cornersAndCenter.map(({ x, y }) => ({ x, y })),
|
|
397
409
|
},
|
|
398
410
|
})
|
|
@@ -426,9 +438,9 @@ describe('custom handle snapping', () => {
|
|
|
426
438
|
describe('self snapping', () => {
|
|
427
439
|
beforeEach(() => {
|
|
428
440
|
editor.deleteShape(ids.line)
|
|
429
|
-
editor.updateShape
|
|
430
|
-
id: ids.
|
|
431
|
-
type:
|
|
441
|
+
editor.updateShape({
|
|
442
|
+
id: ids.test2,
|
|
443
|
+
type: TEST2_TYPE,
|
|
432
444
|
x: 0,
|
|
433
445
|
y: 0,
|
|
434
446
|
props: {
|
|
@@ -437,12 +449,12 @@ describe('custom handle snapping', () => {
|
|
|
437
449
|
})
|
|
438
450
|
})
|
|
439
451
|
function startDraggingOwnHandle() {
|
|
440
|
-
const shape = editor.select(ids.
|
|
452
|
+
const shape = editor.select(ids.test2).getOnlySelectedShape()!
|
|
441
453
|
const handles = editor.getShapeHandles(shape)!
|
|
442
454
|
editor.pointerDown(0, 0, { target: 'handle', shape, handle: handles[0] })
|
|
443
455
|
}
|
|
444
456
|
function ownHandlePosition() {
|
|
445
|
-
const shape = editor.select(ids.
|
|
457
|
+
const shape = editor.select(ids.test2).getOnlySelectedShape()!
|
|
446
458
|
const handle = editor.getShapeHandles(shape)![0]
|
|
447
459
|
return { x: handle.x, y: handle.y }
|
|
448
460
|
}
|
|
@@ -462,9 +474,9 @@ describe('custom handle snapping', () => {
|
|
|
462
474
|
})
|
|
463
475
|
describe('with custom self snap outline & points', () => {
|
|
464
476
|
beforeEach(() => {
|
|
465
|
-
editor.updateShape
|
|
466
|
-
id: ids.
|
|
467
|
-
type:
|
|
477
|
+
editor.updateShape({
|
|
478
|
+
id: ids.test2,
|
|
479
|
+
type: TEST2_TYPE,
|
|
468
480
|
props: {
|
|
469
481
|
selfSnapOutline: [
|
|
470
482
|
{ x: 20, y: 50 },
|
|
@@ -506,9 +518,9 @@ describe('custom handle snapping', () => {
|
|
|
506
518
|
|
|
507
519
|
describe('with snapType set to align', () => {
|
|
508
520
|
beforeEach(() => {
|
|
509
|
-
editor.updateShape
|
|
510
|
-
id: ids.
|
|
511
|
-
type:
|
|
521
|
+
editor.updateShape({
|
|
522
|
+
id: ids.test2,
|
|
523
|
+
type: TEST2_TYPE,
|
|
512
524
|
props: {
|
|
513
525
|
selfSnapPoints: [
|
|
514
526
|
{ x: 20, y: 50 },
|
|
@@ -543,19 +555,24 @@ describe('custom handle snapping', () => {
|
|
|
543
555
|
})
|
|
544
556
|
})
|
|
545
557
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
558
|
+
const BEZIER_TYPE = 'bezier'
|
|
559
|
+
|
|
560
|
+
declare module '@tldraw/tlschema' {
|
|
561
|
+
export interface TLGlobalShapePropsMap {
|
|
562
|
+
[BEZIER_TYPE]: {
|
|
550
563
|
start: VecModel
|
|
551
564
|
cp1: VecModel
|
|
552
565
|
cp2: VecModel
|
|
553
566
|
end: VecModel
|
|
554
567
|
}
|
|
555
|
-
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
type BezierShape = TLShape<typeof BEZIER_TYPE>
|
|
556
572
|
|
|
573
|
+
describe('custom adjacent handle for shift snapping', () => {
|
|
557
574
|
class BezierShapeUtil extends ShapeUtil<BezierShape> {
|
|
558
|
-
static override type =
|
|
575
|
+
static override type = BEZIER_TYPE
|
|
559
576
|
override getDefaultProps() {
|
|
560
577
|
return {
|
|
561
578
|
start: { x: 0, y: 0 },
|
|
@@ -632,8 +649,6 @@ describe('custom adjacent handle for shift snapping', () => {
|
|
|
632
649
|
ref="bezier"
|
|
633
650
|
x={0}
|
|
634
651
|
y={0}
|
|
635
|
-
w={100}
|
|
636
|
-
h={100}
|
|
637
652
|
start={{ x: 0, y: 0 }}
|
|
638
653
|
cp1={{ x: 50, y: 0 }}
|
|
639
654
|
cp2={{ x: 50, y: 100 }}
|
|
@@ -295,7 +295,7 @@ describe('When duplicating shapes that include arrows', () => {
|
|
|
295
295
|
.select(
|
|
296
296
|
...editor
|
|
297
297
|
.getCurrentPageShapes()
|
|
298
|
-
.filter((s) => editor.isShapeOfType
|
|
298
|
+
.filter((s) => editor.isShapeOfType(s, 'arrow'))
|
|
299
299
|
.map((s) => s.id)
|
|
300
300
|
)
|
|
301
301
|
|
package/src/test/frames.test.ts
CHANGED
|
@@ -1363,13 +1363,13 @@ describe('Unparenting behavior', () => {
|
|
|
1363
1363
|
|
|
1364
1364
|
// When the shape has a fill, it should not fall out of the frame
|
|
1365
1365
|
editor.undo()
|
|
1366
|
-
editor.updateShape
|
|
1366
|
+
editor.updateShape({ ...largeRect, props: { fill: 'solid' } })
|
|
1367
1367
|
dragOntoFrame()
|
|
1368
1368
|
expect(editor.getShape(largeRect.id)!.parentId).toBe(frameId)
|
|
1369
1369
|
|
|
1370
1370
|
// When the shape has a label and that label is on top of the frame, it should not fall out of the frame
|
|
1371
1371
|
editor.undo()
|
|
1372
|
-
editor.updateShape
|
|
1372
|
+
editor.updateShape({
|
|
1373
1373
|
...largeRect,
|
|
1374
1374
|
props: { fill: 'none', richText: toRichText('hello') },
|
|
1375
1375
|
})
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Box,
|
|
4
4
|
RecordProps,
|
|
5
5
|
T,
|
|
6
|
-
|
|
6
|
+
TLShape,
|
|
7
7
|
TLShapeId,
|
|
8
8
|
createShapeId,
|
|
9
9
|
} from '@tldraw/editor'
|
|
@@ -11,11 +11,19 @@ import { vi } from 'vitest'
|
|
|
11
11
|
import { TestEditor } from './TestEditor'
|
|
12
12
|
import { TL } from './test-jsx'
|
|
13
13
|
|
|
14
|
+
const UNCULLABLE_TYPE = 'uncullable'
|
|
15
|
+
|
|
16
|
+
declare module '@tldraw/tlschema' {
|
|
17
|
+
export interface TLGlobalShapePropsMap {
|
|
18
|
+
[UNCULLABLE_TYPE]: { w: number; h: number }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
// Custom uncullable shape type for testing canCull override
|
|
15
|
-
type UncullableShape =
|
|
23
|
+
type UncullableShape = TLShape<typeof UNCULLABLE_TYPE>
|
|
16
24
|
|
|
17
25
|
class UncullableShapeUtil extends BaseBoxShapeUtil<UncullableShape> {
|
|
18
|
-
static override type =
|
|
26
|
+
static override type = UNCULLABLE_TYPE
|
|
19
27
|
static override props: RecordProps<UncullableShape> = {
|
|
20
28
|
w: T.number,
|
|
21
29
|
h: T.number,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TLShape, createShapeId, toRichText } from '@tldraw/editor'
|
|
2
2
|
import { TestEditor } from './TestEditor'
|
|
3
3
|
|
|
4
4
|
let editor: TestEditor
|
|
@@ -146,7 +146,7 @@ describe('with hitLabels=true', () => {
|
|
|
146
146
|
it('hits geo shape label behind overlapping hollow shape', () => {
|
|
147
147
|
// label is empty
|
|
148
148
|
expect(editor.getShapeAtPoint({ x: 350, y: 350 }, opts)?.id).toBe(ids.box3)
|
|
149
|
-
editor.updateShape
|
|
149
|
+
editor.updateShape({
|
|
150
150
|
id: ids.box2,
|
|
151
151
|
type: 'geo',
|
|
152
152
|
props: { richText: toRichText('hello') },
|
package/src/test/groups.test.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Box,
|
|
3
|
+
ExtractShapeByProps,
|
|
3
4
|
GroupShapeUtil,
|
|
4
5
|
TLArrowShape,
|
|
5
6
|
TLGroupShape,
|
|
@@ -35,14 +36,16 @@ const ids = {
|
|
|
35
36
|
groupA: createShapeId('groupA'),
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
type BoxShape = ExtractShapeByProps<{ fill: string }>
|
|
40
|
+
|
|
38
41
|
const box = (
|
|
39
42
|
id: TLShapeId,
|
|
40
43
|
x: number,
|
|
41
44
|
y: number,
|
|
42
45
|
w = 10,
|
|
43
46
|
h = 10,
|
|
44
|
-
fill = 'solid'
|
|
45
|
-
): TLShapePartial => ({
|
|
47
|
+
fill: BoxShape['props']['fill'] = 'solid'
|
|
48
|
+
): TLShapePartial<BoxShape> => ({
|
|
46
49
|
type: 'geo',
|
|
47
50
|
id,
|
|
48
51
|
x,
|
|
@@ -1980,7 +1983,7 @@ describe('Group opacity', () => {
|
|
|
1980
1983
|
editor.setOpacityForNextShapes(0.5)
|
|
1981
1984
|
editor.groupShapes(editor.getSelectedShapeIds())
|
|
1982
1985
|
const group = editor.getShape(onlySelectedId())!
|
|
1983
|
-
assert(editor.isShapeOfType
|
|
1986
|
+
assert(editor.isShapeOfType(group, 'group'))
|
|
1984
1987
|
expect(group.opacity).toBe(1)
|
|
1985
1988
|
})
|
|
1986
1989
|
})
|