-
Notifications
You must be signed in to change notification settings - Fork 0
Material Library
The Material Library is a per-project catalogue of physical materials β boards, tiles, panels, slabs β that can be applied to surfaces. Every material captures its real-world dimensions, joint width, minimum piece constraints, default orientation and visual style.
Feature line from the README: π¨ Material library with size, thickness, joints, and styles.
A material is defined by the following fields:
| Field | Meaning |
|---|---|
| Name | Unique label shown in dropdowns, legends and the cut list. |
| Unit width / Unit height | The native size of one piece in mm. |
| Thickness | Physical thickness in mm. Used by the PDF export and overlap rules. |
| Default joint | Default gap between adjacent pieces in mm. Patterns can override this. |
| Minimum piece width / height | Pieces smaller than this are flagged as waste during optimisation. |
| Default orientation |
horizontal (long side along X) or vertical (long side along Y). |
| Style | Three colours β fill, label, joint β used for on-canvas rendering. |
The library is stored in each project (project.materials) and persisted
together with the rest of the project state.
The material list lives in the bottom panel of the editor. From there you can:
- Add material β opens the editor in "create" mode.
- Edit an existing entry β opens the same dialog, prefilled.
- Delete an entry β removes it after a confirmation prompt; surfaces that referenced it are reset to "no material".
MaterialEditor.tsx powers a modal with three groups:
- Identity β name and default orientation.
-
Dimensions β unit width, unit height and thickness. All accept
compound units (
600,60 cm,0.6 m);parseLengthrejects invalid values with a focused error message. -
Constraints & joints β default joint, minimum piece width and
height. The dialog validates that:
- Width, height and thickness are positive.
-
minPieceWidth β€ unitWidthandminPieceHeight β€ unitHeight.
- Style β colour pickers for the piece fill, the label text and the joint outline.
Submitting dispatches either addMaterialCommand or updateMaterialCommand,
both of which are undoable.
In the Properties panel for a selected surface, the Material
dropdown lists every material in the project plus an β None β entry.
Once a material is chosen:
- Pieces are tiled across the surface using the assigned placement pattern.
- The piece fill / label / joint colours come from the material style.
- The pattern panel becomes the "Pattern settings" section, and pattern length units accept either millimetres or percentages of the material unit width.
- Renaming a material to a name that is already in use is rejected with a toast.
- The library prevents deleting a material that is referenced by an active layout without first clearing those references.
- Editing a material that drives a layout triggers regeneration the next time Generate material layout is clicked.
- UI β
src/features/materials/MaterialEditor.tsx,src/features/materials/MaterialList.tsx - Domain factory β
src/domain/materials/material.ts - Defaults & types β
src/types/material.ts - Commands β
src/domain/commands/builtin/materialCommands.ts
Documentation for the material-layout-planner project. Every feature in the application is documented here β see the contribution rules before opening a pull request.