tldraw 3.15.0 → 3.16.0-canary.0e0fb8bde89d
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 +101 -5
- package/dist-cjs/index.js +12 -2
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +1 -0
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +22 -36
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +16 -4
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +3 -0
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +15 -1
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +43 -22
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +2 -15
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +5 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +40 -0
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +1 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +149 -1
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +14 -7
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +76 -9
- package/dist-cjs/lib/ui/hooks/useTools.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 +4 -0
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +2 -1
- package/dist-cjs/lib/ui/kbd-utils.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 +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +3 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +101 -5
- package/dist-esm/index.mjs +18 -3
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +1 -0
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +24 -36
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +19 -5
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +3 -0
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +15 -1
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +43 -22
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +2 -15
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +5 -0
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +40 -0
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +1 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +157 -3
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +14 -7
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +83 -10
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +4 -0
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +2 -1
- package/dist-esm/lib/ui/kbd-utils.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 +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +3 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +3 -3
- package/src/index.ts +11 -1
- package/src/lib/canvas/TldrawCropHandles.tsx +2 -0
- package/src/lib/defaultExternalContentHandlers.ts +2 -1
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +25 -39
- package/src/lib/shapes/arrow/arrowLabel.ts +23 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +3 -0
- package/src/lib/shapes/line/LineShapeUtil.tsx +19 -2
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +54 -30
- package/src/lib/tools/SelectTool/childStates/Idle.ts +2 -24
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +7 -0
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +12 -1
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +11 -0
- package/src/lib/tools/SelectTool/childStates/Translating.ts +11 -1
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +1 -0
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +32 -0
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +3 -1
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +213 -2
- package/src/lib/ui/context/actions.tsx +14 -7
- package/src/lib/ui/context/events.tsx +3 -2
- package/src/lib/ui/hooks/menu-hooks.ts +1 -0
- package/src/lib/ui/hooks/useTools.tsx +118 -10
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +4 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +4 -0
- package/src/lib/ui/kbd-utils.ts +2 -1
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +16 -2
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +24 -3
- package/src/lib/utils/tldr/buildFromV1Document.ts +2 -1
- package/src/test/SelectTool.test.ts +37 -11
- package/src/test/commands/deletePage.test.ts +84 -1
- package/src/test/shapeutils.test.ts +394 -45
- package/tldraw.css +4 -23
|
@@ -32,12 +32,14 @@ import {
|
|
|
32
32
|
debugFlags,
|
|
33
33
|
exhaustiveSwitchError,
|
|
34
34
|
getDefaultColorTheme,
|
|
35
|
+
getFontsFromRichText,
|
|
35
36
|
invLerp,
|
|
36
37
|
lerp,
|
|
37
38
|
mapObjectMapValues,
|
|
38
39
|
maybeSnapToGrid,
|
|
39
40
|
structuredClone,
|
|
40
41
|
toDomPrecision,
|
|
42
|
+
toRichText,
|
|
41
43
|
track,
|
|
42
44
|
useEditor,
|
|
43
45
|
useIsEditing,
|
|
@@ -46,12 +48,11 @@ import {
|
|
|
46
48
|
} from '@tldraw/editor'
|
|
47
49
|
import React, { useMemo } from 'react'
|
|
48
50
|
import { updateArrowTerminal } from '../../bindings/arrow/ArrowBindingUtil'
|
|
51
|
+
import { isEmptyRichText, renderPlaintextFromRichText } from '../../utils/text/richText'
|
|
49
52
|
import { PathBuilder } from '../shared/PathBuilder'
|
|
50
|
-
import {
|
|
53
|
+
import { RichTextLabel, RichTextSVG } from '../shared/RichTextLabel'
|
|
51
54
|
import { ShapeFill } from '../shared/ShapeFill'
|
|
52
|
-
import { SvgTextLabel } from '../shared/SvgTextLabel'
|
|
53
55
|
import { ARROW_LABEL_PADDING, STROKE_SIZES, TEXT_PROPS } from '../shared/default-shape-constants'
|
|
54
|
-
import { DefaultFontFaces } from '../shared/defaultFonts'
|
|
55
56
|
import { getFillDefForCanvas, getFillDefForExport } from '../shared/defaultStyleDefs'
|
|
56
57
|
import { useDefaultColorTheme } from '../shared/useDefaultColorTheme'
|
|
57
58
|
import { getArrowBodyPath, getArrowHandlePath } from './ArrowPath'
|
|
@@ -156,8 +157,13 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
override getFontFaces(shape: TLArrowShape) {
|
|
159
|
-
if (
|
|
160
|
-
|
|
160
|
+
if (isEmptyRichText(shape.props.richText)) return EMPTY_ARRAY
|
|
161
|
+
|
|
162
|
+
return getFontsFromRichText(this.editor, shape.props.richText, {
|
|
163
|
+
family: `tldraw_${shape.props.font}`,
|
|
164
|
+
weight: 'normal',
|
|
165
|
+
style: 'normal',
|
|
166
|
+
})
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
override getDefaultProps(): TLArrowShape['props'] {
|
|
@@ -174,7 +180,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
174
180
|
end: { x: 2, y: 0 },
|
|
175
181
|
arrowheadStart: 'none',
|
|
176
182
|
arrowheadEnd: 'arrow',
|
|
177
|
-
|
|
183
|
+
richText: toRichText(''),
|
|
178
184
|
labelPosition: 0.5,
|
|
179
185
|
font: 'draw',
|
|
180
186
|
scale: 1,
|
|
@@ -204,7 +210,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
204
210
|
: new Polyline2d({ points: info.route.points })
|
|
205
211
|
|
|
206
212
|
let labelGeom
|
|
207
|
-
if (isEditing || shape.props.
|
|
213
|
+
if (isEditing || !isEmptyRichText(shape.props.richText)) {
|
|
208
214
|
const labelPosition = getArrowLabelPosition(this.editor, shape)
|
|
209
215
|
if (debugFlags.debugGeometry.get()) {
|
|
210
216
|
debugGeom.push(...labelPosition.debugGeom)
|
|
@@ -276,7 +282,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
override getText(shape: TLArrowShape) {
|
|
279
|
-
return shape.props.
|
|
285
|
+
return renderPlaintextFromRichText(this.editor, shape.props.richText)
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
override onHandleDrag(shape: TLArrowShape, info: TLHandleDragInfo<TLArrowShape>) {
|
|
@@ -757,7 +763,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
757
763
|
const labelPosition = getArrowLabelPosition(this.editor, shape)
|
|
758
764
|
const isSelected = shape.id === this.editor.getOnlySelectedShapeId()
|
|
759
765
|
const isEditing = this.editor.getEditingShapeId() === shape.id
|
|
760
|
-
const showArrowLabel = isEditing || shape.props.
|
|
766
|
+
const showArrowLabel = isEditing || !isEmptyRichText(shape.props.richText)
|
|
761
767
|
|
|
762
768
|
return (
|
|
763
769
|
<>
|
|
@@ -771,16 +777,15 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
771
777
|
)}
|
|
772
778
|
</SVGContainer>
|
|
773
779
|
{showArrowLabel && (
|
|
774
|
-
<
|
|
780
|
+
<RichTextLabel
|
|
775
781
|
shapeId={shape.id}
|
|
776
|
-
classNamePrefix="tl-arrow"
|
|
777
782
|
type="arrow"
|
|
778
783
|
font={shape.props.font}
|
|
779
784
|
fontSize={getArrowLabelFontSize(shape)}
|
|
780
785
|
lineHeight={TEXT_PROPS.lineHeight}
|
|
781
786
|
align="middle"
|
|
782
787
|
verticalAlign="middle"
|
|
783
|
-
|
|
788
|
+
richText={shape.props.richText}
|
|
784
789
|
labelColor={theme[shape.props.labelColor].solid}
|
|
785
790
|
textWidth={labelPosition.box.w - ARROW_LABEL_PADDING * 2 * shape.props.scale}
|
|
786
791
|
isSelected={isSelected}
|
|
@@ -806,9 +811,9 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
806
811
|
const { start, end } = getArrowTerminalsInArrowSpace(this.editor, shape, info?.bindings)
|
|
807
812
|
const geometry = this.editor.getShapeGeometry<Group2d>(shape)
|
|
808
813
|
const bounds = geometry.bounds
|
|
814
|
+
const isEmpty = isEmptyRichText(shape.props.richText)
|
|
809
815
|
|
|
810
|
-
const labelGeometry =
|
|
811
|
-
isEditing || shape.props.text.trim() ? (geometry.children[1] as Rectangle2d) : null
|
|
816
|
+
const labelGeometry = isEditing || !isEmpty ? (geometry.children[1] as Rectangle2d) : null
|
|
812
817
|
|
|
813
818
|
if (Vec.Equals(start, end)) return null
|
|
814
819
|
|
|
@@ -847,7 +852,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
847
852
|
<defs>
|
|
848
853
|
<ArrowClipPath
|
|
849
854
|
radius={3.5 * shape.props.scale}
|
|
850
|
-
hasText={
|
|
855
|
+
hasText={!isEmpty}
|
|
851
856
|
bounds={bounds}
|
|
852
857
|
labelBounds={labelBounds}
|
|
853
858
|
as={clipStartArrowhead && as ? as : ''}
|
|
@@ -905,7 +910,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
905
910
|
}
|
|
906
911
|
|
|
907
912
|
override onEditStart(shape: TLArrowShape) {
|
|
908
|
-
if (shape.props.
|
|
913
|
+
if (isEmptyRichText(shape.props.richText)) {
|
|
909
914
|
// editing text for the first time, so set the position to the default:
|
|
910
915
|
const labelPosition = getArrowLabelDefaultPosition(this.editor, shape)
|
|
911
916
|
this.editor.updateShape<TLArrowShape>({
|
|
@@ -916,26 +921,6 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
916
921
|
}
|
|
917
922
|
}
|
|
918
923
|
|
|
919
|
-
override onEditEnd(shape: TLArrowShape) {
|
|
920
|
-
const {
|
|
921
|
-
id,
|
|
922
|
-
type,
|
|
923
|
-
props: { text },
|
|
924
|
-
} = shape
|
|
925
|
-
|
|
926
|
-
if (text.trimEnd() !== shape.props.text) {
|
|
927
|
-
this.editor.updateShapes<TLArrowShape>([
|
|
928
|
-
{
|
|
929
|
-
id,
|
|
930
|
-
type,
|
|
931
|
-
props: {
|
|
932
|
-
text: text.trimEnd(),
|
|
933
|
-
},
|
|
934
|
-
},
|
|
935
|
-
])
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
924
|
override toSvg(shape: TLArrowShape, ctx: SvgExportContext) {
|
|
940
925
|
ctx.addExportDef(getFillDefForExport(shape.props.fill))
|
|
941
926
|
const theme = getDefaultColorTheme(ctx)
|
|
@@ -944,12 +929,12 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
944
929
|
return (
|
|
945
930
|
<g transform={`scale(${scaleFactor})`}>
|
|
946
931
|
<ArrowSvg shape={shape} shouldDisplayHandles={false} />
|
|
947
|
-
<
|
|
932
|
+
<RichTextSVG
|
|
948
933
|
fontSize={getArrowLabelFontSize(shape)}
|
|
949
934
|
font={shape.props.font}
|
|
950
935
|
align="middle"
|
|
951
936
|
verticalAlign="middle"
|
|
952
|
-
|
|
937
|
+
richText={shape.props.richText}
|
|
953
938
|
labelColor={theme[shape.props.labelColor].solid}
|
|
954
939
|
bounds={getArrowLabelPosition(this.editor, shape)
|
|
955
940
|
.box.clone()
|
|
@@ -1031,6 +1016,7 @@ const ArrowSvg = track(function ArrowSvg({
|
|
|
1031
1016
|
if (!geometry) return null
|
|
1032
1017
|
const bounds = Box.ZeroFix(geometry.bounds)
|
|
1033
1018
|
const bindings = getArrowBindings(editor, shape)
|
|
1019
|
+
const isEmpty = isEmptyRichText(shape.props.richText)
|
|
1034
1020
|
|
|
1035
1021
|
if (!info?.isValid) return null
|
|
1036
1022
|
|
|
@@ -1081,7 +1067,7 @@ const ArrowSvg = track(function ArrowSvg({
|
|
|
1081
1067
|
<clipPath id={clipPathId}>
|
|
1082
1068
|
<ArrowClipPath
|
|
1083
1069
|
radius={3.5 * shape.props.scale}
|
|
1084
|
-
hasText={isEditing ||
|
|
1070
|
+
hasText={isEditing || !isEmpty}
|
|
1085
1071
|
bounds={bounds}
|
|
1086
1072
|
labelBounds={labelPosition.box}
|
|
1087
1073
|
as={clipStartArrowhead && as ? as : ''}
|
|
@@ -9,13 +9,17 @@ import {
|
|
|
9
9
|
Polygon2d,
|
|
10
10
|
Polyline2d,
|
|
11
11
|
TLArrowShape,
|
|
12
|
+
TLShape,
|
|
12
13
|
Vec,
|
|
13
14
|
VecLike,
|
|
14
15
|
clamp,
|
|
15
16
|
createComputedCache,
|
|
16
17
|
exhaustiveSwitchError,
|
|
17
18
|
getChangedKeys,
|
|
19
|
+
pointInPolygon,
|
|
20
|
+
toRichText,
|
|
18
21
|
} from '@tldraw/editor'
|
|
22
|
+
import { isEmptyRichText, renderHtmlFromRichTextForMeasurement } from '../../utils/text/richText'
|
|
19
23
|
import {
|
|
20
24
|
ARROW_LABEL_FONT_SIZES,
|
|
21
25
|
ARROW_LABEL_PADDING,
|
|
@@ -59,14 +63,18 @@ const labelSizeCache = createComputedCache(
|
|
|
59
63
|
|
|
60
64
|
const bodyGeom = getArrowBodyGeometry(editor, shape)
|
|
61
65
|
// We use 'i' as a default label to measure against as a minimum width.
|
|
62
|
-
const
|
|
66
|
+
const isEmpty = isEmptyRichText(shape.props.richText)
|
|
67
|
+
const html = renderHtmlFromRichTextForMeasurement(
|
|
68
|
+
editor,
|
|
69
|
+
isEmpty ? toRichText('i') : shape.props.richText
|
|
70
|
+
)
|
|
63
71
|
|
|
64
72
|
const bodyBounds = bodyGeom.bounds
|
|
65
73
|
|
|
66
74
|
const fontSize = getArrowLabelFontSize(shape)
|
|
67
75
|
|
|
68
76
|
// First we measure the text with no constraints
|
|
69
|
-
const { w, h } = editor.textMeasure.
|
|
77
|
+
const { w, h } = editor.textMeasure.measureHtml(html, {
|
|
70
78
|
...TEXT_PROPS,
|
|
71
79
|
fontFamily: FONT_FAMILIES[shape.props.font],
|
|
72
80
|
fontSize,
|
|
@@ -96,7 +104,7 @@ const labelSizeCache = createComputedCache(
|
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
if (shouldSquish) {
|
|
99
|
-
const { w: squishedWidth, h: squishedHeight } = editor.textMeasure.
|
|
107
|
+
const { w: squishedWidth, h: squishedHeight } = editor.textMeasure.measureHtml(html, {
|
|
100
108
|
...TEXT_PROPS,
|
|
101
109
|
fontFamily: FONT_FAMILIES[shape.props.font],
|
|
102
110
|
fontSize,
|
|
@@ -292,3 +300,15 @@ export function getArrowLabelDefaultPosition(editor: Editor, shape: TLArrowShape
|
|
|
292
300
|
exhaustiveSwitchError(info, 'type')
|
|
293
301
|
}
|
|
294
302
|
}
|
|
303
|
+
|
|
304
|
+
/** @internal */
|
|
305
|
+
export function isOverArrowLabel(editor: Editor, shape: TLShape) {
|
|
306
|
+
if (!editor.isShapeOfType<TLArrowShape>(shape, 'arrow')) return false
|
|
307
|
+
|
|
308
|
+
const pointInShapeSpace = editor.getPointInShapeSpace(shape, editor.inputs.currentPagePoint)
|
|
309
|
+
// How should we handle multiple labels? Do shapes ever have multiple labels?
|
|
310
|
+
const labelGeometry = editor.getShapeGeometry<Group2d>(shape).children[1]
|
|
311
|
+
// Knowing what we know about arrows... if the shape has no text in its label,
|
|
312
|
+
// then the label geometry should not be there.
|
|
313
|
+
return labelGeometry && pointInPolygon(pointInShapeSpace, labelGeometry.vertices)
|
|
314
|
+
}
|
|
@@ -118,6 +118,7 @@ export class Pointing extends StateNode {
|
|
|
118
118
|
const change = util.onHandleDrag?.(shape, {
|
|
119
119
|
handle: { ...startHandle, x: 0, y: 0 },
|
|
120
120
|
isPrecise: true,
|
|
121
|
+
isCreatingShape: true,
|
|
121
122
|
initial: initial,
|
|
122
123
|
})
|
|
123
124
|
|
|
@@ -145,6 +146,7 @@ export class Pointing extends StateNode {
|
|
|
145
146
|
const change = util.onHandleDrag?.(shape, {
|
|
146
147
|
handle: { ...startHandle, x: 0, y: 0 },
|
|
147
148
|
isPrecise: this.isPrecise,
|
|
149
|
+
isCreatingShape: true,
|
|
148
150
|
initial: initial,
|
|
149
151
|
})
|
|
150
152
|
|
|
@@ -162,6 +164,7 @@ export class Pointing extends StateNode {
|
|
|
162
164
|
const change = util.onHandleDrag?.(this.editor.getShape(shape)!, {
|
|
163
165
|
handle: { ...endHandle, x: point.x, y: point.y },
|
|
164
166
|
isPrecise: false,
|
|
167
|
+
isCreatingShape: true,
|
|
165
168
|
initial: initial,
|
|
166
169
|
})
|
|
167
170
|
|
|
@@ -145,8 +145,6 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
override onHandleDrag(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
|
|
148
|
-
// we should only ever be dragging vertex handles
|
|
149
|
-
if (handle.type !== 'vertex') return
|
|
150
148
|
const newPoint = maybeSnapToGrid(new Vec(handle.x, handle.y), this.editor)
|
|
151
149
|
return {
|
|
152
150
|
...shape,
|
|
@@ -160,6 +158,25 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
160
158
|
}
|
|
161
159
|
}
|
|
162
160
|
|
|
161
|
+
override onHandleDragStart(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
|
|
162
|
+
// For line shapes, if we're dragging a "create" handle, then
|
|
163
|
+
// create a new vertex handle at that point; and make this handle
|
|
164
|
+
// the handle that we're dragging.
|
|
165
|
+
if (handle.type === 'create') {
|
|
166
|
+
return {
|
|
167
|
+
...shape,
|
|
168
|
+
props: {
|
|
169
|
+
...shape.props,
|
|
170
|
+
points: {
|
|
171
|
+
...shape.props.points,
|
|
172
|
+
[handle.index]: { id: handle.index, index: handle.index, x: handle.x, y: handle.y },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
|
|
163
180
|
component(shape: TLLineShape) {
|
|
164
181
|
return (
|
|
165
182
|
<SVGContainer style={{ minWidth: 50, minHeight: 50 }}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Mat,
|
|
2
3
|
StateNode,
|
|
3
4
|
TLArrowShape,
|
|
4
5
|
TLHandle,
|
|
@@ -26,20 +27,20 @@ export type DraggingHandleInfo = TLPointerEventInfo & {
|
|
|
26
27
|
export class DraggingHandle extends StateNode {
|
|
27
28
|
static override id = 'dragging_handle'
|
|
28
29
|
|
|
29
|
-
shapeId
|
|
30
|
-
initialHandle
|
|
31
|
-
initialAdjacentHandle
|
|
32
|
-
initialPagePoint
|
|
30
|
+
shapeId!: TLShapeId
|
|
31
|
+
initialHandle!: TLHandle
|
|
32
|
+
initialAdjacentHandle!: TLHandle | null
|
|
33
|
+
initialPagePoint!: Vec
|
|
33
34
|
|
|
34
|
-
markId
|
|
35
|
-
initialPageTransform
|
|
36
|
-
initialPageRotation
|
|
35
|
+
markId!: string
|
|
36
|
+
initialPageTransform!: Mat
|
|
37
|
+
initialPageRotation!: number
|
|
37
38
|
|
|
38
|
-
info
|
|
39
|
+
info!: DraggingHandleInfo
|
|
39
40
|
|
|
40
41
|
isPrecise = false
|
|
41
|
-
isPreciseId
|
|
42
|
-
pointingId
|
|
42
|
+
isPreciseId: TLShapeId | null = null
|
|
43
|
+
pointingId: TLShapeId | null = null
|
|
43
44
|
|
|
44
45
|
override onEnter(info: DraggingHandleInfo) {
|
|
45
46
|
const { shape, isCreating, creatingMarkId, handle } = info
|
|
@@ -66,26 +67,6 @@ export class DraggingHandle extends StateNode {
|
|
|
66
67
|
|
|
67
68
|
this.initialHandle = structuredClone(handle)
|
|
68
69
|
|
|
69
|
-
if (this.editor.isShapeOfType<TLLineShape>(shape, 'line')) {
|
|
70
|
-
// For line shapes, if we're dragging a "create" handle, then
|
|
71
|
-
// create a new vertex handle at that point; and make this handle
|
|
72
|
-
// the handle that we're dragging.
|
|
73
|
-
if (this.initialHandle.type === 'create') {
|
|
74
|
-
this.editor.updateShape({
|
|
75
|
-
...shape,
|
|
76
|
-
props: {
|
|
77
|
-
points: {
|
|
78
|
-
...shape.props.points,
|
|
79
|
-
[handle.index]: { id: handle.index, index: handle.index, x: handle.x, y: handle.y },
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
})
|
|
83
|
-
const handlesAfter = this.editor.getShapeHandles(shape)!
|
|
84
|
-
const handleAfter = handlesAfter.find((h) => h.index === handle.index)!
|
|
85
|
-
this.initialHandle = structuredClone(handleAfter)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
70
|
this.initialPageTransform = this.editor.getShapePageTransform(shape)!
|
|
90
71
|
this.initialPageRotation = this.initialPageTransform.rotation()
|
|
91
72
|
this.initialPagePoint = this.editor.inputs.originPagePoint.clone()
|
|
@@ -135,6 +116,19 @@ export class DraggingHandle extends StateNode {
|
|
|
135
116
|
}
|
|
136
117
|
// -->
|
|
137
118
|
|
|
119
|
+
// Call onHandleDragStart callback
|
|
120
|
+
const handleDragInfo = {
|
|
121
|
+
handle: this.initialHandle,
|
|
122
|
+
isPrecise: this.isPrecise,
|
|
123
|
+
isCreatingShape: !!this.info.isCreating,
|
|
124
|
+
initial: shape,
|
|
125
|
+
}
|
|
126
|
+
const util = this.editor.getShapeUtil(shape)
|
|
127
|
+
const startChanges = util.onHandleDragStart?.(shape, handleDragInfo)
|
|
128
|
+
if (startChanges) {
|
|
129
|
+
this.editor.updateShapes([{ ...startChanges, id: shape.id, type: shape.type }])
|
|
130
|
+
}
|
|
131
|
+
|
|
138
132
|
this.update()
|
|
139
133
|
|
|
140
134
|
this.editor.select(this.shapeId)
|
|
@@ -204,6 +198,22 @@ export class DraggingHandle extends StateNode {
|
|
|
204
198
|
this.editor.snaps.clearIndicators()
|
|
205
199
|
kickoutOccludedShapes(this.editor, [this.shapeId])
|
|
206
200
|
|
|
201
|
+
// Call onHandleDragEnd callback before state transitions
|
|
202
|
+
const shape = this.editor.getShape(this.shapeId)
|
|
203
|
+
if (shape) {
|
|
204
|
+
const util = this.editor.getShapeUtil(shape)
|
|
205
|
+
const handleDragInfo = {
|
|
206
|
+
handle: this.initialHandle,
|
|
207
|
+
isPrecise: this.isPrecise,
|
|
208
|
+
isCreatingShape: !!this.info.isCreating,
|
|
209
|
+
initial: this.info.shape,
|
|
210
|
+
}
|
|
211
|
+
const endChanges = util.onHandleDragEnd?.(shape, handleDragInfo)
|
|
212
|
+
if (endChanges) {
|
|
213
|
+
this.editor.updateShapes([{ ...endChanges, id: shape.id, type: shape.type }])
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
207
217
|
const { onInteractionEnd } = this.info
|
|
208
218
|
if (this.editor.getInstanceState().isToolLocked && onInteractionEnd) {
|
|
209
219
|
// Return to the tool that was active before this one,
|
|
@@ -216,6 +226,19 @@ export class DraggingHandle extends StateNode {
|
|
|
216
226
|
}
|
|
217
227
|
|
|
218
228
|
private cancel() {
|
|
229
|
+
// Call onHandleDragCancel callback before bailing to mark
|
|
230
|
+
const shape = this.editor.getShape(this.shapeId)
|
|
231
|
+
if (shape) {
|
|
232
|
+
const util = this.editor.getShapeUtil(shape)
|
|
233
|
+
const handleDragInfo = {
|
|
234
|
+
handle: this.initialHandle,
|
|
235
|
+
isPrecise: this.isPrecise,
|
|
236
|
+
isCreatingShape: !!this.info.isCreating,
|
|
237
|
+
initial: this.info.shape,
|
|
238
|
+
}
|
|
239
|
+
util.onHandleDragCancel?.(shape, handleDragInfo)
|
|
240
|
+
}
|
|
241
|
+
|
|
219
242
|
this.editor.bailToMark(this.markId)
|
|
220
243
|
this.editor.snaps.clearIndicators()
|
|
221
244
|
|
|
@@ -284,6 +307,7 @@ export class DraggingHandle extends StateNode {
|
|
|
284
307
|
const changes = util.onHandleDrag?.(shape, {
|
|
285
308
|
handle: nextHandle,
|
|
286
309
|
isPrecise: this.isPrecise || altKey,
|
|
310
|
+
isCreatingShape: !!this.info.isCreating,
|
|
287
311
|
initial: initial,
|
|
288
312
|
})
|
|
289
313
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Editor,
|
|
3
|
-
Group2d,
|
|
4
3
|
StateNode,
|
|
5
4
|
TLAdjacentDirection,
|
|
6
|
-
TLArrowShape,
|
|
7
5
|
TLClickEventInfo,
|
|
8
6
|
TLGroupShape,
|
|
9
7
|
TLKeyboardEventInfo,
|
|
@@ -18,6 +16,7 @@ import {
|
|
|
18
16
|
pointInPolygon,
|
|
19
17
|
toRichText,
|
|
20
18
|
} from '@tldraw/editor'
|
|
19
|
+
import { isOverArrowLabel } from '../../../shapes/arrow/arrowLabel'
|
|
21
20
|
import { getHitShapeOnCanvasPointerDown } from '../../selection-logic/getHitShapeOnCanvasPointerDown'
|
|
22
21
|
import { getShouldEnterCropMode } from '../../selection-logic/getShouldEnterCropModeOnPointerDown'
|
|
23
22
|
import { selectOnCanvasPointerUp } from '../../selection-logic/selectOnCanvasPointerUp'
|
|
@@ -98,12 +97,6 @@ export class Idle extends StateNode {
|
|
|
98
97
|
case 'shape': {
|
|
99
98
|
const { shape } = info
|
|
100
99
|
|
|
101
|
-
if (this.isOverArrowLabelTest(shape)) {
|
|
102
|
-
// We're moving the label on a shape.
|
|
103
|
-
this.parent.transition('pointing_arrow_label', info)
|
|
104
|
-
break
|
|
105
|
-
}
|
|
106
|
-
|
|
107
100
|
if (this.editor.isShapeOrAncestorLocked(shape)) {
|
|
108
101
|
this.parent.transition('pointing_canvas', info)
|
|
109
102
|
break
|
|
@@ -595,22 +588,7 @@ export class Idle extends StateNode {
|
|
|
595
588
|
isOverArrowLabelTest(shape: TLShape | undefined) {
|
|
596
589
|
if (!shape) return false
|
|
597
590
|
|
|
598
|
-
|
|
599
|
-
if (this.editor.isShapeOfType<TLArrowShape>(shape, 'arrow')) {
|
|
600
|
-
const pointInShapeSpace = this.editor.getPointInShapeSpace(
|
|
601
|
-
shape,
|
|
602
|
-
this.editor.inputs.currentPagePoint
|
|
603
|
-
)
|
|
604
|
-
// How should we handle multiple labels? Do shapes ever have multiple labels?
|
|
605
|
-
const labelGeometry = this.editor.getShapeGeometry<Group2d>(shape).children[1]
|
|
606
|
-
// Knowing what we know about arrows... if the shape has no text in its label,
|
|
607
|
-
// then the label geometry should not be there.
|
|
608
|
-
if (labelGeometry && pointInPolygon(pointInShapeSpace, labelGeometry.vertices)) {
|
|
609
|
-
return true
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
return false
|
|
591
|
+
return isOverArrowLabel(this.editor, shape)
|
|
614
592
|
}
|
|
615
593
|
|
|
616
594
|
handleDoubleClickOnCanvas(info: TLClickEventInfo) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StateNode, TLPointerEventInfo, TLShape } from '@tldraw/editor'
|
|
2
|
+
import { isOverArrowLabel } from '../../../shapes/arrow/arrowLabel'
|
|
2
3
|
import { getTextLabels } from '../../../utils/shapes/shapes'
|
|
3
4
|
|
|
4
5
|
export class PointingShape extends StateNode {
|
|
@@ -210,6 +211,12 @@ export class PointingShape extends StateNode {
|
|
|
210
211
|
|
|
211
212
|
override onPointerMove(info: TLPointerEventInfo) {
|
|
212
213
|
if (this.editor.inputs.isDragging) {
|
|
214
|
+
if (isOverArrowLabel(this.editor, this.hitShape)) {
|
|
215
|
+
// We're moving the label on a shape.
|
|
216
|
+
this.parent.transition('pointing_arrow_label', { ...info, shape: this.hitShape })
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
|
|
213
220
|
if (this.didCtrlOnEnter) {
|
|
214
221
|
this.parent.transition('brushing', info)
|
|
215
222
|
} else {
|
|
@@ -122,8 +122,19 @@ export class Resizing extends StateNode {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
private cancel() {
|
|
125
|
-
//
|
|
125
|
+
// Call onResizeCancel callback before resetting
|
|
126
|
+
const { shapeSnapshots } = this.snapshot
|
|
127
|
+
|
|
128
|
+
shapeSnapshots.forEach(({ shape }) => {
|
|
129
|
+
const current = this.editor.getShape(shape.id)
|
|
130
|
+
if (current) {
|
|
131
|
+
const util = this.editor.getShapeUtil(shape)
|
|
132
|
+
util.onResizeCancel?.(shape, current)
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
126
136
|
this.editor.bailToMark(this.markId)
|
|
137
|
+
|
|
127
138
|
if (this.info.onInteractionEnd) {
|
|
128
139
|
this.editor.setCurrentTool(this.info.onInteractionEnd, {})
|
|
129
140
|
} else {
|
|
@@ -109,6 +109,17 @@ export class Rotating extends StateNode {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
private cancel() {
|
|
112
|
+
// Call onRotateCancel callback before bailing to mark
|
|
113
|
+
const { shapeSnapshots } = this.snapshot
|
|
114
|
+
|
|
115
|
+
shapeSnapshots.forEach(({ shape }) => {
|
|
116
|
+
const current = this.editor.getShape(shape.id)
|
|
117
|
+
if (current) {
|
|
118
|
+
const util = this.editor.getShapeUtil(shape)
|
|
119
|
+
util.onRotateCancel?.(shape, current)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
112
123
|
this.editor.bailToMark(this.markId)
|
|
113
124
|
if (this.info.onInteractionEnd) {
|
|
114
125
|
this.editor.setCurrentTool(this.info.onInteractionEnd, this.info)
|
|
@@ -28,7 +28,6 @@ export type TranslatingInfo = TLPointerEventInfo & {
|
|
|
28
28
|
isCreating?: boolean
|
|
29
29
|
creatingMarkId?: string
|
|
30
30
|
onCreate?(): void
|
|
31
|
-
didStartInPit?: boolean
|
|
32
31
|
onInteractionEnd?: string
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -203,6 +202,17 @@ export class Translating extends StateNode {
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
private cancel() {
|
|
205
|
+
// Call onTranslateCancel callback before resetting
|
|
206
|
+
const { movingShapes } = this.snapshot
|
|
207
|
+
|
|
208
|
+
movingShapes.forEach((shape) => {
|
|
209
|
+
const current = this.editor.getShape(shape.id)
|
|
210
|
+
if (current) {
|
|
211
|
+
const util = this.editor.getShapeUtil(shape)
|
|
212
|
+
util.onTranslateCancel?.(shape, current)
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
206
216
|
this.reset()
|
|
207
217
|
if (this.info.onInteractionEnd) {
|
|
208
218
|
this.editor.setCurrentTool(this.info.onInteractionEnd)
|
package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx
CHANGED
|
@@ -210,6 +210,38 @@ export function DefaultKeyboardShortcutsDialogContent() {
|
|
|
210
210
|
/* do nothing */
|
|
211
211
|
}}
|
|
212
212
|
/>
|
|
213
|
+
<TldrawUiMenuItem
|
|
214
|
+
id="a11y-rotate-shape-cw"
|
|
215
|
+
label="a11y.rotate-shape-cw"
|
|
216
|
+
kbd="shift+﹥"
|
|
217
|
+
onSelect={() => {
|
|
218
|
+
/* do nothing */
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
<TldrawUiMenuItem
|
|
222
|
+
id="a11y-rotate-shape-cw-fine"
|
|
223
|
+
label="a11y.rotate-shape-cw-fine"
|
|
224
|
+
kbd="shift+alt+﹥"
|
|
225
|
+
onSelect={() => {
|
|
226
|
+
/* do nothing */
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
<TldrawUiMenuItem
|
|
230
|
+
id="a11y-rotate-shape-ccw"
|
|
231
|
+
label="a11y.rotate-shape-ccw"
|
|
232
|
+
kbd="shift+﹤"
|
|
233
|
+
onSelect={() => {
|
|
234
|
+
/* do nothing */
|
|
235
|
+
}}
|
|
236
|
+
/>
|
|
237
|
+
<TldrawUiMenuItem
|
|
238
|
+
id="a11y-rotate-shape-ccw-fine"
|
|
239
|
+
label="a11y.rotate-shape-ccw-fine"
|
|
240
|
+
kbd="shift+alt+﹤"
|
|
241
|
+
onSelect={() => {
|
|
242
|
+
/* do nothing */
|
|
243
|
+
}}
|
|
244
|
+
/>
|
|
213
245
|
<TldrawUiMenuActionItem actionId="enlarge-shapes" />
|
|
214
246
|
<TldrawUiMenuActionItem actionId="shrink-shapes" />
|
|
215
247
|
<TldrawUiMenuActionItem actionId="a11y-repeat-shape-announce" />
|
|
@@ -6,10 +6,12 @@ import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
|
6
6
|
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
7
7
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/** @public */
|
|
10
|
+
export interface ToggleToolLockedButtonProps {
|
|
10
11
|
activeToolId?: string
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/** @public @react */
|
|
13
15
|
export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonProps) {
|
|
14
16
|
const editor = useEditor()
|
|
15
17
|
const breakpoint = useBreakpoint()
|
|
@@ -86,6 +86,7 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
86
86
|
aria-valuemin={(min ?? 0) * ariaValueModifier}
|
|
87
87
|
aria-valuenow={value * ariaValueModifier}
|
|
88
88
|
aria-valuemax={steps * ariaValueModifier}
|
|
89
|
+
aria-label={title + ' — ' + msg(label as TLUiTranslationKey)}
|
|
89
90
|
className="tlui-slider__thumb"
|
|
90
91
|
dir="ltr"
|
|
91
92
|
ref={ref}
|