Table of contents

Options passed to BindingUtil.onBeforeIsolateFromShape and BindingUtil.onBeforeIsolateToShape, describing a shape that is about to be isolated from the one that it's bound to.

Isolation happens whenever two bound shapes are separated. For example

  1. One is deleted, but the other is not.
  2. One is copied, but the other is not.
  3. One is duplicated, but the other is not.

In each of these cases, if the remaining shape depends on the binding for its rendering, it may now be in an inconsistent state. For example, tldraw's arrow shape depends on the binding to know where the end of the arrow is. If we removed the binding without doing anything else, the arrow would suddenly be pointing to the wrong location. Instead, when the shape the arrow is pointing to is deleted, or the arrow is copied/duplicated, we use an isolation callback. The callback updates the arrow based on the binding that's about to be removed, so it doesn't end up pointing to the wrong place.

For this style of consistency update, use isolation callbacks. For actions specific to deletion (like deleting a sticker when the shape it's bound to is removed), use the delete callbacks (BindingUtil.onBeforeDeleteFromShape and BindingUtil.onBeforeDeleteToShape) instead.

interface BindingOnShapeIsolateOptions<Binding extends TLUnknownBinding> {}

Properties

binding

The binding record that refers to the shape in question.

binding: Binding

removedShape

The shape being removed. For deletion, this is the deleted shape. For copy/duplicate, this is the shape that isn't being copied/duplicated and is getting left behind.

removedShape: TLShape

BindingOnShapeDeleteOptionsBoundsSnapGeometry