@bigbluebutton/tldraw 2.0.0-alpha.24 → 2.0.0-alpha.25
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 +9 -1
- package/dist-cjs/lib/defaultShapeUtils.js +3 -1
- package/dist-cjs/lib/defaultShapeUtils.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/poll/PollShapeTool.js +30 -0
- package/dist-cjs/lib/shapes/poll/PollShapeTool.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/PollShapeUtil.js +121 -0
- package/dist-cjs/lib/shapes/poll/PollShapeUtil.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/components/poll-content.js +101 -0
- package/dist-cjs/lib/shapes/poll/components/poll-content.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/components/styles.js +53 -0
- package/dist-cjs/lib/shapes/poll/components/styles.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-migrations.js +45 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-migrations.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-props.js +39 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-props.js.map +7 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-types.js +17 -0
- package/dist-cjs/lib/shapes/poll/poll-shape-types.js.map +7 -0
- package/dist-cjs/lib/tools/HandTool/HandTool.js +3 -3
- package/dist-cjs/lib/tools/HandTool/HandTool.js.map +2 -2
- package/dist-cjs/lib/ui/components/ContextMenu.js +0 -1
- package/dist-cjs/lib/ui/components/ContextMenu.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +6 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-esm/index.d.mts +9 -1
- package/dist-esm/lib/defaultShapeUtils.mjs +3 -1
- package/dist-esm/lib/defaultShapeUtils.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/poll/PollShapeTool.mjs +10 -0
- package/dist-esm/lib/shapes/poll/PollShapeTool.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/PollShapeUtil.mjs +97 -0
- package/dist-esm/lib/shapes/poll/PollShapeUtil.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/components/poll-content.mjs +71 -0
- package/dist-esm/lib/shapes/poll/components/poll-content.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/components/styles.mjs +23 -0
- package/dist-esm/lib/shapes/poll/components/styles.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/poll-shape-migrations.mjs +25 -0
- package/dist-esm/lib/shapes/poll/poll-shape-migrations.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/poll-shape-props.mjs +19 -0
- package/dist-esm/lib/shapes/poll/poll-shape-props.mjs.map +7 -0
- package/dist-esm/lib/shapes/poll/poll-shape-types.mjs +1 -0
- package/dist-esm/lib/shapes/poll/poll-shape-types.mjs.map +7 -0
- package/dist-esm/lib/tools/HandTool/HandTool.mjs +3 -3
- package/dist-esm/lib/tools/HandTool/HandTool.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ContextMenu.mjs +0 -1
- package/dist-esm/lib/ui/components/ContextMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +6 -1
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/package.json +4 -3
- package/src/lib/Tldraw.test.tsx +9 -13
- package/src/lib/defaultShapeUtils.ts +2 -0
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +1 -1
- package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.ts.snap +6 -6
- package/src/lib/shapes/poll/PollShapeTool.tsx +7 -0
- package/src/lib/shapes/poll/PollShapeUtil.tsx +108 -0
- package/src/lib/shapes/poll/components/poll-content.tsx +100 -0
- package/src/lib/shapes/poll/components/styles.ts +21 -0
- package/src/lib/shapes/poll/poll-shape-migrations.ts +23 -0
- package/src/lib/shapes/poll/poll-shape-props.ts +17 -0
- package/src/lib/shapes/poll/poll-shape-types.ts +21 -0
- package/src/lib/tools/HandTool/HandTool.ts +4 -5
- package/src/lib/ui/components/ContextMenu.tsx +1 -1
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +5 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +5 -0
- package/src/test/Editor.test.tsx +2 -2
- package/src/test/HandTool.test.ts +55 -56
- package/src/test/TLSessionStateSnapshot.test.ts +5 -5
- package/src/test/TestEditor.ts +4 -1
- package/src/test/TldrawEditor.test.tsx +28 -30
- package/src/test/__snapshots__/resizing.test.ts.snap +8 -8
- package/src/test/commands/__snapshots__/packShapes.test.ts.snap +20 -20
- package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
- package/src/test/commands/createShapes.test.ts +1 -1
- package/src/test/commands/putContent.test.ts +4 -4
- package/src/test/commands/updateShapes.test.ts +1 -1
- package/src/test/resizing.test.ts +203 -203
- package/src/test/selection-omnibus.test.ts +41 -41
- package/src/test/test-jsx.tsx +7 -3
- package/src/test/translating.test.ts +42 -42
|
@@ -1122,10 +1122,10 @@ describe('snapping while resizing', () => {
|
|
|
1122
1122
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 81, props: { w: 80, h: 59 } })
|
|
1123
1123
|
|
|
1124
1124
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1125
|
+
[
|
|
1126
|
+
"60,0 60,40 60,81 60,140 60,180 60,220",
|
|
1127
|
+
]
|
|
1128
|
+
`)
|
|
1129
1129
|
|
|
1130
1130
|
// snap to top edges of B and D
|
|
1131
1131
|
//
|
|
@@ -1159,10 +1159,10 @@ describe('snapping while resizing', () => {
|
|
|
1159
1159
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 81, y: 60, props: { w: 59, h: 80 } })
|
|
1160
1160
|
|
|
1161
1161
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1162
|
+
[
|
|
1163
|
+
"0,60 40,60 81,60 140,60 180,60 220,60",
|
|
1164
|
+
]
|
|
1165
|
+
`)
|
|
1166
1166
|
|
|
1167
1167
|
// sanp to both at the same time
|
|
1168
1168
|
// x ┌────────────────────┐
|
|
@@ -1195,11 +1195,11 @@ describe('snapping while resizing', () => {
|
|
|
1195
1195
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 60, props: { w: 80, h: 80 } })
|
|
1196
1196
|
|
|
1197
1197
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1198
|
+
[
|
|
1199
|
+
"0,60 40,60 60,60 140,60 180,60 220,60",
|
|
1200
|
+
"60,0 60,40 60,60 60,140 60,180 60,220",
|
|
1201
|
+
]
|
|
1202
|
+
`)
|
|
1203
1203
|
})
|
|
1204
1204
|
it('works for dragging the top right corner', () => {
|
|
1205
1205
|
// ┌────────────────────┐ x
|
|
@@ -1359,11 +1359,11 @@ describe('snapping while resizing from center', () => {
|
|
|
1359
1359
|
props: { w: 60, h: 100 },
|
|
1360
1360
|
})
|
|
1361
1361
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1362
|
+
[
|
|
1363
|
+
"40,120 60,120 80,120 100,120",
|
|
1364
|
+
"40,20 60,20 80,20 100,20",
|
|
1365
|
+
]
|
|
1366
|
+
`)
|
|
1367
1367
|
})
|
|
1368
1368
|
it('should work from the right', () => {
|
|
1369
1369
|
editor
|
|
@@ -1442,11 +1442,11 @@ describe('snapping while resizing from center', () => {
|
|
|
1442
1442
|
props: { w: 100, h: 60 },
|
|
1443
1443
|
})
|
|
1444
1444
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1445
|
+
[
|
|
1446
|
+
"120,40 120,60 120,80 120,100",
|
|
1447
|
+
"20,40 20,60 20,80 20,100",
|
|
1448
|
+
]
|
|
1449
|
+
`)
|
|
1450
1450
|
// 0 20 40 60 80 100 120 140
|
|
1451
1451
|
// 0 ┌───┐
|
|
1452
1452
|
// │ A │
|
|
@@ -1472,13 +1472,13 @@ describe('snapping while resizing from center', () => {
|
|
|
1472
1472
|
})
|
|
1473
1473
|
|
|
1474
1474
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1475
|
+
[
|
|
1476
|
+
"120,20 120,60 120,80 120,120",
|
|
1477
|
+
"20,120 60,120 80,120 120,120",
|
|
1478
|
+
"20,20 20,60 20,80 20,120",
|
|
1479
|
+
"20,20 60,20 80,20 120,20",
|
|
1480
|
+
]
|
|
1481
|
+
`)
|
|
1482
1482
|
})
|
|
1483
1483
|
it('should work from the bottom right', () => {
|
|
1484
1484
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1512,11 +1512,11 @@ describe('snapping while resizing from center', () => {
|
|
|
1512
1512
|
})
|
|
1513
1513
|
|
|
1514
1514
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1515
|
+
[
|
|
1516
|
+
"120,40 120,60 120,80 120,100",
|
|
1517
|
+
"20,40 20,60 20,80 20,100",
|
|
1518
|
+
]
|
|
1519
|
+
`)
|
|
1520
1520
|
|
|
1521
1521
|
// 0 20 40 60 80 100 120 140
|
|
1522
1522
|
// 0 ┌───┐
|
|
@@ -1543,13 +1543,13 @@ describe('snapping while resizing from center', () => {
|
|
|
1543
1543
|
})
|
|
1544
1544
|
|
|
1545
1545
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1546
|
+
[
|
|
1547
|
+
"120,20 120,60 120,80 120,120",
|
|
1548
|
+
"20,120 60,120 80,120 120,120",
|
|
1549
|
+
"20,20 20,60 20,80 20,120",
|
|
1550
|
+
"20,20 60,20 80,20 120,20",
|
|
1551
|
+
]
|
|
1552
|
+
`)
|
|
1553
1553
|
})
|
|
1554
1554
|
it('should work from the bottom left', () => {
|
|
1555
1555
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1583,11 +1583,11 @@ describe('snapping while resizing from center', () => {
|
|
|
1583
1583
|
})
|
|
1584
1584
|
|
|
1585
1585
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1586
|
+
[
|
|
1587
|
+
"120,40 120,60 120,80 120,100",
|
|
1588
|
+
"20,40 20,60 20,80 20,100",
|
|
1589
|
+
]
|
|
1590
|
+
`)
|
|
1591
1591
|
|
|
1592
1592
|
// 0 20 40 60 80 100 120 140
|
|
1593
1593
|
// 0 ┌───┐
|
|
@@ -1614,13 +1614,13 @@ describe('snapping while resizing from center', () => {
|
|
|
1614
1614
|
})
|
|
1615
1615
|
|
|
1616
1616
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1617
|
+
[
|
|
1618
|
+
"120,20 120,60 120,80 120,120",
|
|
1619
|
+
"20,120 60,120 80,120 120,120",
|
|
1620
|
+
"20,20 20,60 20,80 20,120",
|
|
1621
|
+
"20,20 60,20 80,20 120,20",
|
|
1622
|
+
]
|
|
1623
|
+
`)
|
|
1624
1624
|
})
|
|
1625
1625
|
it('should work from the top left', () => {
|
|
1626
1626
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1654,11 +1654,11 @@ describe('snapping while resizing from center', () => {
|
|
|
1654
1654
|
})
|
|
1655
1655
|
|
|
1656
1656
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1657
|
+
[
|
|
1658
|
+
"120,40 120,60 120,80 120,100",
|
|
1659
|
+
"20,40 20,60 20,80 20,100",
|
|
1660
|
+
]
|
|
1661
|
+
`)
|
|
1662
1662
|
|
|
1663
1663
|
// 0 20 40 60 80 100 120 140
|
|
1664
1664
|
// 0 ┌───┐
|
|
@@ -1685,13 +1685,13 @@ describe('snapping while resizing from center', () => {
|
|
|
1685
1685
|
})
|
|
1686
1686
|
|
|
1687
1687
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1688
|
+
[
|
|
1689
|
+
"120,20 120,60 120,80 120,120",
|
|
1690
|
+
"20,120 60,120 80,120 120,120",
|
|
1691
|
+
"20,20 20,60 20,80 20,120",
|
|
1692
|
+
"20,20 60,20 80,20 120,20",
|
|
1693
|
+
]
|
|
1694
|
+
`)
|
|
1695
1695
|
})
|
|
1696
1696
|
})
|
|
1697
1697
|
|
|
@@ -1749,10 +1749,10 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1749
1749
|
|
|
1750
1750
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 20, props: { w: 80, h: 80 } })
|
|
1751
1751
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1752
|
+
[
|
|
1753
|
+
"30,20 60,20 80,20 110,20",
|
|
1754
|
+
]
|
|
1755
|
+
`)
|
|
1756
1756
|
})
|
|
1757
1757
|
|
|
1758
1758
|
it('should work from the right', () => {
|
|
@@ -1783,10 +1783,10 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1783
1783
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 30, props: { w: 80, h: 80 } })
|
|
1784
1784
|
|
|
1785
1785
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1786
|
+
[
|
|
1787
|
+
"120,30 120,60 120,80 120,110",
|
|
1788
|
+
]
|
|
1789
|
+
`)
|
|
1790
1790
|
})
|
|
1791
1791
|
|
|
1792
1792
|
it('should work from the bottom', () => {
|
|
@@ -1817,10 +1817,10 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1817
1817
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 40, props: { w: 80, h: 80 } })
|
|
1818
1818
|
|
|
1819
1819
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1820
|
+
[
|
|
1821
|
+
"30,120 60,120 80,120 110,120",
|
|
1822
|
+
]
|
|
1823
|
+
`)
|
|
1824
1824
|
})
|
|
1825
1825
|
it('should work from the left', () => {
|
|
1826
1826
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1851,10 +1851,10 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1851
1851
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 30, props: { w: 80, h: 80 } })
|
|
1852
1852
|
|
|
1853
1853
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1854
|
+
[
|
|
1855
|
+
"20,30 20,60 20,80 20,110",
|
|
1856
|
+
]
|
|
1857
|
+
`)
|
|
1858
1858
|
})
|
|
1859
1859
|
it('should work from the top right', () => {
|
|
1860
1860
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1884,11 +1884,11 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1884
1884
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 20, props: { w: 80, h: 80 } })
|
|
1885
1885
|
|
|
1886
1886
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1887
|
+
[
|
|
1888
|
+
"120,20 120,60 120,80 120,100",
|
|
1889
|
+
"40,20 60,20 80,20 120,20",
|
|
1890
|
+
]
|
|
1891
|
+
`)
|
|
1892
1892
|
})
|
|
1893
1893
|
it('should work from the bottom right', () => {
|
|
1894
1894
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1918,11 +1918,11 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1918
1918
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 40, props: { w: 80, h: 80 } })
|
|
1919
1919
|
|
|
1920
1920
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1921
|
+
[
|
|
1922
|
+
"120,40 120,60 120,80 120,120",
|
|
1923
|
+
"40,120 60,120 80,120 120,120",
|
|
1924
|
+
]
|
|
1925
|
+
`)
|
|
1926
1926
|
})
|
|
1927
1927
|
it('should work from the bottom left', () => {
|
|
1928
1928
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1952,11 +1952,11 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1952
1952
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 40, props: { w: 80, h: 80 } })
|
|
1953
1953
|
|
|
1954
1954
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1955
|
+
[
|
|
1956
|
+
"20,120 60,120 80,120 100,120",
|
|
1957
|
+
"20,40 20,60 20,80 20,120",
|
|
1958
|
+
]
|
|
1959
|
+
`)
|
|
1960
1960
|
})
|
|
1961
1961
|
it('should work from the top left', () => {
|
|
1962
1962
|
// 0 20 40 60 80 100 120 140
|
|
@@ -1986,11 +1986,11 @@ describe('snapping while resizing with aspect ratio locked', () => {
|
|
|
1986
1986
|
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 20, props: { w: 80, h: 80 } })
|
|
1987
1987
|
|
|
1988
1988
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1989
|
+
[
|
|
1990
|
+
"20,20 20,60 20,80 20,100",
|
|
1991
|
+
"20,20 60,20 80,20 100,20",
|
|
1992
|
+
]
|
|
1993
|
+
`)
|
|
1994
1994
|
})
|
|
1995
1995
|
})
|
|
1996
1996
|
|
|
@@ -2373,10 +2373,10 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2373
2373
|
h: 60,
|
|
2374
2374
|
})
|
|
2375
2375
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2376
|
+
[
|
|
2377
|
+
"120,40 120,60 120,80 120,100",
|
|
2378
|
+
]
|
|
2379
|
+
`)
|
|
2380
2380
|
|
|
2381
2381
|
// 0 20 40 60 80 100 120 140
|
|
2382
2382
|
// 0 ┌───┐
|
|
@@ -2403,11 +2403,11 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2403
2403
|
h: 60,
|
|
2404
2404
|
})
|
|
2405
2405
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2406
|
+
[
|
|
2407
|
+
"120,40 120,60 120,80 120,100",
|
|
2408
|
+
"20,40 20,60 20,80 20,100",
|
|
2409
|
+
]
|
|
2410
|
+
`)
|
|
2411
2411
|
})
|
|
2412
2412
|
it('should work for 180', () => {
|
|
2413
2413
|
rotateX(2)
|
|
@@ -2440,10 +2440,10 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2440
2440
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
|
|
2441
2441
|
|
|
2442
2442
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2443
|
+
[
|
|
2444
|
+
"40,20 60,20 80,20 100,20",
|
|
2445
|
+
]
|
|
2446
|
+
`)
|
|
2447
2447
|
|
|
2448
2448
|
// 0 20 40 60 80 100 120 140
|
|
2449
2449
|
// 0 ┌───┐
|
|
@@ -2468,10 +2468,10 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2468
2468
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
|
|
2469
2469
|
|
|
2470
2470
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2471
|
+
[
|
|
2472
|
+
"30,20 60,20 80,20 110,20",
|
|
2473
|
+
]
|
|
2474
|
+
`)
|
|
2475
2475
|
})
|
|
2476
2476
|
it('should work for 270deg', () => {
|
|
2477
2477
|
rotateX(3)
|
|
@@ -2503,11 +2503,11 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2503
2503
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
|
|
2504
2504
|
|
|
2505
2505
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2506
|
+
[
|
|
2507
|
+
"20,120 60,120 80,120 100,120",
|
|
2508
|
+
"20,40 20,60 20,80 20,120",
|
|
2509
|
+
]
|
|
2510
|
+
`)
|
|
2511
2511
|
|
|
2512
2512
|
// 0 20 40 60 80 100 120 140
|
|
2513
2513
|
// 0 ┌───┐
|
|
@@ -2534,13 +2534,13 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2534
2534
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(100)
|
|
2535
2535
|
|
|
2536
2536
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2537
|
+
[
|
|
2538
|
+
"120,20 120,60 120,80 120,120",
|
|
2539
|
+
"20,120 60,120 80,120 120,120",
|
|
2540
|
+
"20,20 20,60 20,80 20,120",
|
|
2541
|
+
"20,20 60,20 80,20 120,20",
|
|
2542
|
+
]
|
|
2543
|
+
`)
|
|
2544
2544
|
})
|
|
2545
2545
|
it('should work for 360deg', () => {
|
|
2546
2546
|
rotateX(4)
|
|
@@ -2572,10 +2572,10 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2572
2572
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60)
|
|
2573
2573
|
|
|
2574
2574
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2575
|
+
[
|
|
2576
|
+
"120,40 120,60 120,80 120,100",
|
|
2577
|
+
]
|
|
2578
|
+
`)
|
|
2579
2579
|
|
|
2580
2580
|
// 0 20 40 60 80 100 120 140
|
|
2581
2581
|
// 0 ┌───┐
|
|
@@ -2601,11 +2601,11 @@ describe('snapping while resizing a shape that has been rotated by multiples of
|
|
|
2601
2601
|
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60)
|
|
2602
2602
|
|
|
2603
2603
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2604
|
+
[
|
|
2605
|
+
"120,40 120,60 120,80 120,100",
|
|
2606
|
+
"20,40 20,60 20,80 20,100",
|
|
2607
|
+
]
|
|
2608
|
+
`)
|
|
2609
2609
|
})
|
|
2610
2610
|
})
|
|
2611
2611
|
|
|
@@ -2669,10 +2669,10 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2669
2669
|
})
|
|
2670
2670
|
|
|
2671
2671
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2672
|
+
[
|
|
2673
|
+
"40,120 60,120 80,120 100,120",
|
|
2674
|
+
]
|
|
2675
|
+
`)
|
|
2676
2676
|
})
|
|
2677
2677
|
|
|
2678
2678
|
it('should work for the right edge', () => {
|
|
@@ -2708,10 +2708,10 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2708
2708
|
})
|
|
2709
2709
|
|
|
2710
2710
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2711
|
+
[
|
|
2712
|
+
"20,40 20,60 20,80 20,100",
|
|
2713
|
+
]
|
|
2714
|
+
`)
|
|
2715
2715
|
})
|
|
2716
2716
|
|
|
2717
2717
|
it('should work for the bottom edge', () => {
|
|
@@ -2747,10 +2747,10 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2747
2747
|
})
|
|
2748
2748
|
|
|
2749
2749
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2750
|
+
[
|
|
2751
|
+
"40,20 60,20 80,20 100,20",
|
|
2752
|
+
]
|
|
2753
|
+
`)
|
|
2754
2754
|
})
|
|
2755
2755
|
|
|
2756
2756
|
it('should work for the left edge', () => {
|
|
@@ -2785,10 +2785,10 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2785
2785
|
h: 60,
|
|
2786
2786
|
})
|
|
2787
2787
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2788
|
+
[
|
|
2789
|
+
"120,40 120,60 120,80 120,100",
|
|
2790
|
+
]
|
|
2791
|
+
`)
|
|
2792
2792
|
})
|
|
2793
2793
|
|
|
2794
2794
|
it('should work for the top right corner', () => {
|
|
@@ -2823,11 +2823,11 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2823
2823
|
h: 20,
|
|
2824
2824
|
})
|
|
2825
2825
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2826
|
+
[
|
|
2827
|
+
"20,120 40,120 60,120 80,120",
|
|
2828
|
+
"20,60 20,80 20,100 20,120",
|
|
2829
|
+
]
|
|
2830
|
+
`)
|
|
2831
2831
|
})
|
|
2832
2832
|
|
|
2833
2833
|
it('should work for the bottom right corner', () => {
|
|
@@ -2863,11 +2863,11 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2863
2863
|
h: 20,
|
|
2864
2864
|
})
|
|
2865
2865
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2866
|
+
[
|
|
2867
|
+
"20,20 20,40 20,60 20,80",
|
|
2868
|
+
"20,20 40,20 60,20 80,20",
|
|
2869
|
+
]
|
|
2870
|
+
`)
|
|
2871
2871
|
})
|
|
2872
2872
|
it('should work for the bototm left corner', () => {
|
|
2873
2873
|
// 0 20 40 60 80 100 120 140
|
|
@@ -2901,11 +2901,11 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2901
2901
|
h: 20,
|
|
2902
2902
|
})
|
|
2903
2903
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2904
|
+
[
|
|
2905
|
+
"120,20 120,40 120,60 120,80",
|
|
2906
|
+
"60,20 80,20 100,20 120,20",
|
|
2907
|
+
]
|
|
2908
|
+
`)
|
|
2909
2909
|
})
|
|
2910
2910
|
it('should work for the top left corner', () => {
|
|
2911
2911
|
// 0 20 40 60 80 100 120 140
|
|
@@ -2939,11 +2939,11 @@ describe('snapping while resizing an inverted shape', () => {
|
|
|
2939
2939
|
h: 20,
|
|
2940
2940
|
})
|
|
2941
2941
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2942
|
+
[
|
|
2943
|
+
"120,60 120,80 120,100 120,120",
|
|
2944
|
+
"60,120 80,120 100,120 120,120",
|
|
2945
|
+
]
|
|
2946
|
+
`)
|
|
2947
2947
|
})
|
|
2948
2948
|
})
|
|
2949
2949
|
|
|
@@ -2986,12 +2986,12 @@ describe('snapping while the grid is enabled', () => {
|
|
|
2986
2986
|
editor.keyDown('Control')
|
|
2987
2987
|
expect(editor.getShapePageBounds(ids.boxA)!.w).toEqual(60)
|
|
2988
2988
|
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2989
|
+
[
|
|
2990
|
+
"0,0 60,0 80,0",
|
|
2991
|
+
"0,20 60,20 80,20",
|
|
2992
|
+
"60,0 60,20",
|
|
2993
|
+
]
|
|
2994
|
+
`)
|
|
2995
2995
|
|
|
2996
2996
|
// and if not snapping we can make the box any size
|
|
2997
2997
|
editor.pointerMove(19, 10, { ctrlKey: true })
|
|
@@ -3900,24 +3900,24 @@ describe('Resizing text from the right edge', () => {
|
|
|
3900
3900
|
})
|
|
3901
3901
|
})
|
|
3902
3902
|
|
|
3903
|
-
describe('When resizing near the edges of the screen', () => {
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
})
|
|
3903
|
+
// describe('When resizing near the edges of the screen', () => {
|
|
3904
|
+
// it('resizes past the edge of the screen', () => {
|
|
3905
|
+
// editor.user.updateUserPreferences({ edgeScrollSpeed: 1 })
|
|
3906
|
+
// editor
|
|
3907
|
+
// .select(ids.boxA)
|
|
3908
|
+
// .pointerDown(10, 10, {
|
|
3909
|
+
// type: 'pointer',
|
|
3910
|
+
// target: 'selection',
|
|
3911
|
+
// handle: 'top_left',
|
|
3912
|
+
// })
|
|
3913
|
+
// .expectShapeToMatch({ id: ids.boxA, x: 10, y: 10, props: { w: 100, h: 100 } })
|
|
3914
|
+
// .pointerMove(10, 25)
|
|
3915
|
+
// jest.advanceTimersByTime(1000)
|
|
3916
|
+
// editor.expectShapeToMatch({
|
|
3917
|
+
// id: ids.boxA,
|
|
3918
|
+
// x: -842.5,
|
|
3919
|
+
// y: -259.58,
|
|
3920
|
+
// props: { w: 952.5, h: 369.58 },
|
|
3921
|
+
// })
|
|
3922
|
+
// })
|
|
3923
|
+
// })
|