kopia lustrzana https://github.com/Tldraw/Tldraw
move type check up to get one filter
rodzic
374882b9a6
commit
949d72aa6b
|
@ -5056,14 +5056,18 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
type: Binding['type']
|
type: Binding['type']
|
||||||
): Binding[] {
|
): Binding[] {
|
||||||
const id = typeof shape === 'string' ? shape : shape.id
|
const id = typeof shape === 'string' ? shape : shape.id
|
||||||
return this.getBindingsInvolvingShape(id, type).filter((b) => b.fromId === id) as Binding[]
|
return this.getBindingsInvolvingShape(id).filter(
|
||||||
|
(b) => b.fromId === id && b.type === type
|
||||||
|
) as Binding[]
|
||||||
}
|
}
|
||||||
getBindingsToShape<Binding extends TLUnknownBinding = TLBinding>(
|
getBindingsToShape<Binding extends TLUnknownBinding = TLBinding>(
|
||||||
shape: TLShape | TLShapeId,
|
shape: TLShape | TLShapeId,
|
||||||
type: Binding['type']
|
type: Binding['type']
|
||||||
): Binding[] {
|
): Binding[] {
|
||||||
const id = typeof shape === 'string' ? shape : shape.id
|
const id = typeof shape === 'string' ? shape : shape.id
|
||||||
return this.getBindingsInvolvingShape(id, type).filter((b) => b.toId === id) as Binding[]
|
return this.getBindingsInvolvingShape(id).filter(
|
||||||
|
(b) => b.toId === id && b.type === type
|
||||||
|
) as Binding[]
|
||||||
}
|
}
|
||||||
getBindingsInvolvingShape<Binding extends TLUnknownBinding = TLBinding>(
|
getBindingsInvolvingShape<Binding extends TLUnknownBinding = TLBinding>(
|
||||||
shape: TLShape | TLShapeId,
|
shape: TLShape | TLShapeId,
|
||||||
|
|
Ładowanie…
Reference in New Issue