Clamp auto-size to the supported grid range - #16
Merged
Conversation
The grid sliders cap at 10u and the backend rejects anything outside 1-10u (validate_grid), but auto-size computed grid_x/grid_y purely from tool bounds. A tool wider than 420mm drove the bin past the cap, which broke the 2D canvas grid and the partial-bin matrix and made the save fail on the backend. Both auto-size paths now go through a shared clampGrid() helper, and the bin page shows a banner when a tool needed more room than the maximum bin can offer. The 1-10u limits live in constants.ts next to GRID_UNIT so the sliders and the clamp cannot drift apart. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The gridClamped flag was written from both auto-size and handleAddTool and cleared from neither of the paths that matter. Deleting the last tool made the auto-size effect return early, so the banner stayed on screen over an empty bin; adding a small tool to an already-clamped 10u bin computed max(10, small) == 10, which is not over the limit, so it wrongly cleared a banner that was still true. Compute it instead from the tool bounds, where it cannot go stale. That needed the "grid units to fit this span" maths in one place, so it moves to lib/binGrid.ts along with the bounds walk both call sites had inlined. The banner now also says that the overflowing geometry is cut off, which is what actually happens once the grid stops growing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The banner reads from the union bounds of every placed tool, so "a tool needs more room" is wrong whenever two tools together overflow a bin that either would fit alone, and "move that tool into a bin of its own" is impossible advice when one tool really is longer than 420mm. Say both things. It also fired with auto-size off, describing a grid that had stopped growing when nothing was growing it. Gate on autoSize. handleAddTool dropped a tool with no points rather than adding it un-centred. Unreachable for a traced tool, but silently discarding what the user asked for is the wrong failure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1Richter
added a commit
that referenced
this pull request
Aug 4, 2026
Brings together every open self-host PR (#2-#16) on top of upstream 0.8.0+7: #2 fix/half-grid-cell-placement #10 feat/custom-bin-size-mm #3 feat/split-multi-part #11 feat/cutout-line #4 feat/preview-bed-size-grid #12 feat/dashboard-hide-project-bins #5 fix/split-parts-3mf-export #13 feat/persist-tracer-selection #6 feat/always-export-3mf #14 feat/tool-quantity-duplicates #7 ci/run-frontend-tests #15 feat/unload-idle-models #8 feat/bin-editor-cutout-depth-cap #16 fix/clamp-autosize-grid #9 feat/bin-editor-cutout-editing Verified: 401 backend tests, 189 frontend tests, ruff and tsc clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft PR opened for review. Branch:
fix/clamp-autosize-grid.