Skip to content
All lessons
IntermediateWritten8 min

Glass that follows your edits

Assigning glass in a tool where the pieces are re-derived on every edit sounds like it should fall apart the moment you draw another line. It does not, and how it avoids that is worth two minutes of your attention.

Glass is anchored to a point, not to a piece

A piece has no lasting identity. Draw one more line and it is two pieces; delete one and it is half of something else. So glass cannot be a property of a piece: there would be nothing to attach it to.

Instead a region holds a point inside itself and a glass id. After every edit, each enclosed region claims whichever anchor now falls inside it. The glass stays where you put it because you did not put it on a piece, you put it on a spot.

Cutting through a piece keeps its color

On top of the anchors, a new region inherits the glass of whichever old region it came out of. Draw a line through a red piece and you get two red pieces, not one red and one bare, which is almost always what you meant.

  • Merging two pieces of different glass keeps the one whose anchor survives. Set it again if it picked the other.
  • Moving a line across an anchor can hand a region to its neighbor's glass. Draw first, color after, on anything complicated.
  • Undo restores the anchors along with the geometry, because they are part of the same document.

Working with the library

The sheets you can assign are real ones, matched against manufacturer catalogs, so what you approve on screen is what you can order. The public library at /library is the same catalog if you want to browse it away from a panel.

Read next