Remove Geometry2d.isSnappable (#2768)

`Geometry2d.isSnappable` isn't used. There's some intended behaviour
here around making it so you can't snap handles to text labels, but it's
not actually working.

This is a breaking change, but given this property doesn't do anything I
don't think it's likely to be heavily depended upon

### Change Type
- [x] `major` — Breaking change
This commit is contained in:
alex 2024-02-08 17:08:57 +00:00 committed by GitHub
parent fdadaf6044
commit 056481899c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 2 additions and 42 deletions

View file

@ -548,7 +548,6 @@ export class Edge2d extends Geometry2d {
constructor(config: {
start: Vec;
end: Vec;
isSnappable?: boolean;
});
// (undocumented)
d: Vec;
@ -1033,8 +1032,6 @@ export abstract class Geometry2d {
// (undocumented)
isPointInBounds(point: Vec, margin?: number): boolean;
// (undocumented)
isSnappable: boolean;
// (undocumented)
abstract nearestPoint(point: Vec): Vec;
// (undocumented)
nearestPointOnLineSegment(A: Vec, B: Vec): Vec;

View file

@ -6569,7 +6569,7 @@
},
{
"kind": "Content",
"text": ";\n isSnappable?: boolean;\n }"
"text": ";\n }"
},
{
"kind": "Content",
@ -21059,36 +21059,6 @@
"isAbstract": false,
"name": "isPointInBounds"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/editor!Geometry2d#isSnappable:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "isSnappable: "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "isSnappable",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/editor!Geometry2d#nearestPoint:member(1)",

View file

@ -10,7 +10,7 @@ export class Edge2d extends Geometry2d {
u: Vec
ul: number
constructor(config: { start: Vec; end: Vec; isSnappable?: boolean }) {
constructor(config: { start: Vec; end: Vec }) {
super({ ...config, isClosed: false, isFilled: false })
const { start, end } = config

View file

@ -6,7 +6,6 @@ export interface Geometry2dOptions {
isFilled: boolean
isClosed: boolean
isLabel?: boolean
isSnappable?: boolean
debugColor?: string
ignore?: boolean
}
@ -16,14 +15,12 @@ export abstract class Geometry2d {
isFilled = false
isClosed = true
isLabel = false
isSnappable = true
debugColor?: string
ignore?: boolean
constructor(opts: Geometry2dOptions) {
this.isFilled = opts.isFilled
this.isClosed = opts.isClosed
this.isSnappable = opts.isSnappable ?? false
this.isLabel = opts.isLabel ?? false
this.debugColor = opts.debugColor
this.ignore = opts.ignore

View file

@ -130,7 +130,6 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
return new Group2d({
children: [...(labelGeom ? [bodyGeom, labelGeom] : [bodyGeom]), ...debugGeom],
isSnappable: false,
})
}

View file

@ -299,7 +299,6 @@ export class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
width: w,
height: h,
isFilled,
isSnappable: true,
})
break
}
@ -333,12 +332,10 @@ export class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
width: labelWidth,
height: labelHeight,
isFilled: true,
isSnappable: false,
isLabel: true,
}),
...edges,
],
isSnappable: false,
})
}