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
pull/2801/head
alex 2024-02-08 17:08:57 +00:00 zatwierdzone przez GitHub
rodzic fdadaf6044
commit 056481899c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
6 zmienionych plików z 2 dodań i 42 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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)",

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

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

Wyświetl plik

@ -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,
})
}